An algorithm is a sequence of well-defined steps that defines in abstract the solution to a problem.

learn more… | top users | synonyms

4
votes
2answers
66 views

Why is `FindCycle` crashing for this graph?

I'm working with a directed graph, previously mentioned in Exporting a high-resolution GraphPlot of a very large graph (65,536 nodes). It can be generated with the following code: ...
5
votes
1answer
94 views

FInding outliers in multiple dimensions

I'm working on dataset which isn't normally distributed.which contains three dimensions like cost, discount and profit I'm trying to find outliers in all these dimensions. I used z score to find ...
1
vote
1answer
50 views

Is this the right way to use for loop [on hold]

Is this the right way to use for loop in order to find the sequence of $x_n$ ...
8
votes
3answers
908 views

Implement the Bisection algorithm elegantly and easily

Description: Rencently, I have finished my course Numerical Analysis, so I'd like to implement many algorithm that I have learned from that course.By this practice, I hope that I can improve my ...
5
votes
0answers
43 views

How to find the concave points of a point-set?

To solve the boundary of a set of planar geometry, I sampled $6$ graphs, then using RunnyKine's approach. ...
-4
votes
1answer
32 views

How to write this iterative sequence function in mathematica

The function is Tx=1-x if x∈[0,1/7) =(x+6)/7 if x∈[1/7,1]. I have to write the iterative sequence for n=0,1,2,3,4,5----- where x_{n+1}= ...
0
votes
1answer
32 views

How to fix a procedure to work for another functions? [closed]

I have a procedure. It takes points and draws rectangles. The problem is to change the procedure to work not only with standarts functions. And the list of points must be : ...
11
votes
2answers
406 views

How to fill a grid make its total be largest

I have a blank grid whose dimension is 5*5. I want to fill it with some number using 1, 2, 3 and 4. But in every blank space if you fill 2, its neighbor (include four direction, such as left, ...
2
votes
2answers
150 views

Refining subset relations

People who do combinatorics (like me) are often faced with the following problem: For a list of combinatorial objects (vectors, permutations graphs,etc.), we know what multi-set of values it ...
2
votes
1answer
66 views

Factor a polynomial Root into Roots of smallest possible degree

Suppose I have a polynomial Root representing an algebraic number. I want to represent it (if possible) as a product of several polynomial ...
0
votes
0answers
13 views

How to find this unknown variable? [migrated]

Known variables: Price = 52.89 Sales = 14121.63 Unit_Orders = Sales / Price = 267 max_orders = 31734 (600 units) max_units = 600 missing_orders = max_orders - Sales = 17612.37 = (Max_units - ...
0
votes
0answers
3 views

Complexity of a randomly-traveled N*M grid [migrated]

I made an algorithm that compute a random-path across a N*M grid using backtracking. It start at [N / 2][0] and shall finish at [N / 2][M - 1]. Each iteration he choose a random direction (Left, ...
4
votes
2answers
247 views

A problem about recursion formula of de Casteljau algorithm

I use Mathematica to implement the de Casteljau algorithm $$\vec{P}_{k,i}(u_0)=(1-u_0)\vec{P}_{k-1,i}(u_0)+u_0\vec{P}_{k-1,i+1}(u_0)$$ The graphics that de Casteljau algorithm generated as follows: ...
15
votes
2answers
1k views

Higher order SVD

Does anyone know how to do a higher order SVD in Mathematica ? A good reference seems to be here http://www.sandia.gov/~tgkolda/pubs/pubfiles/SAND2007-6702.pdf but I don't understand their formalism ...
14
votes
6answers
407 views

Given a large binary matrix, find the largest submatrix containing non-zero elements

I'm looking for a way to reduce a binary matrix containing zeros at some positions into a matrix that contains no zeros by deleting rows and columns of the original matrix until only non-zero values ...
5
votes
1answer
285 views

A problem about Steffensen method

Two days ago,I asked a question about bisection algorithm. Thanks for Michael E2 giving me a good solution My algorithm 1, I use the bisection algorithm to generate a initial value that contain a ...
4
votes
1answer
129 views

Find random $n$ combinations of values with a given sum

This problem is described in the related StackOverflow question: Find all combinations of coins when given some dollar value. I would like generate a list of $n$ combinations of values that sum up to ...
5
votes
1answer
130 views

How to implement QLearning?

I know that v10 has support for both Machine Learning and Finite Markov Processes, the Q-learning algorithm uses both. Specifically, Q-learning finds an optimal action-selection policy for any given ...
6
votes
1answer
193 views

How to efficiently find all combinations of the letters in an alphabet given a condition

Problem: I want to find all unique expressions with n number of terms that contain all the digits (or characters) in alphabet. ...
0
votes
1answer
66 views

Interpolate the discrete list into continuous function

I have a data whose list plot shows up following graph I would like to interpolate the missing data and make the function continuous but for particular x-coordinate there is multiple values of $y$ ...
1
vote
2answers
63 views

How to replace the selected value in matrix with a specific digit?

I want to replace the selected values through "RandomChoice" by 1 and all other values in matrix with 0. I want output in binary form matirx. ...
21
votes
5answers
3k views

Finding all elements within a certain range in a sorted list

Suppose we have a sorted list of values. Let's use list = Sort@RandomReal[1, 1000000]; for this example. I need a fast function ...
5
votes
2answers
146 views

Extending a list

I have a range of n integers (always starting at 1) which are 1 apart, f.e. Range[10], Range[17] or ...
6
votes
1answer
2k views

Efficient implementation of cubic equation of state

...In this case the Peng Robinson Equation of State. Equations of state are empirical equations with parameters derived from experimental data. They are used to predict pure component and mixture ...
2
votes
0answers
94 views

How to solve lowest eigenvalue with Lanczos or Arnoldi algorithm? [closed]

By setting Method->Arnoldi in Eigensystem I was able to solve lowest eigenvalue and eigenstate of a large sparse matrix. ...
9
votes
4answers
583 views

Calculating an integral by the Romberg Algorithm

In my "Numerical Analysis" course, I learned the Romberg Algorithm to numerically calculate the integral. The Romberg Algorithm as shown below: ...
67
votes
4answers
9k views

Programmatic approach to HDR photography with Mathematica image processing functions

The High dynamic range imaging (HDR or HDRI) direction in photography and image processing became very popular recently. Besides obvious photo art applications (see examples), there are many great ...
5
votes
1answer
209 views

Using mathematica to discover algorithms?

In Steven Wolfram's blog entries, he discusses using mathematica to discover algorithms. I have tried several different google searches for papers on such topics, and have found none. I suspect this ...
0
votes
1answer
55 views

Creating algorithm with several conditions

I'm pretty new to mathematica and was wondering if you guys could help me out. Example: We have the following coordinates: {1, 1}, {2, 1}, {3, 1}, {5, 1}, {1, 2}, {2, 2}, {3, 2}, where {x,y} And ...
4
votes
1answer
199 views

Random Partitions

I want to write a function RandomPartition to partition a vector of length n into p partitions of varying (random) lengths. For example with ...
8
votes
1answer
93 views

Smallest connected subgraph containing all given vertices

Given a connected graph $G$ and a subset of its vertices, $S$, I need to find the smallest connected subgraph of $G$ containing all of $S$. How would you approach this in Mathematica? I am asking ...
28
votes
2answers
1k views

How can I pack circles of different sizes into a spiral?

Given a list of circles of different areas, I need to arrange them tangentially in order of increasing area and spiraling outward. An example of the type of packing I'm attempting is shown by the ...
7
votes
2answers
312 views

Is there something akin to “SubgraphIsomorphismQ” in Mathematica 9?

Provided two unlabeled graphs, $G$ and $H$, I would like to test where $H$ is a subgraph of $G$. In other words, I'd like to test whether we can prune some fixed number of vertices or edges from $G$ ...
5
votes
1answer
141 views

Finding a complete subgraph efficiently

I'm working on some experimental algorithms which would benefit from methods to find an instance of complete subgraphs with N vertices in an undirected graph. This far I've tried these methods: ...
5
votes
1answer
425 views

Counting paths of a certain length between a source and sink vertex

I have a graph $G$, which may be directed or not, and I was wondering if there was an efficient way of using, say, BreadthFirstScan[] and FindShortestPath[] to count the number of paths between some ...
1
vote
0answers
39 views

Depth limited search in mathematica

I often use FindPath[G, 1, 2, {L}, All] where $G$ is some graph. This finds all paths of length exactly $L$ edges which run between nodes $1$ and $2$. In large ...
19
votes
2answers
451 views

Upper bound “Vicious nearest neighbour” algorithm suggestions

I am asking a question based on this question from the sister site MSE. In an effort to make this a self-contained question, I include the fiorst documented posing of the problem by Robert Abilock in ...
19
votes
11answers
1k views

Efficient way to build a certain square matrix

For odd n I'm looking for a short and swift way to construct with (f.e.) n = 3 n = 11 ...
12
votes
2answers
413 views

Determining whether two $k$-chromatic graphs are isomorphic (respecting vertex coloration)

Consider the case where I have two $k$-chromatic graphs $G_1$ and $G_2$, i.e. two graphs where individual vertices can be colored with one of a set of $k$ total colors, and I would like to determine ...
3
votes
2answers
189 views

Pollard's Rho algorithm

I'm working in Mathematica and I'm trying to implement the [Pollard's Rho Algorithm for the Discrete Logartihm Problem][1].
0
votes
0answers
56 views

Find the maximum hyperrectangle contained in a set of points

I have a question similar to this one ( Find the largest rectangular block satisfying some condition without iterating explicitly). but in my case I have a multidimensional (up to 6 dimensions) binary ...
2
votes
0answers
37 views

Algorithm to determine if two colored graphs are isomorphic? [duplicate]

I have two (vertex-)colored graphs. I want to determine if they are isomorphic, with the condition that the isomorphism respects the colors of the vertices. Moreover, I want the algorithm to output ...
18
votes
3answers
507 views

How to implement the sample-point process like the built-ins of Mathematica?

Consider this: pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}, {4, -2}, {5, 1}}; f = BSplineFunction[pts] I can use ParametricPlot to ...
48
votes
1answer
2k views

How to construct a treemap using non-rectangles?

I've written the standard version of a tree map (a graphic that shows nested data) and I'm looking to improve on this layout by switching to different types of polygons or perhaps circles. Can anyone ...
7
votes
1answer
194 views

Is there a way to characterize a winding object in an image?

I have produced this image by applying a Gaussian image substraction, Binarize, Colornegate, and ...
26
votes
2answers
2k views

How can I create a glass distortion effect in an image?

I'd like to overlay a glass jar onto an image with realistic light bending. Can anyone think of a way to automate this effect? Perhaps this can be done with the raytracing package Rayica / Optica? ...
2
votes
3answers
164 views

Given a list of triangle vertices, how to find the neighbors for each vertex?

A triangle is represented by {a,b,c}, indicting that its vertex IDs are a, b, and ...
6
votes
1answer
171 views

How to do automatic differentiation?

Does Mathematica have any AD functionality or does it only support symbolic differentiation? If not, are there any packages or other third party implementations available? Edit (J. M.) Here is an ...