Re: [julia-users] Re: complex results - why not automatic type conversion?

2015-07-25 Thread Mauro
The lack of this specific issue appearing in say Python may be that the relative speed penalty is not that large? It seems that one of the strong features of Julia is its speed, having to deal with complex numbers in this way means that people have to pay more attention to coding than when

[julia-users] Re: complex results - why not automatic type conversion?

2015-07-25 Thread Joe Tusek
The lack of this specific issue appearing in say Python may be that the relative speed penalty is not that large? It seems that one of the strong features of Julia is its speed, having to deal with complex numbers in this way means that people have to pay more attention to coding than when

Re: [julia-users] Re: complex results - why not automatic type conversion?

2015-07-25 Thread Joe Tusek
I guess I have a long way to go with Julia. Thanks everyone for taking an interest.

Re: [julia-users] Re: complex results - why not automatic type conversion?

2015-07-23 Thread Tim Holy
On Wednesday, July 22, 2015 11:32:19 PM Joe Tusek wrote: O.k., should I be writing all my Julia with variables defined as complex so as to avoid runtime assignment errors that may arise when outcomes of calculations result in complex numbers such as square roots of negative numbers or eigen

[julia-users] Re: complex results - why not automatic type conversion?

2015-07-23 Thread Joe Tusek
O.k., should I be writing all my Julia with variables defined as complex so as to avoid runtime assignment errors that may arise when outcomes of calculations result in complex numbers such as square roots of negative numbers or eigen values etc? Will there be a performance penalty coding this

[julia-users] Re: complex results - why not automatic type conversion?

2015-07-23 Thread Steven G. Johnson
I'm not convinced that the pickiness of Julia's square root is a serious problem. Python's sqrt(x) behaves the same way for real x, and it hasn't been an obstacle to SciPy's adoption. For that matter, in strongly typed languages like C and Fortran this has pretty much always been the behavior

[julia-users] Re: complex results - why not automatic type conversion?

2015-07-22 Thread Felipe Jiménez
I think it has to do with type stability. Knowing beforehand the types of the inputs and outputs of functions gives the compiler info for much faster performance. It is explained in the manual.

[julia-users] Re: complex results - why not automatic type conversion?

2015-07-22 Thread Felipe Jiménez
Guess you could also do mysqrt{T:Real}(x::T) = x=0 ? sqrt(x) : sqrt(x+0im) but it will be slower.

[julia-users] Re: complex results - why not automatic type conversion?

2015-07-22 Thread David P. Sanders
How about mysqrt(x::Real) = sqrt(complex(x)) mysqrt(x::Complex) = sqrt(x)

[julia-users] Re: complex results - why not automatic type conversion?

2015-07-22 Thread Jonathan Malmaud
You can write const i=im at the top of your code if you'd like to use i instead of im. On Wednesday, July 22, 2015 at 8:49:04 AM UTC-4, Joe Tusek wrote: Having come from Electrical Engineering with a Matlab background and being new to Julia, I can't understand why assignment of complex

[julia-users] Re: complex results - why not automatic type conversion?

2015-07-22 Thread Steven G. Johnson
On Wednesday, July 22, 2015 at 9:40:47 AM UTC-4, David P. Sanders wrote: How about mysqrt(x::Real) = sqrt(complex(x)) mysqrt(x::Complex) = sqrt(x) Just mysqrt(x) = sqrt(complex(x)) should be sufficient if you always want a complex result. complex(x) is a no-op if x is already