@MATTHEWBECHTEL I'm beginning to think I haven't. Here are the relevant parts of the program. It's a numerical solution to Lotka-volterra equations, using Euler.

@MATTHEWBECHTEL It's just some first order differential equations, and Euler is a numerical method of solving them. F and t are defined arrays. The error implies that the program doesn't understand the print command. If something was undefined, wouldn't that generate another error, like "undefined blabla" ?

Hi everyone.

I get "invalid syntax" on this:

for i in range(1, n)

print (t[i], F[i])

..where t, F and n of course are defined. Why the error message?

Did you define them correctly?

@MATTHEWBECHTEL I'm beginning to think I haven't. Here are the relevant parts of the program. It's a numerical solution to Lotka-volterra equations, using Euler.

n=200

dt=(tf-t0)/(n-1) #tidssteg

t=np.linspace(t0, tf, n) #tidsarray

R=np.zeros([n]) #Skapa array för kaniner och rävar

F=np.zeros([n])

R[0]=R0

F[0]=F0

for i in range(1,n):

R[i]=R[i-1]+dt

(k1R[i-1]-k2R[i-1]F[i-1])F[i]=F[i-1]+dt

(-k3F[i-1]+k4R[i-1]F[i-1]for i in range(n):

print (t[i], F[i])

I don’t know what Lotka-volterra equations or [email protected] is. And yeah, you should probably define those variables.

@MATTHEWBECHTEL It's just some first order differential equations, and Euler is a numerical method of solving them. F and t are defined arrays. The error implies that the program doesn't understand the print command. If something was undefined, wouldn't that generate another error, like "undefined blabla" ?

Um sure. Ok. @GustavW