Computing exponentials and Trig functions
Paul Zimmermann
Paul.Zimmermann at loria.fr
Thu Dec 6 17:55:53 CET 2007
> Date: Thu, 06 Dec 2007 08:28:57 -0800
> From: mr.janus at mac.com
>
> Hello,
>
> I'm trying to write a program in C using GMP as matlab is unable to handle the precision i need for solving my coupled equations accurately. However, one of the many problems i'm having is how to speed up the calculation of trig functions.
>
> I often have to solve complex exponentials but the way i have coded it is painfully slow. I split the exponential into the real and imaginary parts and solve separately. I then solve using sin, cos, sinh, and cosh identities.
>
> However the slowdown problem arises from my calculation of the trigonometric functions, which i do by Taylor expansion. Obviously, as I push the precision the Taylor expansion takes longer and longer to converge to the required precision. How does everyone else do this?
>
> Many thanks
>
> Huw
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at swox.com
> https://gmplib.org/mailman/listinfo/gmp-discuss
Dear Huw,
one solution would be to use software tools that already implement the
exponential and trigonometric functions, for example mpfr (mpfr.org) for
real numbers, or mpc (www.lix.polytechnique.fr/Labo/Andreas.Enge/Mpc.html)
for complex numbers.
The page http://mpfr.org/mpfr-current/timings.html compares timings obtained
with several tools.
Regards,
Paul Zimmermann
More information about the gmp-discuss
mailing list