I wrote a program that solves a 4th order Runge-Kutta in Python 3.5 but I notice
ID: 3573314 • Letter: I
Question
I wrote a program that solves a 4th order Runge-Kutta in Python 3.5 but I noticed it is only accurate if I use multiple for loops which I don't understand.
So, after each computation I would make I would have to write a new for loop.
Why does it not work/is as accurate if I just do the following shown below?
When I run my program with the use of multiple for loops (1st example) it works perfectly, but when I run my program with only one nested loop, it is not accurate. Why do I need to use multiple for loops after each computation I make? Please explain this at a simple level. I have never used Python before and I have very little coding experience.
Accurate Code structure: For xva ue in ode: For index in interval: K1 (math computation) For index in interval: K2 math computation) For index in interval: K3 J. math computation) For index in interval Rest of program following this format Inaccurate Code structure For xva ue in ode: For index in interval: K1 math computation) K2 math computation) K3 -...(math) Rest of program