|
|
Warp <war### [at] tagpovrayorg> wrote in message news:39229572@news.povray.org...
> Try this:
>
> $Z = <2, 0>;
> #debug concat(str(creal(Z),10,10), " ", str(cimag(Z),10,10), "\n")
> $Z2 = cmult(Z, Z);
> #debug concat(str(creal(Z2),10,10), " ", str(cimag(Z2),10,10), "\n")
> $Z2 = cpow(Z, 2);
> #debug concat(str(creal(Z2),10,10), " ", str(cimag(Z2),10,10), "\n")
>
> The expected result is that the second and third line should be
identical
> (or at least almost identical), since 'Z*Z' is the same thing as 'Z^2'.
> However, the cpow() function seems to work extremely buggy. At least
> in this Solaris 7 that code outputs the following:
>
> 2.0000000000 0.0000000000
> 4.0000000000 0.0000000000
> 0.7338278990 3.9321109616
>
> The second line (ie. the result of cmult(Z,Z)) is ok, but the third
> line (result of cpow(Z,2)) seems to be completely wrong.
The cpow function needs both arguments to be 'complex';
To do Z^2 with cpow, you need to do cpow(Z,<2,0>)
Post a reply to this message
|
|