An algorithm is a sequence of well-defined steps that defines in abstract the solution to a problem.
0
votes
1answer
41 views
How can I find the the greatest common divisor with Euclid's algorithm?
How can I create a function ggt[p,q],and find the greatest common divisor with Euclid's algorithm?p,q are integer.
3
votes
0answers
44 views
Implementing t-SNE (t-Distributed Stochastic Neighbor Embedding)
Context
Six months ago @M.R. asked about an implementation of the t-Distributed Stochastic Neighbor Embedding (t-SNE) algorithm by van der Maaten and Hinton (2008). (@M.R.'s question)
@Alexey ...
3
votes
1answer
94 views
Print Bingo cards
As you know, the Bingo cards are structured as follows:
a table with three rows and nine columns;
in each row there are exactly five numbers;
in each column can be from zero to three numbers in ...
0
votes
1answer
47 views
Calculating minimum potential energies for Thomson problem
I have found a table of values for minimum potential energies up to 470 electrons on Wikipedia. However, the method I used for calculating energies is not efficient enough for configurations that have ...
4
votes
2answers
168 views
1
vote
1answer
64 views
Print all permutations containing exactly k elements
In Wolfram Mathematica, writing:
Permutations[{a, b, c, d}]
or writing:
Permutations[{a, b, c, d}, {4}]
I get:
...
5
votes
1answer
177 views
Algorithm for Egyptian fractions, want to optimize the maximum denominator size
Any rational number can be expanded into a finite sum of unit fractions with distinct denominators, called Egyptian fractions.
There is no 'optimal' algorithm in terms of denominator size or number ...
3
votes
0answers
65 views
Symbolically find optimal convolution algorithm [closed]
A large portion of deep learning research goes into convolution neural networks, hence there's a need for a fast algorithm. I wonder if an optimal convolution algorithm can be found symbolically with ...
-1
votes
0answers
105 views
LinearProgramming approach for “best teams” algorithm
I like to ask a question that is based on one of my other questions in a previous post.
It is about an algorithm that helps me, to find groups for a cooking event. I got great help by Anton Antonov ...
1
vote
0answers
89 views
Wilf-Zeilberger algorithm in Mathematica [duplicate]
I am trying to prove the q-combinatorial identity
$$\sum_{s=0}^r(-1)^sq^{\frac{s(s+1)}{2}}{n-2r+s\brack n-2r}_q{n\brack r-s}_q=\sum_{s=0}^{r-1}(-1)^{s+1}q^{\frac{s(s+1)}{2}}{n-2r+s\brack n-2r}_q{n\...
1
vote
0answers
65 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
1answer
68 views
Mathematica code to find R (upper triangular matrix) in QR decomposition using reflection method
I am trying to write Mathematica code to find $R $ (upper triangular matrix) in $ A=QR $ $A \in \Bbb{R}^{n\times n}$decomposition using reflection method.
I wrote for $3 \times 3$ matrix.
Any ...
3
votes
2answers
108 views
What is the algorithm to find the Up-sets of this set?
In my thesis, I need to find all Up-sets of the set in the picture below using the order provided in the picture. I tried to code this problem with Mathematica but I can't find a nice and optimal ...
1
vote
1answer
59 views
Calculating multi-objective shortest path for a graph in Mathematica
I would like to calculate multi-objective shortest path for a graph which edges have multiple weights (distance, delay, cost, for example) using e.g. Martins' algorithm. Is it possible doing that ...
0
votes
1answer
58 views
The nearest object from the array of objects
I need to find the most similar to desired object from the array of objects.
In this case ...
1
vote
0answers
54 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
1answer
48 views
Programming Coombs method
Coombs methods is a method to have a winner in elections.
I want to program the Coomb methods for elections and I am highly incompetent incompetent in programming
Suppose 4 candidates. This leads to ...
1
vote
1answer
59 views
How to perform an euclidian division in a Finite Field?
I am quite new to mathematica, I am looking for a function similar to QuotientRemainder[] but which works with finite fields as implemented by the ...
0
votes
0answers
35 views
Do loop carrying out recursion not looping - must be a simple mistake!
I have what I think is a basic do loop, but it is not executing as planned.
Starting with some setup:
...
2
votes
1answer
99 views
How to sign a string with HMAC-SHA1 algorithm
I want to sign a string with HMAC-SHA1 algorithm.As the instruction I should use this two string:
...
0
votes
0answers
66 views
Algorithm using Divided Differences to calculate coefficients of interpolation polynomial
I am trying to replicate psedudocode from the book Numerical Mathematics
that gives the coefficients of the interpolation polynomial using Newton's Divided Differences method. I chose to try to use a ...
0
votes
1answer
54 views
Putting some calculations together to form an algorithm
Considering these below where n is an odd number, k is also an odd number less than n:
<...
2
votes
1answer
82 views
Compute numeric Pfaffians of matrices efficiently?
I have the following code, that computes the Pfaffian of an even dimensional anti-symmetric matrix via direct row expansion:
...
2
votes
0answers
81 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 ...
0
votes
0answers
73 views
Interpretation of a function
I know this is not great, as far as a question, but I came across this function,
...
4
votes
0answers
102 views
Finding all Minimal Cut Sets for Site Percolation?
Bug introduced in 9.0 and persisting through 11.0.1 or later
FindVertexCut and FindMinimumCut are new in 9.0.
I want to ...
6
votes
2answers
204 views
Finding all minimal paths in site percolation?
I want to find all minimal site percolation paths from the left side to the right side, small demo grid.
A related question is here on finding bond percolation paths instead of minimal site ...
1
vote
0answers
101 views
Aguilera-Perez Algorithm of $nD$ rotation matrix [closed]
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:
...
2
votes
1answer
83 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 $...
2
votes
1answer
109 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
98 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
127 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 ...
6
votes
1answer
99 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
82 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:
...
7
votes
1answer
141 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
59 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
34 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 :
...
14
votes
2answers
553 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, ...
15
votes
6answers
611 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 ...
6
votes
1answer
292 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
216 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.
...
6
votes
0answers
119 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
170 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
70 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
146 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
156 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
191 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
158 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
62 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 I ...
4
votes
1answer
277 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
...