[SciPy-user] How to get sqrt(-1) = 1j per default?

Martin xyz.account@arcor...
Sat Jul 11 08:55:53 CDT 2009

In an "ipython -pylab -p scipy" console I get
In [1]: sqrt(-1)
Out[1]: nan
but I would prefer 1j as the result. This is achieved by
In [2]: from scipy import *
After that I get
In [3]: sqrt(-1)
Out[3]: 1j

I found out that the ipython option -p scipy executes the startup script
which contains

    ip = IPython.ipapi.get()

        ip.ex("import math,cmath")
        ip.ex("import numpy")
        ip.ex("import scipy")

        ip.ex("import numpy as np")
        ip.ex("import scipy as sp")
        ip.ex("from numpy import *")
        ip.ex("from scipy import *")
        print('... import * done')

Here the command "from scipy import *" is the last executed command as in my 
interactive session above. Why is this startup script not sufficient to have 
sqrt(-1)=1j right from the console start??
What I should do additionally to achieve this?

More information about the SciPy-user mailing list