ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 05 Feb 2015 02:48:29 -0600Using lists to create function to automate Runge-Kutta Methodhttps://ask.sagemath.org/question/25698/using-lists-to-create-function-to-automate-runge-kutta-method/I'm in a differential equations class in which we're expected to use computers to solve some of the problems. My professor uses Maple, but I'm choosing to use Sage because it won't cost me hundreds of dollars. I have a very limited CS background.
One part of our homework this week is to estimate the value of y(x_n) given dy/dx = f(x,y) and y(x_0) = y_0 using the Runge-Kutta Method. I know this shouldn't be that hard to do in Sage, but I'm having a hard time figuring this out. Any pointers? Tue, 03 Feb 2015 16:33:20 -0600https://ask.sagemath.org/question/25698/using-lists-to-create-function-to-automate-runge-kutta-method/Answer by tmonteil for <p>I'm in a differential equations class in which we're expected to use computers to solve some of the problems. My professor uses Maple, but I'm choosing to use Sage because it won't cost me hundreds of dollars. I have a very limited CS background.</p>
<p>One part of our homework this week is to estimate the value of y(x_n) given dy/dx = f(x,y) and y(x_0) = y_0 using the Runge-Kutta Method. I know this shouldn't be that hard to do in Sage, but I'm having a hard time figuring this out. Any pointers? </p>
https://ask.sagemath.org/question/25698/using-lists-to-create-function-to-automate-runge-kutta-method/?answer=25699#post-id-25699If you just need a solution, you can have a look at [this page](http://www.sagemath.org/doc/reference/calculus/sage/calculus/desolvers.html) and [that page](http://www.sagemath.org/doc/reference/calculus/sage/gsl/ode.html), methods and algorithms whose name contain `rk` are the one to look at. But perhaps is your homework about implementing the method by yourself ? In this case, it is impossible to provide you a programming lecture on this website, so you should have a look at some Python tutorial about lists and loops, try to implement the method, and possibly come back with more precise questions about problems you encountered in your implementation.
Tue, 03 Feb 2015 19:39:34 -0600https://ask.sagemath.org/question/25698/using-lists-to-create-function-to-automate-runge-kutta-method/?answer=25699#post-id-25699Comment by r.jay.hutchinson for <p>If you just need a solution, you can have a look at <a href="http://www.sagemath.org/doc/reference/calculus/sage/calculus/desolvers.html">this page</a> and <a href="http://www.sagemath.org/doc/reference/calculus/sage/gsl/ode.html">that page</a>, methods and algorithms whose name contain <code>rk</code> are the one to look at. But perhaps is your homework about implementing the method by yourself ? In this case, it is impossible to provide you a programming lecture on this website, so you should have a look at some Python tutorial about lists and loops, try to implement the method, and possibly come back with more precise questions about problems you encountered in your implementation.</p>
https://ask.sagemath.org/question/25698/using-lists-to-create-function-to-automate-runge-kutta-method/?comment=25706#post-id-25706I didn't realize that Sage had a built-in function for Runge-Kutta! And here I spent two hours trying to figure out how to make my own... Thank you!Wed, 04 Feb 2015 09:29:17 -0600https://ask.sagemath.org/question/25698/using-lists-to-create-function-to-automate-runge-kutta-method/?comment=25706#post-id-25706Comment by slelievre for <p>If you just need a solution, you can have a look at <a href="http://www.sagemath.org/doc/reference/calculus/sage/calculus/desolvers.html">this page</a> and <a href="http://www.sagemath.org/doc/reference/calculus/sage/gsl/ode.html">that page</a>, methods and algorithms whose name contain <code>rk</code> are the one to look at. But perhaps is your homework about implementing the method by yourself ? In this case, it is impossible to provide you a programming lecture on this website, so you should have a look at some Python tutorial about lists and loops, try to implement the method, and possibly come back with more precise questions about problems you encountered in your implementation.</p>
https://ask.sagemath.org/question/25698/using-lists-to-create-function-to-automate-runge-kutta-method/?comment=25730#post-id-25730@r.jay.hutchinson: you can accept @tmonteil's answer by clicking the tick mark at the top left of the answer. This will mark the answer as accepted and will mark the question as solved in the list of questions. Accepting answers that solve your problem makes Ask Sage more useful for everyone.Thu, 05 Feb 2015 02:48:29 -0600https://ask.sagemath.org/question/25698/using-lists-to-create-function-to-automate-runge-kutta-method/?comment=25730#post-id-25730