From r.hankin at soc.soton.ac.uk  Wed Mar 16 09:04:24 2005
From: r.hankin at soc.soton.ac.uk (Robin Hankin)
Date: Wed Mar 16 09:04:41 2005
Subject: [Rd] Trigonometric functions (PR#7728)
In-Reply-To: <Pine.A41.4.61b.0503151524570.383546@homer03.u.washington.edu>
References: <Pine.LNX.4.44.0503160018280.2246-100000@kleigh.nl>
	<Pine.A41.4.61b.0503151524570.383546@homer03.u.washington.edu>
Message-ID: <16091bc726bb18999a039e4b48236a49@soc.soton.ac.uk>


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


[Rd] Trigonometric functions (PR#7728)
Robin Hankin