Re: [Rd] Trigonometric functions (PR#7728)

From: Robin Hankin <r.hankin_at_soc.soton.ac.uk>
Date: Wed 16 Mar 2005 - 08:04:24 GMT

On Mar 15, 2005, at 11:26 pm, Thomas Lumley wrote:

> On Wed, 16 Mar 2005, Peter Kleiweg wrote:
>
>> Thomas Lumley schreef op de 15e dag van de lentemaand van het jaar
>> 2005:
>>
>>
>>>> x<-sqrt(2)
>>>> asin(x^2-1)
>>>> result in:
>>>> NaN
>>>
>

The way I would deal with this would be to force asin() to work in complex mode:

 > x <- sqrt(2)
 > asin(x^2-1+0i)
[1] 1.570796+2.980232e-08i
 >

(the error is large because the derivative of arcsin is infinite at x=1).

--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Mar 16 19:07:34 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:26:30 GMT