Skip to content
Prev 67536 / 398506 Next

Inf +1i vs 1+Inf*1i

On Apr 13, 2005, at 09:40 am, Martin Maechler wrote:

            
thanks for this Martin.

Now I see what is going on, I wouldn't describe this as "undesirable" 
because
"(1+0i) * (0 + Inf i)"  depends  on the behaviour of the infinite limit
in the second bracket compared with the zero limit in the first.

To wit, f() and g() both calculate 1*(Inf i):



 >  f <- function(n){(1+1i/sqrt(n))*(0+n*1i)}
 > g <- function(n){(1+1i/n)*(0+sqrt(n)*1i)}
 > f(1e8)
[1] -10000+1e+08i
 > g(1e8)
[1] -1e-04+10000i
 >


So perhaps it's unreasonable to expect complex arithmetic to guess what 
I want.


very best wishes

rksh



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