[Scilab-users] Can't understand different answer's on sqrt(x^2+1)

Modestas Bunokas signaloc at gmail.com
Sun May 26 22:12:29 CEST 2013


Trying to work with vectors, and getting weird results. Example:

m=[9 16];
sqrt(m^2+1)
ans = 9.0553851    16.03122 

I will get same values if I will use input as vector, or will put values
manually. But if I use negative numbers like:

m=[-10 -3];
sqrt(m^2+1)
ans =10.049876    3.1622777
------------------------------
sqrt(-10^2+1)
ans =  9.9498744i 
sqrt(-2^2+1)
ans = 2.8284271i

Questions would be - why do I getting complex number as a result by
inputting m by hand and different result by giving it as vector? Is scilab
irc channel active for some more arithmetic questions, as I stuck a bit on
such things with scilab, if not maybe exist any other places to look for
real time help? I fully understand that it's all because of lack of my
expierence

p.s. Scilab version 5.4.1, on octave and wolframalpha for sqrt(-2^2+1)
getting 1.73205i.

Regards





--
View this message in context: http://mailinglists.scilab.org/Can-t-understand-different-answer-s-on-sqrt-x-2-1-tp4026728.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list