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
2
votes
3answers
116 views

Path finding in Complete Graph [closed]

I have the following Complete Graph with random labels on its edges ...
1
vote
0answers
59 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 ...
3
votes
1answer
110 views

Is it possible to improve a code related with iterative closest point (ICP) algorithm?

I am trying to write a code related with ICP algorithm. The purpose of the code is matching a target data with a reference data by translational operation in XYZ axes (3-degree-of-freedom (DOF) ...
1
vote
0answers
142 views

How to Create an Efficient Word Square Algorithm?

I am working on the Wolfram Challenge Babbage Squares. I have looked at the following resources in order to come up with an idea for how to find all the possible word squares: Word Squares and Beyond ...
0
votes
0answers
34 views

How to optimize Code for Wolfram Challenges?

I am wondering if anyone who has knowledge of optimizing programs in the Wolfram language has any advice on how to optimize the following quantities of programs written to solve Wolfram Challenges. I ...
0
votes
0answers
47 views

Numerical minimization of function

So I have the following equation: 3 Sqrt[9.15753*10^-6 + 25.1556 TolC^2 + 25.1556 TolL^2]==1; Now TolC and TolL can take respectively the values of these lists: <...
4
votes
2answers
151 views

How does Fourier work with arbitrary FourierParameters?

Mathematica's Fourier function allows you to insert an arbitrary real number in the exponent of the discrete Fourier transform, via ...
3
votes
2answers
327 views

Polygon Diameter

I want to calculate the diameter of a convex polygon. That is, the largest distance between any pair of vertices. Here's my approach ...
4
votes
1answer
196 views

How to make a graphic for Sieve of Eratosthenes with a legend

Definition The Sieve of Eratosthenes is a simple algorithm to find the primes before a given $n$. Starting from $n=2$ you delete all multiples of 2, and keep incrementing till all that are left are ...
0
votes
1answer
106 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 ...
3
votes
1answer
211 views

On the numerical roots of transcendent functions

Writing: ...
3
votes
3answers
308 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 &...
2
votes
2answers
77 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 ...
-1
votes
1answer
178 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
187 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
108 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
28 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
403 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
50 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
393 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
58 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
155 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
51 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
77 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: ...
8
votes
2answers
267 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
101 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 ...
2
votes
1answer
122 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
132 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
179 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: ...
3
votes
1answer
167 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
452 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
42 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
272 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
60 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
67 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
234 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
97 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!
2
votes
1answer
264 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
63 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
111 views

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

The pseudocode we were given is: Right now I have: ...
1
vote
1answer
229 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
225 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
83 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
172 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
118 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
73 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: ...

1
2 3 4 5
7