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

Arvid Rosén arvid at softube.com
Sun May 26 22:40:04 CEST 2013


Hi.

Scilab will interpret -10^2 as -(10^2), but m^2 with m=-10 will evaluate as (-10)^2.

Cheers,
Arvid

26 maj 2013 kl. 22:12 skrev Modestas Bunokas <signaloc at gmail.com>:

> 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.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users




More information about the users mailing list