[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Getting complex numbers results instead of expected real numbers

**From**: |
ant |

**Subject**: |
Re: Getting complex numbers results instead of expected real numbers |

**Date**: |
Sun, 12 Feb 2012 10:16:32 -0800 (PST) |

Thanks for your good suggestions, they are very useful for a beginner.
However I'm still puzzled by the c0's showing as complex.
For example, since the c0 are all natural numbers (20, 30, 40, ..., 220) why
I'm I getting complex numbers like 20 + 0000i,... in the end?
Letting c0 = 20 and changing the code to include one more line
...
c0 #newline
xstar = OptimalClosure()
info_vec = [info_vec; c0 xstar];
OUTPUT:
c0 = 20
xstar = 9.6388e+000 + 6.0778e-054i
info_vec =
20.0000 + 0.0000i 9.6388 + 0.0000i
My understanding is the following. Since info_vec has an element - xstar -
that is complex, Octave "promotes" c0 to a complex number too, because now
info_vec is a complex matrix. Is this correct?
Guess that, if so, this may cause quite a few surprises, and be difficult to
debug if the complex numbers arise unexpectedly.
--
View this message in context:
http://octave.1599824.n4.nabble.com/Getting-complex-numbers-results-instead-of-expected-real-numbers-tp4381221p4381627.html
Sent from the Octave - General mailing list archive at Nabble.com.