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

learn more… | top users | synonyms

16
votes
4answers
691 views

Detecting patterns of black and white stones on a 2D board

I'm writing a program to play a game of Pente, and I'm struggling with the following question: What's the best way to detect patterns on a two-dimensional board? For example, in Pente a pair of ...
0
votes
1answer
59 views

How write this Function with many arguments? [duplicate]

F[x1_,x2_,...,x99_]:=expr How to write this Function in mathematica whithout complete write it?
1
vote
0answers
42 views

How to determine three last bindings made to a variable when evaluating an expression?

How can I create a list of bindings made to a certain variable when evaluating an expression? I want to determine three bindings made.
1
vote
2answers
365 views

Faster way to test if an expression equals zero

I want to test if expressions (mix of variables, functions and numbers) are zero valued, as fast as possible, and PossibleZeroQ is sometimes very slow. One solution ...
2
votes
1answer
60 views

Generating the set of all strings within a fixed edit distance of a initial string?

Provided a starting string initialString, and a particular alphabet of allowed characters {"A","B","C","D","E",...}, how can I ...
-4
votes
0answers
37 views

How to use babylon translator in mathematica help? [on hold]

I have mathematica 9 in window seven ,and using babylon 10,but babylon can't read (scanning) words from help of mathematica. Please help me to solution this problem.
-1
votes
0answers
47 views

Solving nonlinear system by newton method [closed]

How to solve nonlinear system by newton method (without Findroot method)? What is algorithm?
5
votes
2answers
255 views

Pruning elements in an array based on the existence of similar elements in adjacent arrays

Imagine I have a series of particles floating around in $\mathrm{R}^3$, where, at any given time, particles can pop into and out of existence. Here, for some number of time points, $(t_1, \dots, ...
4
votes
1answer
134 views

Bresenham's line algorithm

Bresenham's line algorithm is producing discretized line for given two points for purpose of plotting for example. Like that: I have to stress that I'm interested in positions, not a plot. ...
3
votes
0answers
57 views

Challenge: Speeding up MaxDetect for application in 3D blob detection

In image segmentation it is a common problem that objects appear clustered and are therefore undistinguishable from each other when using simple algorithms. Based on this post I obtained efficient ...
0
votes
0answers
50 views

how to write my own interpolation method

I was comparing results of spline interpolation in Mathematica and C++/gsl-library Results of interpolation are different if I use: ...
0
votes
1answer
47 views

Implementation of a Hanning filter

I'm implementing a package for in-house signal processing. I wrote here a quite trivial function implementing a Hanning windowing of the signal. ...
3
votes
0answers
138 views

A* algorithm for finding shortest path in a graph

FindShortestPath finds the shortest path between two vertices in an edge-weighted graph, allowing a choice between the Dijkstra and Bellman-Ford algorithms. In my (limited) understanding, both of ...
6
votes
2answers
84 views

Algorithm in RandomChoice[{w1,w2,…}->{e1,e2,…},n]?

I wonder if someone happens to know the actual algorithm implemented in the particular overload of RandomChoice that handles explicitly presented discrete ...
7
votes
1answer
745 views

Efficient backtracking with Mathematica

Backtracking is a general algorithm for finding all (or some) solutions to some computational problem, that incrementally builds candidates to the solutions, and abandons each partial candidate c ...
0
votes
1answer
106 views

Generate encoding from nested list

Taking reference of Huffman code algorithm, ...
6
votes
2answers
140 views

Generated Numbers under a constraint?

Let's say I have five four dimensional vectors $p_i^\mu=(p_i^1,p_i^2,p_i^3,p_i^4)$ with $i=1,2,3,4,5$. Now, I want to fill the entries of these vectors ($4\cdot5=20$ in total) with some numbers, but ...
4
votes
3answers
235 views

Creating a function with integral zeroes of the 0th, 1st, and 2nd derivatives

I would like to be able to randomly generate functions, each of which satisfies $f : [-10, 10] \rightarrow [-10, 10]$ All the zeroes, critical points, and inflection points have an integral ...
3
votes
3answers
169 views

Fastest way to check if an expression contains all symbols from a list

I need to execute this function thousands of times, and the faster, the better. I came up with two versions, but wanted to see if you can come up with an even faster way. Is there a better way? I use ...
0
votes
0answers
40 views

Write nth line to file [duplicate]

I have a code that I am running on a supercomputer. Currently the algorithm must finish before I can export any results from the algorithm. What I would like to do is to have the algorithm write out ...
15
votes
3answers
1k views

How to get actual triangles from DelaunayTriangulation[]?

The ComputationalGeometry package has a DelaunayTriangulation[] function. It returns a list of points connected to each point, ...
5
votes
4answers
354 views

Check if a matrix is Positive Semidefinite

I have a question concerning the check whether a given matrix is positive semidefinite or not. In mathematica the function PositiveDefiniteMatrixQ[m] tells me ...
3
votes
1answer
214 views

What is the underlying algorithm for GroupElementToWord?

What algorithm is Mathematica 9 using for GroupElementToWord[group, g]?
0
votes
1answer
111 views

Returning lists of pixels connected through their Moore neighborhoods

I have a binarized image in Mathematica 9, and I would like to generate a list of coordinates for clusters of pixels connected through their Moore neighborhoods, e.g. ...
3
votes
1answer
195 views

Specific Mathematica algorithms, for example LU Decomposition

Where I can find detailed information on algorithms used by Mathematica, especially for numerical methods. The Manual doesn't seem to iclude specifics in most cases. For example I get a different LU ...
3
votes
2answers
123 views

Checking whether a number can be composed from the cube of its digit

How to check whether or not the sum of the cube of each digit of a number is equal to the number itself? In the following code, I tried to return the number in question whenever it matches the ...
2
votes
2answers
193 views

Is there a way to parallelize the convolution component of EdgeDetect?

Provided an image like - test = Import["http://upload.wikimedia.org/wikipedia/commons/d/d5/Sunflowers.jpg"] We can run ...
3
votes
0answers
110 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 ...
49
votes
3answers
4k 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
188 views

What algorithm and tools should I use to search a data set for the point nearest to a given point?

I have about 1,000,000,000 points, which are the longitudes and latitudes of some places in a city, formatted like this: $(106.1231233,41.43234234)$. I also have about 20,000 points which are the ...
13
votes
2answers
680 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 ...
2
votes
2answers
163 views

Write 199319989756262759279209 = 5x + y, where x and y are integers

$\frac{199319989756262759279209}{5} $ = $ 3.9864\times 10^{22}$ according to Mathematica, but I would like to see this number exactly in decimal form (not in scientific notation). I'm attempting to ...
2
votes
2answers
204 views

How does Accumulate work?

Accumulate can be used to compute the partial sums of a list. The partial sums can also be computed using a For loop but this ...
20
votes
2answers
809 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 ...
16
votes
1answer
377 views

Simulating Theatre puzzle

I have been trying to simulate the process of the theatre puzzle from the Joy of X (Strogatz). The puzzle, and some relevant material are here. My simplistic coding for this process follows: ...
5
votes
2answers
184 views
13
votes
3answers
586 views

Generate a Random Polygon

Does some package exist with a function that takes a parameter $n$ and generates a random 2D $n$-sided simple polygon (convex or non-convex), possibly within a certain bounding box? It does not ...
1
vote
4answers
196 views

Calculating the median difference between elements with a (particular pair) of consecutive integer indices residing in the same sublist

NOTE: I formally made a serious mistake in the first example provided. pointLists[[1]] had an extra element, and we should have a guarantee that ...
5
votes
1answer
147 views

Behavior of Graphics`Mesh`InPolygonQ with self-intersecting polygons

Playing around with some of the answers in the question How to check if a 2D point is in a polygon? I noticed that: Graphics`Mesh`InPolygonQ[poly,pt] Displays ...
6
votes
5answers
277 views

A fast way to calculate the median difference between pairs of elements

I have a list of coordinate pairs, take for example the following list of three pairs: ...
6
votes
1answer
220 views

Implementing an algorithm for finding the largest circle that contains a single point in a set (and no other point)

This question concerns the implementation of an algorithm proposed by Rahul Narain on a former question of mine that was migrated to math.stackexchange: ...
15
votes
3answers
495 views
1
vote
1answer
150 views

Efficiently determining if a morphological component overlaps a polygon with vertices at real number coordinates

I have a list of morphological components $m$, a set of vertices for a polytope $P$ (at real number coordinates), and I'd like to be able to calculate a list of morphological components $m'$ that ...
4
votes
3answers
160 views

Computing the mean difference between elements in a list with index $i$ and the closest elements with index $(i+1)$

I have a list that looks like this: preprocessedList = {{1,5.3},{1,5.566},{1,1.4322},{2,3.443543},{2,3.444},{3,0.1223},{4,1.3243},{4,1.554343}} Each element in ...
12
votes
4answers
903 views

Finding elementary cycles of (directed) graphs

I need to enumerate all the simple cycles (i.e. elementary cycles where no vertex is repeated other than the starting) of a graph which has both directed and undirected edges, where we can treat the ...
17
votes
1answer
308 views

Underlying Algorithms for List Manipulation Functions

Does anyone know, or know of a link for the underlying algorithms used for list manipulation functions? Specifically: Union with and without the ...
0
votes
0answers
22 views

Pruning a list of points to find the largest clique of points with a minimum threshold point-to-point Euclidean distance [duplicate]

I have a array of points (which we'll just create randomly here): pointList = Table[{RandomReal[{0, 5}], RandomReal[{0, 5}]}, {i, 1, 100}]; I'd like to find the ...
9
votes
2answers
196 views

Partitioning a superset of coordinates into subsets that generate continuous curves

Consider the data set corresponding to recorded trajectories for a particle: ...
2
votes
3answers
94 views

Reversibly merging sets of $k$ adjacent elements in an array

Say I have an array of the form: ExampleArray = {{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}}; I'd like to be able to reversibly merge sets of ...