|
From: | Maverick |
Subject: | Solving 2nd degree differntial equatation |
Date: | Fri, 3 Jun 2016 11:21:16 -0700 (PDT) |
Hi i have a problem with following task. I need to implement Verlet method and RungeKutta and use it to calculate : x(t)''+k*sin(x(t))=0 with fixed k. And Verlet method is: v_{n+1/2}=v_{n}-h/2*k*sin(x(t)) x_{n+1}=x_{n}+h*v_{n+1/2} v_{n+1}=v_{n+1/2}-h/2*k*sin(x(t)) and v is x' The problem is that my Verlet gives different numbers than RungeKutta method(I think this one is correct as lsode() gives same answer). I post my implementation here: http://pastebin.com/iZ50BGMW <http://pastebin.com/iZ50BGMW> http://pastebin.com/EfPRmG3u <http://pastebin.com/EfPRmG3u> http://pastebin.com/gEHxKm2V <http://pastebin.com/gEHxKm2V> and in attchments: Verlet.m <http://octave.1599824.n4.nabble.com/file/n4677408/Verlet.m> RK4.m <http://octave.1599824.n4.nabble.com/file/n4677408/RK4.m> Project.m <http://octave.1599824.n4.nabble.com/file/n4677408/Project.m> -- View this message in context: http://octave.1599824.n4.nabble.com/Solving-2nd-degree-differntial-equatation-tp4677408.html Sent from the Octave - General mailing list archive at Nabble.com.
[Prev in Thread] | Current Thread | [Next in Thread] |