I have to make a division that sometimes yields and inf, and I want to replace it by 0.
I have try this:
import pylab as p
l = array vector defined along the program
a = (drRdl)/(1.-((R0/R)*p.sin(l))2)(1./2)
It works, but it doesn’t return an array as expect, if some of the values are zero, then a = 0.
So I tried:
a = p.zeros(len(l))
for i in range(len(l)):
a[i] = (drRdl)/(1.-((R0/R)*p.sin(l[i]))2)(1./2)
But doing it this way I’m not able to get an exception:
And I don’t know what I have to change to get an exception doing things this way.