I am trying to convert a code from Matlab to Python. In python I wrote:
age=np.arange(start_age, start_age+D, deltat)
For num in age: this doesn't
if age[:]<(65):
Y=1
break
else
Y=0
break
break
H = (1/r) * (1 - math.exp(-r * max(0, (65 - age[:])))
A = ((1 - theta) * r - rho) / theta + 0.5 * ((1 - theta) / theta ** 2) *( _lambda **2)
g = (1/A) * (math.exp(A * (D - (age[:] - start_age))) - 1)# equation (A11)
What I am trying to do is the following: for age I need a series of integers that goes from 20 to 79; for Y i need that for every value in age, for number smaller that 65 i need a 1 and for every number bigger or equal than 65 i need a 0. H, A and g are simply functions.
I find two problems: firstly, it doesn't allow me to works with values inside age, secondly, the loop for Y doesn't work.
I have tried many different variants of this code, but I always get mistakes and I think the problem is on how I have built age.
Can somebody help me please?
Aucun commentaire:
Enregistrer un commentaire