I have four ordinary differential equation written in mathmatica : Simplify[DSolve[{y1'[x] == -0.162y1[x], y2'[x]=-0.148 y2[x]+ 0.055y1[x],y3'[x]==-0.134 y3[x]+ 0.033y1[x]+ 0.039y2[x],y4'[x]==-0.125y4[x]+0.021 y1[x]+0.025y2[x]+ 0.043y3[x], y1[0] == 100,y2[0]==4.76,y3[0]==69.7,y4[0]==0}, {y1[x], y2[x],y3[x],y4[x]}, x]] I am trying to write them in python I have try the following : def n1(y,x): s1 = 0.162131 dydx = -s1 * y return dydx def n2(y,x): s2 = 0.148234 s12= 0.0555877 dydx2 = -s2 * y + s12 * n1(y,x) return dydx2 def n3(y,x): s3 = 0.134337 s13= 0.0333526 s23= 0.0389114 dydx3 = -s3 * y + s13 * n1(y,x) + s23 * n2(y,x) return dydx3 def n4(y,x): s4= 0.125072 s14= …

Member Avatar
+0 forum 0

The End.