[IPython-dev] from __future__ import division

Gaël Varoquaux gael.varoquaux at normalesup.org
Thu Jun 15 03:11:13 CDT 2006


    Hi again,

	Fernando's solution does not solve the problem. I am a bit lost.
I managed to get a minimal example that shows the problem. I am running
ipython7.1.fix1, if I run the following code using a "%run -i" :

###############################################
#Global imports.
from __future__ import division     # So that 2/3 = 0.6666 and not 0 !
from scipy import *
from pylab import *
w_0 = 50e-6
# mesh grid of the region of space we are interested in :
xrange = 0.04
yrange = 0.002
[dx, dy] = [xrange/50.0, yrange/50.0]
[Xgrid,Ygrid] = mgrid[-xrange:(xrange+dx):dx,-yrange:(yrange+dy):dy]
w = lambda z : w_0 *sqrt( 1 + z **2 )
Gaussian_beam = lambda y,z :  exp(-(y**2)/(2*w(z)**2))
GaussianMap = Gaussian_beam(Ygrid,0)
###############################################

    If I start ipython with no switch, this works fine. If I start it
with "-pylab" switch", then I get an "OverflowError: math range error" on
the last line. This is a minimal example. Removing "w_O" from the
definition of "w" gets rid of the error.

    I have no clue what the error means nor why it is triggered with the
pylab mode.

    I think this is an ipython bug but I am not sure. If it is fixed in
7.2 please let me know.

	Regards 

    Gaël




More information about the IPython-dev mailing list