> Date: Wed, 25 Jun 2003 16:12:33 -0700
> From: Richard Maine <[log in to unmask]>
> Giuseppe Panei writes:
> > The intrinsic sqrt (z) for z complex yields only a result.
>
> > If I need all the solutions, have I write a module to overwrite the original
> > intrinsic ? (This new intrinsic maintain the same name as original.)
sqrt(z) will give you one result; conjg(cmplx(z)) will give you the other.
> You can, but I recommend against it and there are complications. And,
> as I mentioned before, you need to define exactly what you would
> expect this replacement to do. Just saying that you "need all the
> solutions" doesn't define exactly what you want. How do you expect
> these to be returned? Is the function to return an array? If so,
> then it won't be usable in the same contexts that the existing sqrt
> is, making it seem like a bad idea to replace the existing sqrt.
>
> Also, as someone else pointed out, this seems like a lot of
> complication for a trivial problem. The two solutions are what
> sqrt(z) currently returns and the negative of that. If you wanted
> those in an array, you could just write
>
> (/ 1, -1 /) * sqrt(z)
No. (/ sqrt(z), conjg(sqrt(z)) /) will do it.
> --
> Richard Maine
|