ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 06 Sep 2016 23:18:07 +0200How to solve ODE y'' - 4y' + y - x = 0 using rk4?https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/ How to solve ODE y''+y''-4y'+x = 0 using rk4?Tue, 06 Sep 2016 03:29:59 +0200https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/Comment by tmonteil for <p>How to solve ODE y''+y''-4y'+x = 0 using rk4?</p>
https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/?comment=34745#post-id-34745This looks like homework. If you want some help, you should ask more precise questions related to your research in solving those exercises, especially where you are locked.Tue, 06 Sep 2016 09:32:07 +0200https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/?comment=34745#post-id-34745Answer by jmarcellopereira for <p>How to solve ODE y''+y''-4y'+x = 0 using rk4?</p>
https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/?answer=34751#post-id-34751I tryed
# w = y''
# z = y'
var('x, w, z')
desolve_system_rk4( [w , 4*z + x] , [w,z] , ics = [0,1,0], ivar = x, end_points = 10, step = 0.1)
But does no work correty :(Tue, 06 Sep 2016 19:08:22 +0200https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/?answer=34751#post-id-34751Answer by tmonteil for <p>How to solve ODE y''+y''-4y'+x = 0 using rk4?</p>
https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/?answer=34744#post-id-34744The doc is here http://doc.sagemath.org/html/en/reference/calculus/sage/calculus/desolvers.htmlTue, 06 Sep 2016 09:31:29 +0200https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/?answer=34744#post-id-34744Comment by jmarcellopereira for <p>The doc is here <a href="http://doc.sagemath.org/html/en/reference/calculus/sage/calculus/desolvers.html">http://doc.sagemath.org/html/en/refer...</a></p>
https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/?comment=34757#post-id-34757I got a way to solve the differential equation. If wrong please correct;)
To solve this differential equation we must first make a variable substitution to reduce the differential equation for a first order and thus create a system of ODEs. variable change:
w1 = y
w2 = y
w3 = y '
Thus, deriving the above variables, we have a system of equations of the form:
w1 '= w2
w2 '= f (x, w1, w2) = 4 * w2 + x
desolve_system_rk4([w2, 4*w2 + x ],[w1 , w2], ics = [0,1,0],ivar = x, step = 0.1, end_points = 2)Tue, 06 Sep 2016 23:18:07 +0200https://ask.sagemath.org/question/34741/how-to-solve-ode-y-4y-y-x-0-using-rk4/?comment=34757#post-id-34757