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
0
votes
1answer
40 views

Algorithm to switch from one to two gaussian fit

I have a big dataset that I have to fit with one or two gaussians. This dataset represents the evolution of a population in two different population as a function of time. That means that at same ...
2
votes
1answer
173 views

On the numerical roots of transcendent functions

Writing: ...
3
votes
3answers
254 views

Finding all Latin Squares of order 5

A Latin Square is a square of size n × n containing numbers 1 to n inclusive. Each number occurs once in each row and column. An example of a 3 × 3 Latin Square is: $$ \left( \begin{array}{ccc} 1 &...
1
vote
1answer
52 views

How to make a for loop to automatically make a series of m differential equations?

I'm trying to construct a series of differential equations that defines the behavior of m mutually interacting species according to the Lotka-Volterra equations. I figure there must be some clever ...
0
votes
1answer
113 views

Lanczos algorithm [closed]

How can I implement this method ,,Lanczos algorithm " through Mathematica? This method solves eigenvalues and eigenvectors of a symmetric matrix.
6
votes
0answers
152 views

CORDIC - Volder's algorithm

As the title suggests, the object of this topic is the CORDIC algorithm (COordinate Rotation DIgital Computer). Although it's now obsolete in most cases, I think it can be interesting to understand ...
0
votes
0answers
47 views

How can I improve on Image3D to produce higher resolution and better colors?

Most of the pixels in this image are black, but Image3D displays them as transparent. That's actually good for my application, but it is unexpected without an alpha channel. The main problem is ...
5
votes
1answer
102 views

Check if polynomial is in factored form, without factoring

I have a large list list of integer polynomials, all of which are the output of Factor. So my list looks something like this: <...
2
votes
0answers
26 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 ...
5
votes
3answers
400 views

Is there a cyclic list manipulate function? [closed]

I can't seem to find a function that will input x and output y. For my application, each of the numbers 1,2,3,4 represent a list, and the matrix is much larger. ...
3
votes
1answer
46 views

Search through a symmetric matrix

I am trying to implement the following algorithm into a Mathematica code but I am unsure how to proceed. Let $M$ be a 4x4 symmetric matrix, for example $$M=\begin{pmatrix} 1&1&0&1 \\ 1&...
3
votes
3answers
248 views

Find all spanning tree in a given graph

Is there a way I can generate all the spanning tree in the following graph: Also, is there a way to insert the adjacency matrix, then I get an output of all possible spanning trees? The adjacency ...
1
vote
0answers
57 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: ...
3
votes
1answer
140 views

Code for a color bucket fill (seed fill) of a bounded irregular area?

In images like the one shown here, I would like to be able to pick an x,y coordinate and fill the bounded interior with a specified color. That functionality is well known in PhotoShop and GIMP, but ...
0
votes
0answers
47 views

Fortune's Algorithm (Conditional Step Size in `Manipulate`)

I am trying to implement Fortune's Algorithm. Here is my code so far. ...
2
votes
0answers
75 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: ...
0
votes
0answers
30 views

Recursive algorithm taking too long

I'm trying to determine the impulse response of a digital filter using the differences equation. However Mathematica is not being able to compute this easily taking way too long. For what I read this ...
8
votes
2answers
223 views

Generate random lines that don't be too crowded between the intersections

It's easy to generate random lines, such as this ...
0
votes
0answers
78 views

What's going on in this Newton-Raphson algorithm?

I'm looking at this post, over on Mathematics SE. I'll summarize here: A signal with a known velocity, c is emitted by some source. We're given the coordinates of ...
0
votes
0answers
27 views

Diagonalization of Hermitian Matrices vs Unitary matrices

What are the differences involved in diagonalization of large Hermitian matrices and Unitary matrices? (>5000 x 5000) Mathematica seems to diagonalize Hermitian matrices almost 20 times as fast as ...
0
votes
0answers
61 views

Trying to implement an algorithm to solve a self-consistent Bloch-Schrodinger Equation

I am trying to understand and to implement an algorithm described by Kunimi-Kato in their supplementary material to solve the self-consistent equation below $$ \left[\frac{\hbar^{2}}{2m}|\boldsymbol{G}...
1
vote
1answer
105 views

How do I decrypt message with RSA algorithm with modulus n = 302446877 and encryption key e 677?

Message: 196512625 25825210 250970710 140420423 22130212 288711674 26343056 Plaintext is grouped in blocks of 4 letters. What I have so far =( ...
5
votes
2answers
126 views

Modify each element depending on previous elements

I'm looking to see if there's a more idiomatic/concise/neat solution than what I have for this. I have a list of boxes with heights and I want to stack them; that is, add to each box the distance to ...
1
vote
2answers
129 views

How to write more simple variable-step Runge Kutta algorithm to solve this differential equation?

Here is a case of Runge Kutta algorithm with variable-step size: ...
1
vote
1answer
100 views

Intuitive visual illustration of wrapping percolation criterion

Context: When studying percolation in finite sized systems, there exist various definitions and criteria for determining when a given system is percolating, i.e. it contains a spanning connected ...
9
votes
1answer
381 views

Help to create a 2D mesh generator (FEM)

I'm working in a finite element mesh generator. I built this function which generates an 8 node mesh (polynomials of order 2) without any interior node: ...
2
votes
0answers
36 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 ...
8
votes
1answer
242 views

Fast method to calculating signature of a matrix

For calculation of the topological properties of a hamiltonian, sometimes we need the signature of that matrix. This means we only need number of positive eigenvalues. One simple way is to first ...
1
vote
0answers
56 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 ...
0
votes
0answers
43 views

Nested for loop with variable length

I am new to mathematica and I want to create the set of all n-tuples whose sum is less than a fixed number $N$. My idea would be to do a for loop where I choose first number $k_1$ in between 0 and N, ...
6
votes
4answers
227 views

Faster way to find longest chain of inequalities

I have a list of algebraic expression, all variables are positive, some of them have a specific size relationship. Such as: $\frac{(a b+a c+b c)^2}{a+b+c}\leq \frac{1}{3} (a+b+c) (a b+a c+b c)\leq \...
1
vote
0answers
96 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
1answer
248 views

Search for squares

Could anyone please help me find $a\left(x,y,z\right)$, $b_{i}\left(x,y,x\right),$$c_{i}\left(x,y,z\right)$ and $d\left(x,y,z\right)$ that are sums of squares of polynomials or rational functions such ...
0
votes
1answer
50 views

All positive integer points up to a certain distance from a hyperplane

I have the hyperplane $\sum_{i=1}^{d} x_i c_i = z$ for $x \in \mathbb{R}^d$, defined by the vector of postivive numerical coefficients $c_i \in \mathbb{R}, c_i > 0$, and the value $z > 0$. I ...
1
vote
0answers
104 views

How to write Horner's Algorithm in Mathematica? [closed]

The pseudocode we were given is: Right now I have: ...
1
vote
1answer
162 views

Writing code to produce continued fractions

I have been trying to create a continuing fraction to help prove the theory about any rational number: a/b being able to be written as a continued fraction where the remainders found in the Euclidean ...
2
votes
1answer
193 views

Extended Euclidean Algorithm

I am trying to program the Extended Euclidean Algorithm. Earlier I made some progress past simply generating garbage data. I am supposed to yield two constants s & t that would help compute the ...
3
votes
1answer
77 views

How to access all instances of a defined function

This should have a simple solution, but for some reason I cannot find how to do this. Let's say I have a "function" where I have defined values (in my actual example I have many instances of this, ...
3
votes
1answer
147 views

Efficiently computing current flow betweenness centrality for graphs

Definitions: Given a graph $G=(V,E),$ the current flow betweenness is a node-wise measure that captures the fraction of current through a given node with a unit source (s) sink (t) supply $b_{st}$ (1 ...
4
votes
1answer
112 views

Langton's ant algorithm using AnglePath

I would like to implement Langton's ant algorithm using AnglePath. I know there are some MMA implementation on the internet but I would like to implement it myself. Here is definition of algorithm: ...
1
vote
2answers
70 views

Mistake in recursive algorithm

I am new to Wolfram, and I am trying to make a recursive Archimedes algorithm in Wolfram. I read documentation and I tried to run this code ...
0
votes
0answers
20 views

AsymptoticLess function confusion

I have an algorithm which complexity is: ...
2
votes
0answers
133 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): ...
4
votes
0answers
96 views

Steiner Tree Approximation

I am wondering about the existence of Mathematica code to find (approximate) Steiner trees in graphs. I know there are a number of algorithms to do so --- just curious if anyone has implemented any ...
3
votes
1answer
88 views

Sorting a list into “all possible ways” - sorting with incomplete information

Familiar example of sorting objects I have a list of $n$ "vectors" $\{x^{(1)},...,x^{(n)}\}$ of form $ x^{(i)}=\sum_{j=1}^m c_j^{(i)}x_j,i=1\dots n$, where $c_j^{(i)}$ are nonnegative ...
6
votes
0answers
105 views

Mathematica's algorithm for FindIndependentEdgeSet? [closed]

Documentation does not mention about algorithm. My guess is Blossom algorithm because I do not know of any better one. Posting it with hope that someone might know it for sure.
2
votes
1answer
74 views

Creating pairs of non-intersecting set from a given set

Let's say I have a set {a,b,c,d} and I want to create a list of pairs {{a,b,c,d},{}},{{a,b,c},{d}},{{a,b,c},{}},... such that there is no intersection between each pair, and they do not need to use ...
1
vote
0answers
52 views

How does Mathematica find the process parameter? [closed]

I want to know what kind of algorithm is used by Mathematica's Estimated Process. For example, we can estimate the parameter as follows: ...

1
2 3 4 5
7