# 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

342 questions
Filter by
Sorted by
Tagged with
46 views

Theoretical side Simple example: If I have two sets $A_1=\{1,3\} ,A_2=\{2,3\}$ and Permutations[{1, 2, 3}]= $\left( \begin{array}{ccc} 1 & 2 & 3 \\ 1 &... 0 votes 0 answers 50 views ### Algorithm consisting of modules returning multiple errors I'm trying to write a genetic algorithm that will take a list of lists of reals in interval [0,1], my "starting population", "score" them according to a fitness function, append ... 0 votes 1 answer 70 views ### Visualization of an iteration scheme in Mathematica I have a mapping T as attached (here. Now for$x_{0}\in C$the Mann iteration process read as$x_{n+1}=(1-\alpha_{n})x_{n}+\alpha_{n}Tx_{n}$n=0,1,2,3,... Now I want to obtain a visualization of the ... 2 votes 0 answers 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 ... 0 votes 1 answer 123 views ### Algorithm to convert real numbers decimal to binary Currently trying to write code that converts decimal floats to binary base form (I know BaseForm exists). Currently I'm working with an example that takes 3.3 and converts it: ... 1 vote 1 answer 102 views ### Recursive relationship too slow Writing: ... 0 votes 0 answers 98 views ### Particle Swarm Optimization implementation in mathematica Hi I am new to mathematica, I want to use it to implement PSO instead of using matlab. Could anyone suggest me how to find some implementation examples with code or its general implementation for ... 1 vote 1 answer 118 views ### A method for endpoints in mathemtica [closed] If$(\mathbb{R},|.|)$is a real line,$C$a subset of$\mathbb{R}$and$K(C)$denote set of a compact subset of$C$. Define a multivalued mapping$T:C\rightarrow K(C)$. We know that a point$p\in C$... 0 votes 3 answers 240 views ### How to compute higher iterations in mathemtica 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 ... 0 votes 1 answer 105 views ### How to obtain the convolution of these functions? I am starting to use Mathematica. I wanted to compute $$\nabla F*\phi(x),\;x\in\mathbb{R^2}$$ where$F(x)=\ln\|x\|$and$\phi(x)=\chi_{B(0,2)}(x)$. I am a new user of this software, so I don't know ... 2 votes 2 answers 229 views ### Solution of differential equation by by an iterative method Let$y^{\prime\prime}(t)+y^{2}(t)-t^{4}-2=0$, where$0\leq t\leq 1$. The boundary conditions are$y(0)=0$and$y(1)=1$and so its exact solution is$y(t)=t^{2}$. Now I want to compute the solution by ... 0 votes 0 answers 111 views ### On the numerical computation of polynomial roots In the guide on the NRoots[] function I read: ... 2 votes 1 answer 45 views ### How many nearest neighbours in a classifier by default? I've been running a classifier on my data with the 'NearestNeighbors' method. I've learned that I can specify the number of neighbours used with the following command: ... 1 vote 0 answers 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 ... 2 votes 3 answers 133 views ### Path finding in Complete Graph [closed] I have the following Complete Graph with random labels on its edges ... 1 vote 0 answers 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 0 answers 66 views ### How to optimize Code for Wolfram Challenges? [closed] 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 0 answers 48 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 2 answers 194 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 2 answers 343 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 1 answer 222 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 1 answer 120 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 1 answer 228 views ### On the numerical roots of transcendent functions Writing: ... 3 votes 5 answers 425 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 2 answers 85 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 1 answer 235 views ### Lanczos algorithm [closed] How can I implement this method ,,Lanczos algorithm " through Mathematica? This method solves eigenvalues and eigenvectors of a symmetric matrix. 7 votes 1 answer 359 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 ... 5 votes 1 answer 115 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 0 answers 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 ... 5 votes 3 answers 404 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 1 answer 54 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 3 answers 556 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 0 answers 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: ... 3 votes 1 answer 167 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 0 answers 52 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 0 answers 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: ... 8 votes 2 answers 324 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 0 answers 113 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 1 answer 138 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 2 answers 137 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 2 answers 186 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 1 answer 186 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 1 answer 492 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 0 answers 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 ... 8 votes 1 answer 299 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 0 answers 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 ... 0 votes 0 answers 99 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 4 answers 236 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
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!
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 ...