On Fri, 10 Jan 2020, Riccardo (Jack) Lucchetti wrote:
On Fri, 10 Jan 2020, Allin Cottrell wrote:
> 3) I'm not so sure about Sven's suggestion that (if I'm understanding him
> right) sqrt(M), for M a real matrix with some negative elements, should
> return an appropriate complex matrix. It's clearly defensible, but it might
> produce surprising/puzzling results in some cases so I think it requires
> further discussion.
This is what R does:
<R>
> sqrt(as.matrix(c(1, -2)))
[,1]
[1,] 1
[2,] NaN
</R>
and this is what Octave (therefore, I presume, Matlab) does:
<octave>
>> sqrt([1 -2])
ans =
1.00000 + 0.00000i 0.00000 + 1.41421i
</octave>
Personally, I'd stick with the R approach.
Me too.
Allin