# 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

51 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
425 views

### Hopcroft's Algorithm for Minimization of Deterministic Finite State Automaton

Background Given a deterministic finite state automaton, Hopcroft's algorithm is a $O(n \log(n))$ algorithm for finding an automaton that generates the same language with a minimal number of vertices....
1k views

### How to find the a minimum cost perfect matching

Crossposted on Wolfram Community A a minimum cost perfect matching is very useful tool.This three links about this demand just related me,let alone all MMA.SE. How to get some pairing with smallest ...
337 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 ...
354 views

### Problem with the accuracy of the real-coded Genetic algorithm

Since there is no Genetic algorithm implemented in the Mathematica i tried to write a very simple genetic algorithm myself. The accuracy of the results depend upon rounding up the obtained parameters. ...
251 views

### Finding all Minimal Cut Sets for Site Percolation?

Bug introduced in 9.0 and persisting through 11.3.0 FindVertexCut and FindMinimumCut are new in 9.0. I want to disconnect the ...
1k 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 ...
203 views

### Approximate Nearest Neighbors in Mathematica?

Is there any support for Approximate Nearest Neighbors (ANN) in Mathematica or third-party packages? I'm looking for a good implementation of locality sensitive hashing for applications where ...
324 views

### How to achieve with Mathematica the effect a closure has in other languages?

Motivation I want to write an auxiliary function (brief auxf) for testing the output of another function that evaluates its body repeatedly using ...
103 views

### Mathematica algorithms made possible with Wolfram's NKS?

In Wolfram's NKS he mentions that the Rule-30 Cellular Automata is used as a random number generator in Mathematica. What other algorithms in Mathematica have been made possible with Wolfram's NKS?
142 views

### Converting a Recursive algorithm to Iterative?

I have a recursive algorithm and I want to make it iterative I found this command RecurrenceTable[eqns, expr, {n, n_max]}] but I don't know how I make my recurrence relation because there is ...
221 views

### How to compute the longest non-contiguous common sequence?

LongestCommonSequence[] works well, but what about finding the longest common sub-sequence (not necessarily contiguous)? Is this function built in to the genome ...
936 views

### Solving recursion relations using Mathematica

I want to solve the recursion relation given in equation 2.7(a/b) on page $6$ of this paper. (..the initial seed is $F_1 = G_1 = 1$ and the functions $\alpha$ and $\beta$ are defined on page $5$ in ...
101 views

### Implement of faster(maybe paralleled) K-Means clustering

I am writing an algorithm that needs to add noise to the centroid of each iteration on top of KMeans. Therefore, I need to implement a custom KMeans function. I checked out the methods in Mathematica ...
30 views

### When displayed in a 1000 x 1000 window, why would a 1000 x 1000 image look more pixelated than a 500 x 500 image?

Yes, you read that correctly. I am especially concerned about the white pixels bordering the black curves. As you see, I have increased the line width 2-fold in the higher resolution image. This ...
80 views

### How to show recursive computation graphically?

I am studying the book "Computer Science with Mathematica" from R. Maeder. The following piece of code solves the Knapsack Problem recursively: ...
43 views

### How algebraic (or more general) expression is represented (memory level, data structure) in Mathematica?

This is not a question about the usage of Mathematica, it is more about implementation. Mathematica is a very huge system, it can provide a series of very advanced operation against a Mathematica ...
136 views

### Combinatorics with booleans equations

I have variables $X_i \in \{1,0,-1\}$. Now I add up $m=3$ variables $$S=X_1 + X_2 + X_3$$ and want to find all combinations that give me, $S=1$. I can do this with (see this solution): ...
48 views

### How to iterate over Orbit of PermutationGroup?

Another day, another permutation group question. I'm given a g=PermutationGroup[...], and a list l={1, 3, 3, 2, ...}. I know I ...
59 views

### Dean's apportionment

I would like to program Dean's apportionment. https://www.maa.org/press/periodicals/convergence/apportioning-representatives-in-the-united-states-congress-deans-method-of-apportionment Here is my ...
316 views

### Integration of graphs with datasets

Mathematica has a rich family of graph algorithms. I would like to leverage some of these for a very large tree structure. Because of the size of the structure, I would like to store it in a Dataset ...
293 views

### AVL binary search tree implementation

Is there any text-book implementation of self-balancing binary search trees such as AVL or red-black in Mathematica?
205 views

### Implementation of Lubaehevsky-Stillinger Algorithm to pack hard spheres

To generate a model of a polycrystalline material with specified grain size distribution (e.g coming from a Monte Carlo Grain Growth simulation) the Paper "Effects of grain size distribution and ...
253 views

### What's a non-trivial Mathematica program involving conscious choice of stack vs. queue data structure?

In a typical computer science algorithms course, much attention is given to the discussion of queues vs. stacks as a data structure programmers need to consciously choose from to achieve algorithmic ...
314 views

### Fast calculation of commute distances on large graphs (i.e. fast computation of the pseudo-inverse of a large Laplacian / Kirchhoff matrix)

I have a large, locally connected and undirected graph $G$ with $\approx 10^4$ vertices and $\approx 10^5$ to $\approx 10^6$ edges. Moreover I can bound the maximum vertex degree as $Q_{max}$. I ...
1 vote
77 views

### Shortest paths Knights Tour

I am trying to print the minimum steps needed to traverse a chessboard as a knight from one diagonal position to the other. I have the following code: Building the chessboard I started with creating ...
1 vote
64 views

### “Largest” symbolic common factor of an integer sequence (not simply GCD)

Suppose, I have a finite fragment of a quickly increasing sequence of integers $\{a_n\}$ that is too complex, unusual, or irregular for FindSequenceFunction to find ...
1 vote
59 views

### trouble implementing a simple algorithm for solving the DLP

I have some trouble implementing a simple algorithm for solving the DLP in F_p^* using Mathematica. The algoritm should look as follow: ...
1 vote
61 views

### Optimal code generation for evaluation of a fixed set of multivariate rational polynomials

Given a set of multivariate rational polynomials, is it possible to find the optimal (shortest or least expensive in some other sense) sequence of arithmetical operations, such that it results in ...
1 vote
98 views

### How to use Mathematica to find the coordinates of 7 points?

Could anyone please help me with using Mathematica to find the coordinates of 7 equally spaced points on the unit sphere $S^3$ in $\mathbb{R}^4$? Thanks a lot!
1 vote
70 views

### Finding same output values by varying input values of function

I have written a function in Mathematica that needs five input variables. The function outputs a single real number. The underlying model is a complex model for option pricing. To ease things up, let ...
1 vote
295 views

### Make Person Curve from a Picture

I recently read this; http://blog.wolfram.com/2013/05/17/making-formulas-for-everything-from-pi-to-the-pink-panther-to-sir-isaac-newton/ In this post, newton curve is made by using the image "...
1 vote
314 views

### Solving a rod cutting problem with recursion

I'm trying to use Mathematica 10.0. to solve a rod cutting problem with naive recursion. The problem is taken from Introduction to Algorithm, 3rd edition. The length price for rod is defined in the ...
1 vote
88 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 ...
1 vote
52 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.
46 views

21 views

### AsymptoticLess function confusion

I have an algorithm which complexity is: ...
53 views

### How to exclude some methods?

Can I exclude one or several methods from methods tried by a function? When we use some 'algorithm-intensive' function, we can often specify whether we want to proceed according to the chosen method ...
94 views

### What method Mathematica uses to solve a quadratic system

I'am writing a paper and I need to know what method Mathematica uses to solve a quadratic system by default. This is my system: ...
169 views

### Algorithm that will trim a unique ID number and produce a shorter unique ID

I have a unique ID number with 2^128 magnitude length (128 bits). This means ~3.4e+38 which is quite large that my actually needs, spending valuable time in a transmission protocol. There is a ...