Skip to main content

Questions tagged [algorithm]

Questions about algorithms used or which might be used to implement a procedure known by name or loosely but not in detail. The subject of the question may be a procedure mentioned in the literature or a Mathematica built-in function

Filter by
Sorted by
Tagged with
93 votes
4 answers
57k views

Wolfram|Alpha has a whole collection¹ of parametric curves that create images of famous people. To see them, enter WolframAlpha["person curve"] into a Mathematica ...
Simon's user avatar
  • 10.3k
36 votes
6 answers
8k views

Suppose we have a sorted list of values. Let's use list = Sort@RandomReal[1, 1000000]; for this example. I need a fast function ...
Szabolcs's user avatar
  • 239k
29 votes
8 answers
2k views

I am looking into splitting words into a succession of chemical elements symbols, where possible. For example: Titanic = Ti Ta Ni C (titanium, tantalum, nickel, carbon) A word may or may not be ...
F'x's user avatar
  • 10.9k
55 votes
2 answers
4k views

EDIT: Although I have posted an answer based on my current progress, this in incomplete. Please see the "open issues" section in the answer. Most plotting functions in Mathematica adjust the sampling ...
Szabolcs's user avatar
  • 239k
26 votes
2 answers
3k views

I'm trying to implement a Brillouin Zone algorithm within Mathematica, including the generation of Brillouin zones of higher order in 2D and 3D. There is a nice implementation of generating these ...
Rainer's user avatar
  • 2,961
20 votes
5 answers
4k views

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 ...
xyz's user avatar
  • 685
18 votes
2 answers
4k views

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. Wikipedia ...
Kuba's user avatar
  • 139k
30 votes
3 answers
13k views

Consider a set of trajectories in 3D space, that possibly converge. By visualizing trajectories as arrows the result will look crowded as each arrowhead will be placed where the attractor is. In 2D, ...
István Zachar's user avatar
13 votes
5 answers
7k views

In engineering problems, I am always seeing many recursion formula. For instance, In the book "The NURBS book", I discovered many recursion formula Fibonacci $$f(n+...
xyz's user avatar
  • 685
42 votes
4 answers
6k views

I would like to examine percolation on a random lattice. To be exact, I wish to find the minimum length of a 'bond' needed such that the leftmost site can be connected to the rightmost site. Here is ...
BeauGeste's user avatar
  • 2,907
39 votes
4 answers
3k views

Consider this: pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}, {4, -2}, {5, 1}}; f = BSplineFunction[pts] I can use ParametricPlot to ...
xyz's user avatar
  • 685
33 votes
3 answers
2k views

MATLAB offers a function polyeig for computing polynomial eigenvalues, which appear, for instance, in quadratic eigenvalue problems (see here for some applications) ...
Gabriel Landi's user avatar
12 votes
2 answers
1k views

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 ...
M.Y.'s user avatar
  • 175
20 votes
1 answer
802 views

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: ...
ubpdqn's user avatar
  • 67.8k
10 votes
3 answers
750 views

I need a faster implementation of FractionOfYear and FractionOfMonth, which do the following: Input: A time/date specified by <...
M.R.'s user avatar
  • 31.9k
80 votes
4 answers
16k views

Update Submitted answers here are tour de force, and very educational comp-sci-wise, -- thanks folks! Tech is developing though, and here is the current implementation in the Wolfram Language. Please ...
Vitaliy Kaurov's user avatar
25 votes
4 answers
2k views

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 ...
Victor K.'s user avatar
  • 5,326
23 votes
11 answers
4k views

I have a pair of ordered lists. I want to generate a new ordered list (using the same ordering) of length n by applying a binary operator to pairs of elements, one from each list, along with the index ...
TheDoctor's user avatar
  • 2,948
22 votes
1 answer
3k views

I'm trying to digitize some documents, and I came across a very cool app called camscanner app which performs parallax transform and ocr very nicely, now I'm implementing it in mathematica... Given a ...
M.R.'s user avatar
  • 31.9k
18 votes
7 answers
3k views

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 ...
tavr's user avatar
  • 181
15 votes
2 answers
1k views

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, right, ...
yode's user avatar
  • 27.8k
15 votes
2 answers
3k views

I have the edge list of an undirected graph which consists of disjoint "cycles" only. Example: {{1, 2}, {2, 3}, {3, 4}, {4, 1}, {5, 6}, {6, 7}, {7, 5}} Each ...
Szabolcs's user avatar
  • 239k
14 votes
4 answers
5k views

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 ...
Jimeree's user avatar
  • 549
0 votes
3 answers
394 views

I have the equation $u^{\prime\prime}(t)+u^{2}(t)-t^{4}-2=0$ such that $0\leq t\leq 1$and also I have $u(0)=0$ as well as $u(1)=1$. Noe the exact solution of the equation is $u(t)=t^{2}$. Now I ...
Junaid's user avatar
  • 161
30 votes
7 answers
1k views

Triangular recursions are a class of algorithms that frequently turn up in computational mathematics. These recursions are expressible in the general form $$T_k^{(n)}=f(T_{k-1}^{(n)},T_{k-1}^{(n+1)})$...
J. M.'s missing motivation's user avatar
30 votes
2 answers
4k views

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 ...
M.R.'s user avatar
  • 31.9k
23 votes
1 answer
811 views

Does anyone know, or know of a link for the underlying algorithms used for list manipulation functions? Specifically: Union with and without the ...
Jonie's user avatar
  • 1,199
21 votes
3 answers
2k views

I honestly have no idea where to begin with this problem. In summary, I have a 2D coarse grid with an intersecting line. For an easy example, let's assume it's a 4x4 grid. I wish to pass through each ...
kale's user avatar
  • 11.1k
17 votes
2 answers
1k views

Searching the web for information about the affine transformation, I found the one page, which called my attention for the tree that show and is this but unfortunately do not give information about ...
bullitohappy's user avatar
  • 1,309
14 votes
5 answers
3k views

Suppose I have a List of the form: lst={"(", "(", "(", ")", "(", ")", ")", ")"} By running ...
a06e's user avatar
  • 11.7k
6 votes
2 answers
715 views

I want to find all minimal site percolation paths from the left side to the right side, small demo grid. A related question is here on finding bond percolation paths instead of minimal site ...
hhh's user avatar
  • 2,663
5 votes
5 answers
2k views

I'm starting in Wolfram Mathematica. I saw that MinimumVertexColoring [g] could be used to calculate the chromatic number of a graph, but ...
David Betancourt M.'s user avatar
2 votes
3 answers
250 views

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 $...
SnowTrace's user avatar
  • 149
48 votes
1 answer
2k views

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 ...
M.R.'s user avatar
  • 31.9k
29 votes
5 answers
4k views

Is anyone aware of Mathematica use/implementation of Random Forest algorithm?
blackace's user avatar
  • 415
21 votes
4 answers
1k views

About 9 years ago, I came across this interesting website, and found the following paragraph with a broken Mathematica code sample: When fluid passes an object, it can leave a trail of vortices called ...
xzczd's user avatar
  • 71.6k
20 votes
2 answers
1k views

I am trying to quickly calculate the intersection of polygons with more than 6,000 points. A compiled solution would be preferable. Here is one example of the problem: ...
Tom Wellington's user avatar
18 votes
4 answers
4k views

The ComputationalGeometry package has a DelaunayTriangulation[] function. It returns a list of points connected to each point, ...
Szabolcs's user avatar
  • 239k
18 votes
2 answers
1k views

I'm trying to compute the chromatic number of this graph (which is 28): g = Import@"http://www.info.univ-angers.fr/pub/porumbel/graphs/dsjc250.5.col"; My genetic ...
M.R.'s user avatar
  • 31.9k
16 votes
3 answers
574 views

Description Based on recent assignment at work, I have become interested in computational geometry. So, I am trying to implement a visibility polygon as to explore some fundamental concepts and ideas....
e.doroskevic's user avatar
  • 6,007
16 votes
1 answer
2k views

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 ("...
a06e's user avatar
  • 11.7k
15 votes
3 answers
921 views

Given the following data: constraints = {{11, 2}, {11, 3}, {11, 4}, {11, 6}, {11, 9}, {1, 6}, {5, 6}, {2, 5}}; weights = {3, 7, 3, 2, 4, 2, 2, 2, 3, 2, 1}; I ...
Simon Woods's user avatar
  • 85.9k
14 votes
9 answers
1k views

I have f.e. the following square matrix: ...
eldo's user avatar
  • 84.7k
10 votes
3 answers
783 views

My question departs from this one: Find intersection of pairs of straight lines but now I want to find the points with the new V10 Region-functions. ...
eldo's user avatar
  • 84.7k
10 votes
2 answers
470 views

Consider the data set corresponding to recorded trajectories for a particle: ...
Sparse Pine's user avatar
  • 1,133
8 votes
4 answers
4k views

In my "Numerical Analysis" course, I learned the Romberg Algorithm to numerically calculate the integral. The Romberg Algorithm as shown below: $$T_{2n}(f)+\frac{1}{4^1-1}[T_{2n}(f)-T_{n}(f)]=S_n(...
xyz's user avatar
  • 685
8 votes
2 answers
497 views

A list like l = {0, 1, 2, 3, 4, 5, 7, 9, 12, 13, 18, 19} may have subsequences of constant increase, $a_{n+1} = a_n + k$. For example: ...
sjdh's user avatar
  • 7,917
7 votes
2 answers
536 views

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$ ...
PinoAir's user avatar
  • 221
5 votes
1 answer
626 views

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 ...
wuchang's user avatar
  • 151
5 votes
1 answer
254 views

Suppose I had about 500 .JPG and .jpg files in my folder "c:\images\". How to ask ...
Putterboy's user avatar
  • 4,735