An algorithm is a sequence of well-defined steps that defines in abstract the solution to a problem.

learn more… | top users | synonyms

2
votes
0answers
64 views

Aguilera-Perez Algorithm of $nD$ rotation matrix [on hold]

I want to compute a general $nD$ rotation matrix which corresponds to a rotation by an angle $\theta$ around an $(n−2)$-dimensional subspace. I found the Aguilera-Perez algorithm in their paper: ...
-4
votes
0answers
44 views

How to correctly UPDATE the Centroids in the Fuzzy C Means (FCM) algorithm? [migrated]

ATTENTION TO THE MODERATORS: In a previous time, my question was arbitrarily moved to stackoverflow forum, despite my inquiring to not do it, then it later was deleted from that forum by another ...
2
votes
1answer
75 views

Algorithm for determining factorability

Consider the following polynomial : $P[x,y]:=a_{11}+a_{12}y+a_{13}y^2+a_{21}x+a_{22}x y+a_{23}x y^2+a_{31}x^2+a_{32}x^2 y+a_{33}x^2 y^2$ where the $a_{ij}$ are either $1$ or $-1$. Thus there are $...
0
votes
0answers
45 views

Efficiently create a list of factors of consecutive integers

I'm interested in a scalable (read: sublinear) algorithm for producing the list of integer factors of each integer from 1 to n. ...
1
vote
1answer
59 views

Partial Derivative in FeynCalc

I try to compute some loop diagram in Mathematica with FeynCalc package. In the nominator, I have a huge trace and it shows the right solution but in the next step ...
7
votes
1answer
109 views

Generalizing LongestCommonSequence to 3 or more arguments?

The function LongestCommonSequence finds a longest common subsequence between 2 lists. Apparently, this built-in function does not accept more than 2 arguments. How ...
5
votes
1answer
85 views

Is it possible to use a function for EdgeWeight in a Graph?

Why I cannot calculate all edge weights beforehand: I have many large graphs for which I'd like to find the shortest path between two vertices (FindShortestPath ...
4
votes
2answers
74 views

Why is `FindCycle` crashing for this graph?

I'm working with a directed graph, previously mentioned in Exporting a high-resolution GraphPlot of a very large graph (65,536 nodes). It can be generated with the following code: ...
5
votes
1answer
102 views

FInding outliers in multiple dimensions

I'm working on dataset which isn't normally distributed.which contains three dimensions like cost, discount and profit I'm trying to find outliers in all these dimensions. I used z score to find ...
1
vote
1answer
54 views

Is this the right way to use for loop [closed]

Is this the right way to use for loop in order to find the sequence of $x_n$ ...
0
votes
1answer
32 views

How to fix a procedure to work for another functions? [closed]

I have a procedure. It takes points and draws rectangles. The problem is to change the procedure to work not only with standarts functions. And the list of points must be : ...
12
votes
2answers
429 views

How to fill a grid make its total be largest

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,...
14
votes
6answers
450 views

Given a large binary matrix, find the largest submatrix containing non-zero elements

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 ...
5
votes
1answer
160 views

How to implement QLearning?

I know that v10 has support for both Machine Learning and Finite Markov Processes, the Q-learning algorithm uses both. Specifically, Q-learning finds an optimal action-selection policy for any given (...
6
votes
1answer
198 views

How to efficiently find all combinations of the letters in an alphabet given a condition

Problem: I want to find all unique expressions with n number of terms that contain all the digits (or characters) in alphabet. ...
3
votes
1answer
82 views

Factor a polynomial Root into Roots of smallest possible degree

Suppose I have a polynomial Root representing an algebraic number. I want to represent it (if possible) as a product of several polynomial ...
0
votes
1answer
94 views

Interpolate the discrete list into continuous function

I have a data whose list plot shows up following graph I would like to interpolate the missing data and make the function continuous but for particular x-coordinate there is multiple values of $y$ ...
1
vote
2answers
66 views

How to replace the selected value in matrix with a specific digit?

I want to replace the selected values through "RandomChoice" by 1 and all other values in matrix with 0. I want output in binary form matirx. ...
5
votes
1answer
137 views

Find random $n$ combinations of values with a given sum

This problem is described in the related StackOverflow question: Find all combinations of coins when given some dollar value. I would like generate a list of $n$ combinations of values that sum up to ...
5
votes
2answers
146 views

Extending a list

I have a range of n integers (always starting at 1) which are 1 apart, f.e. Range[10], Range[17] or ...
2
votes
0answers
116 views

How to solve lowest eigenvalue with Lanczos or Arnoldi algorithm? [closed]

By setting Method->Arnoldi in Eigensystem I was able to solve lowest eigenvalue and eigenstate of a large sparse matrix. ...
2
votes
2answers
150 views

Refining subset relations

People who do combinatorics (like me) are often faced with the following problem: For a list of combinatorial objects (vectors, permutations graphs,etc.), we know what multi-set of values it ...
0
votes
1answer
58 views

Creating algorithm with several conditions

I'm pretty new to mathematica and was wondering if you guys could help me out. Example: We have the following coordinates: {1, 1}, {2, 1}, {3, 1}, {5, 1}, {1, 2}, {2, 2}, {3, 2}, where {x,y} And ...
4
votes
1answer
210 views

Random Partitions

I want to write a function RandomPartition to partition a vector of length n into p partitions of varying (random) lengths. For example with ...
8
votes
1answer
97 views

Smallest connected subgraph containing all given vertices

Given a connected graph $G$ and a subset of its vertices, $S$, I need to find the smallest connected subgraph of $G$ containing all of $S$. How would you approach this in Mathematica? I am asking ...
5
votes
1answer
242 views

Finding a complete subgraph efficiently

I'm working on some experimental algorithms which would benefit from methods to find an instance of complete subgraphs with N vertices in an undirected graph. This far I've tried these methods: <...
1
vote
0answers
43 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 ...
3
votes
2answers
202 views

Pollard's Rho algorithm

I'm working in Mathematica and I'm trying to implement the [Pollard's Rho Algorithm for the Discrete Logartihm Problem][1].
19
votes
2answers
453 views

Upper bound “Vicious nearest neighbour” algorithm suggestions

I am asking a question based on this question from the sister site MSE. In an effort to make this a self-contained question, I include the fiorst documented posing of the problem by Robert Abilock in ...
0
votes
0answers
63 views

Find the maximum hyperrectangle contained in a set of points

I have a question similar to this one ( Find the largest rectangular block satisfying some condition without iterating explicitly). but in my case I have a multidimensional (up to 6 dimensions) binary ...
2
votes
0answers
37 views

Algorithm to determine if two colored graphs are isomorphic? [duplicate]

I have two (vertex-)colored graphs. I want to determine if they are isomorphic, with the condition that the isomorphism respects the colors of the vertices. Moreover, I want the algorithm to output ...
0
votes
0answers
53 views

Get Domain resp. implicit piecewise definition of numeric Function

Given the following quintic polynomial ...
18
votes
3answers
539 views

How to implement the sample-point process like the built-ins of Mathematica?

Consider this: pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}, {4, -2}, {5, 1}}; f = BSplineFunction[pts] I can use ParametricPlot to ...
2
votes
3answers
166 views

Given a list of triangle vertices, how to find the neighbors for each vertex?

A triangle is represented by {a,b,c}, indicting that its vertex IDs are a, b, and ...
0
votes
1answer
53 views

A question about the syntax [closed]

I have $3$ elementary questions to ask and I thank you in advance. Question N°1. What is the right syntax for $$y\equiv0\pmod {2}$$ in the code below? ...
7
votes
1answer
120 views

Challenging matrix sorting request?

I have an application in mind, and I need to do the following analysis, but am having a high degree of difficulty conceptualizing it in terms of syntax. I understand what I want, but cannot seem to ...
1
vote
1answer
273 views

Efficient algorithm to generate a basis for exact diagonalization

The problem is described as follows: I need to generate a basis(matrix) in lexicographic order. For two different basis vector $\{n_1,n_2,\cdots,n_M\}$ and $\{t_1,t_2,\cdots,t_M\}$, there must exist ...
6
votes
1answer
173 views

How to do automatic differentiation?

Does Mathematica have any AD functionality or does it only support symbolic differentiation? If not, are there any packages or other third party implementations available? Edit (J. M.) Here is an ...
0
votes
0answers
70 views

3-adic FFT algorithm

I am trying to implement the FFT algorithm when $n=3^k$, but maybe my code is wrong. Are there any suggestions for improving my code? ...
1
vote
0answers
239 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 ...
6
votes
1answer
387 views

Efficiently find all connected subgraphs

Is there a way to generate all the connected subgraphs of a graph in mathematica without going through all the subsets of the nodes and checking if the subgraph is connected (which will be O(2^N)*O(...
2
votes
1answer
149 views

i need a swap mutation code (genetic algorithm) in Mathematica?

I'm working on GA coding to optimize the locators position in fixturing system to minimize the error in precision manufacturing.I need a code for mutation (genetic algorithm) in Mathematica. Here, I ...
2
votes
0answers
106 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?
-1
votes
1answer
46 views

Algorithm in Module behaves different [closed]

In my Notebook i wrote this algorithm: ...
2
votes
1answer
201 views

Using the Baby-Step Giant-Step algorithm

Here is a concept I am working through: As part of an attack on an El-Gamal cipher, solving the discrete logarithm problem $$10^x = 532107 \;\, {\rm mod} \;\, 1313839.$$ Using the baby-...
5
votes
4answers
642 views

Efficient way to sum all the primes below $N$ million in Mathematica

Today, I saw a problem described as below: Sum all primes below $N$ million At the beginning, I feel it is rather simple to calculate it in Mathematica ...
5
votes
4answers
723 views

A too complicated lookup

I have the following keys: nm = {"bay", "ica", "rat", "tat", "dax", "dow", "sp5", "nas", "mean", "total"}; which I want to use to find a corresponding entry in ...
5
votes
3answers
148 views

Unragging a matrix

Today I ran into matrices like this one: ...
2
votes
2answers
55 views

Count elements between matching opening and closing parentheses?

Suppose I have a List of the form: lst={"(", "x1", "x2", "(", "(", "x3", ")", "x5", "(", "x6", ")", ")", ")"} For each pair ...
3
votes
2answers
166 views

Replace missing data

I have vectors of equal lengths where I want to replace the zeroes (missing data) with their preceding values. So far I have written: ...