[ADMB Users] Using asin with df1b2variables

dave fournier davef at otter-rsch.com
Sun Oct 20 06:20:45 PDT 2013


Hi,

The problem is that if you are "close" to north the estimation procedure may
become unstable.   It is better to use atan which has a removable
singularity at pi/2 and 3pi/2.  However it will still be a fiddly thing 
with several cases to consider.

That is the way I would proceed to build an industrial strength function.

Something like

Start with   atan(y/x)

   if (x==0.0)
      if (y>0.0)
          return pi.2
      if (y<0.0)
           return 3*pi/2

    else
        u=atan(y/x)
        if (x<0)
            u+=pi

    if (u<0)
       u+=2*pi

then you need to deal with  x close to 0.
You can use a taylor expansion for say abs(x) < 1.e-8 or whatever.

That's just a sketch.

Anyway the point is that asin has real problems near pi/2 and 3pi/2 
whereas atan
is really nice.

          Dave





More information about the Users mailing list