help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Solving 2nd degree differntial equatation


From: Juan Pablo Carbajal
Subject: Re: Solving 2nd degree differntial equatation
Date: Sat, 4 Jun 2016 11:43:54 +0200

On Fri, Jun 3, 2016 at 8:21 PM, Maverick <address@hidden> wrote:
> 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.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave

Yes, different schemes give different results. Compare with the exact
solution or check they convergence when you make the time stepp really
small



reply via email to

[Prev in Thread] Current Thread [Next in Thread]