Multidimensional Polynomial Root Finding
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to write a program to solve for the roots (x) of a 4th order polynomial of the form:
ax^4 + bx^3 + cx^2 + dx + e = 0
However, the coefficients of the above polynomial change over time with n time steps. Each coefficient has it's own equation based on other variables that change in time. So what I've been trying to do is write a 3 dimensional array that is 1 row, 5 columns representing each coefficient and n time steps:
P( 1, 5, n )
Then I was trying to take the root of all the elements in that row for any given time step. But I'm not sure how to create a new array that includes the roots of the polynomial solutions to each time step n. The roots function creates a matrix that is 4 rows by 1 column (only 2 dimensional). nts is the last time step.
For n = 1:nts
Some array ( 4, 1, n ) = roots ( P(1, 5, n )
Once I have this new array, I need to be able to call on the 3rd root in the matrix or Some array ( 3, 1, n ).
I'm not too familiar with Matlab but it's the only way I can solve these roots as Excel Solver is not working.
0 comentarios
Respuesta aceptada
Walter Roberson
el 8 de Jun. de 2012
4th order polynomials have explicit solutions, so you can construct the solutions symbolically and then use matlabFunction() to convert that to a function handle. Then apply that function handle to grids of the list of values over time, [A, B, C, D, E] = ndgrid([a1 a2... an], [b1 b2 ...bn], [c1..cn], [d1..dn], [e1...en])
I am not certain whether MuPAD knows the algebraic solution to the quartic; whether it does might depend upon the version. In Maple it would be coded as
[allvalues(solve(a*x^4+b*x^3+c*x^2+d*x+e, x))]
I have not yet found any MuPAD equivalent of Maple's allvalues()
1 comentario
Walter Roberson
el 9 de Jun. de 2012
You might be able to get the explicit solution for the quartic by using
solve(a*x^4+b*x^3+c*x^2+d*x+e, x, 'MaxDegree', 4)
Más respuestas (0)
Ver también
Categorías
Más información sobre Polynomials en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!