Underflow issue in Python
Question: I need to draw the following function, which is what I call theory data

![enter image description here](http://i.stack.imgur.com/jqUf2.gif)

with a=z-(L/2) b=z+(L/2) for the following case

  * N=75
  * I=1
  * L=0.16
  * R=0.013

for z between -0.011 and 0.011. My guess is that there are underflow issues.
The code is as follows

    
    
    import numpy as np
    import matplotlib.pyplot as plt
    
    class Solenoid():
    
    def __init__(self,N,I,L,R):
        self.N=N
        self.I=I
        self.L=L
        self.R=R
    
    def field(self,z):
    
        mu=4*(np.pi)*(10 ** -7)
    
        coef=(mu*self.N*self.I)/(2*self.L)
    
        a=z+(self.L/2)
        b=z-(self.L/2)
    
        sum_a=a/((self.R ** 2 + a ** 2) ** 0.5)
    
        sum_b=b/((self.R ** 2 + b ** 2) ** 0.5)
    
        return (coef*(sum_a - sum_b))
    
    sol=Solenoid(75,1,0.160,0.013)
    x=np.linspace(-0.011, 0.011, 10000)
    y=[]
    
    for point in x:
        y.append(sol.field(point))
    
    plt.plot(x,y)
    plt.show()  
    

The output is

![enter image description here](http://i.stack.imgur.com/uhtkB.jpg)

which is plain wrong. The expected output is a more or less smooth line along
with experimental data:

![enter image description here](http://i.stack.imgur.com/bmqvT.jpg)

UPDATE New output is

![enter image description here](http://i.stack.imgur.com/N9TN8.png)


Answer: It was a factor of 10 in the x scale ...

![enter image description here](http://i.stack.imgur.com/e0PR0.jpg)

