Re: Errors in Jacobian Elliptic Functions

*To*: mathgroup at smc.vnet.net*Subject*: [mg7625] Re: Errors in Jacobian Elliptic Functions*From*: David Withoff <withoff>*Date*: Fri, 20 Jun 1997 16:15:58 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

> I have an application which requires extensive use of Jacobian Elliptic > Functions like JacobiSN, EllipticPi and EllipticF. I have found that > these functions have some very small errors near the ends of their > ranges. For example, JacobiSN is supposed to be bounded by +1 and -1, > just like Sine and Cosine. However, for JacobiSN[x,p], with p very > close to zero, JacobiSN can occasionally come out slightly greater than > +1. The problem is that my application also requires that I take ArcSin > of JacobiSN so that numbers slightly greater than +1 return complex > values which mess everything up. I have done some study on these errors > and they are not continuous functions of the arguments. I can plot > regions as wide as 10^-5 where they have the error and then find > continuous regions with no errors. > > Question #1. Does anyone know if it is better to truncate the > JacobiSN's with something like Min[Max[JacobiSN[x,p],-1],1] or to > rescale the whole thing with something like JacobiSN[x,p]/(1+10^-11)? > > The second manifestation of this error is in the EllipticPi and > EllipticF functions when the first argument is very large or the second > argument is very close to Pi/2. I get obvious wrong answers for certain > arguments in this region and extraneous complex values in others. > > Question #2. Does anyone know of a way to estimate the error in an > ill-behaved function like this? > > Thanks, Sean Ross The universal suggestion for all problems related to numerical evaluation of special functions is to try high-precision arithmetic. The idiosyncracies of machine numbers make it very difficult to always get reliable results for all special functions. I would also be interested in seeing specific examples of these behaviors. I don't doubt that this happens, but I wasn't able to come up with any examples in a few minutes of playing around with this. My guess is that it is much easier to eliminate these errors (using high precision) than to analyze them, and throwing them away (using Min and Max) seems like a positively dreadful solution. Dave Withoff Wolfram Research