by **joe** » Sun Mar 31, 2013 10:23 am

Thanks for the bug report.

For the first problem what is the argument you are using?

As for the 2nd problem:

Actually, the SQRT function used to work as you described. In order for that to work however the SQRT function had to return a complex number. Which is fine if one is working with complex numbers, however most of the time people are just using reals. Many functions and Mechs don't work with complex numbers.

I tried to resolve this issue by detecting if the result contained an imaginary component and casting it to real if it didn't. However, this cast was done only at the end of a calculation. So if a person used the SQRT function in the middle of the equation, problems would persist.

I finally decided, that I really just needed two versions of the SQRT function. One for reals and one for complex numbers. In your case you are getting the SQRT for reals when you want the SQRT for complex numbers. The way to tell Oovium which one you want is through the input data type.

If you want the real sqrt use a real input. If you want the complex sqrt use a complex input.

In your case for the number -1 there are two ways to cast it to complex. One is you can add 0i to it, for example: sqrt(-1+0*i). Or you can use the Complex constructor like this: sqrt(Complex(-1,0)).

Let me know if any of this isn't clear. Also, any other feedback on using complex numbers is much appreciated. Shockingly, (to me at least) this is the first report I have ever gotten in the last 4 years of someone using the complex number feature in Oovium. So, it's good to know it's getting some use!