[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem with acos
From: |
John W. Eaton |
Subject: |
problem with acos |
Date: |
Tue, 28 Jul 2009 10:59:21 -0400 |
On 28-Jul-2009, zampala wrote:
| I need to calculate the inverse cosine of this matrix (2x2, complex values):
|
| P =
|
| 9.9422e-01 - 0.0000e+00i 8.9732e+08 - 0.0000e+00i
| -1.0151e+00 + 0.0000e+00i 3.0910e+05 - 0.0000e+00i
|
| octave:97> acos(P)
| ans =
|
| 0.10755 - 0.00000i NaN + Infi
| 3.14159 - 0.17368i 0.00000 + 13.33457i
|
| octave:98> acos(P(1,2))
| ans = NaN + Infi
Apparently your matrix P has some small imaginary components. Try
format long
P
so that they will be displayed.
| octave:99> acos(8.9732e+8 - 0.0000e+00i)
| ans = 0.00000 - 21.30807i
When you write it this way, you are setting the imaginary part to
exactly 0. But the result you show does not seem correct for a
real-valued argument, and is not what I see (I get NaN
for acos (8.9732e+8) on my system). What do you expect the value of
acos (X) to be when X is real and outside the range [-1,1]? What do
you expect it to be when X is complex, and there is a large real part
and a small imaginary part?
In any case, Octave ultimately calls the acos function from the
standard C library on your system, so if the result is incorrect, it
is likely that the problem is in the C library function, not Octave.
But if you still think you've found a bug in Octave, then please
report it to the address@hidden list. Before you do, however, please
read http://www.octave.org/bugs.html so you'll know what to include in
your report so that it is useful.
jwe