Evaluate elementary symmetric polynomials
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Claudio Bellani
il 13 Lug 2014
Risposto: Roger Stafford
il 13 Lug 2014
Given n variables x_1...x_n and given an integer 1<=k<=n, I'd like to evaluate the k-th elementary symmetric polynomial, as defined -for instance- here:
My attempt was to store x=[x_1,...x_n], to define a vector j=[] of length k and then to execute
for j(1)=1:n
for j(2)=j(i):n
...
for j(n)=j(k-1):n
e=e + x(j(1))*...*x(j(k));
end...end
How to replace the dots?
0 Commenti
Risposta accettata
Roger Stafford
il 13 Lug 2014
Let v = [x_1,x_2,x_3,...,x_n] be a vector of the values of x_i.
e = sum(prod(nchoosek(v,k),2));
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Nonlinear Optimization in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!