Increase arithmetic precision in using Cardano formula

7 visualizaciones (últimos 30 días)
Ahmad Sheikhzada
Ahmad Sheikhzada el 23 de Sept. de 2021
Comentada: Ahmad Sheikhzada el 24 de Sept. de 2021
I am using general analytic formula to find the roots of a quartic equation as shown here. The equation is of general form with variable complex coefficients, so very small chance to reduce it to a simpler form. Within the arithmetic I lose lots of precision specially when coefficients take on small values. I used symbolic toolbox and vpa and got fantastic result but it is very time-consuming and almost impossible to use in my case as solving this quartic equation is done in each time step integration of solving an ODE problem.
Any idea or a numerical trick to circumvent this issue?
Thanks,

Respuestas (1)

John D'Errico
John D'Errico el 23 de Sept. de 2021
Editada: John D'Errico el 23 de Sept. de 2021
Either use roots to solve for the roots of the quartic, or be forced to use symbolic form for the solutions. Note that roots will be blazingly fast, and it will give you virtually full double precision accuracy. The only case where roots will not be full double precision accuracy is when there are roots with higher multiplicity than 1, but that is not the fault of roots.
Note, there is absolutely no need to use the Cardano formula, as roots will be just as accurate and probably as fast.
If you find the numerical roots from roots are insufficiently accurate, then you have no choice but to use higher precision, and accept that if you insist on super high accuracy, then you must sacrifice speed.
There is no solution that will be both immensely accurate AND blazingly fast. So take your pick. There are no "tricks".
  1 comentario
Ahmad Sheikhzada
Ahmad Sheikhzada el 24 de Sept. de 2021
Thanks John...
First, I am not sure how roots might be more or even as efficient here since it only accepts a vector containing the coefficients of the polynomial. So, if the roots is being calculated for a polynomial with variable coefficients (root as a continous function of coefficients) - which is the case here- then we have to use a for loop, while with Cardano formula it can be done easily without a for loop.
Second, how can we choose a particular root among four? Using Cardano you pick only one formula out of four.
Thanks again for your time...

Iniciar sesión para comentar.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by