Group Abstract Group Abstract

Message Boards Message Boards

Solve an ODE using Runge-Kutta methods?

Hello All:

Hope everyone is doing well. I am attempting to create functions that use Runge-Kutta to solve an ODE. At the moment results are very close to exact solutions in a small example.

My question is in regards to the need of using "Evaluate Notebook" twice for getting good results after opening the notebook. Why is this happening(?)

Any advise is welcome!!! I highly appreciate your feedback letting me know my failures.

The attached file contains my attempts.

Attachments:
POSTED BY: Marcolino R-M
5 Replies

Professor Eisenberg:

Thanks again for taking the time to review my post. Attached a practice notebook with your guides. I am learning a lot from your insightful comments. Below are some notes from your post. Porting code from explicit to implicit iteration is beneficial and now I have a better understanding of it. Great leanings from you.

Thanks

Definition Of Function f:

[01] In f, argument x is used for non-homogeneous ODE or BVP.

[02] Defining f per your guidelines help clarify doubts on my side and makes its intent clear. Thanks!

Definition Of Function RK4:

[03] I realize the behavior of a variable, like k1, etc..., once an assignment occurs, hence impracticality for constant arrays. Thanks!

[04] It is clear your points on yn1. Thanks!

[05] It is clear also the comment on parameter m. Thanks!

[06] Great point on avoiding approximate use and how to maneuver with N. Thanks!

[07] Use of (**) is a habit that I should stop. Space helps. Thanks!

The Iteration: From Explicit Loop To Implicit Iteration

[08] The form you state RK4step is very clever and clear. Now I understand the type of changes. Thanks!

[09] The guides for stating NestList with RK4step is very clear. Looks like a controlled recursion. VERY HELPFUL. Thanks!

[10] Stating newRK4 gives new understanding on how to program. Thanks!

[11] Cleaning and customizing the output of lis is very helpful as well as insightful. I was expecting major difficulties. Thanks!

[12] The function nicerRK4 and RK4 are very compact and clear. Great learning from them. Thanks!

Printing A Nice Table Of Results:

[13] TableForm with RK4 does a straight job of showing results. Very useful. Thanks!

Further Refinements:

[14] Using f as argument to RK4step and RK4 is something that I am exploring. What would be the benefit(?)

[15] Input Checking is a good safeguard. Thanks for noting it.

Attachments:
POSTED BY: Marcolino R-M
POSTED BY: Murray Eisenberg
Attachments:
POSTED BY: Marcolino R-M
POSTED BY: Murray Eisenberg
POSTED BY: Murray Eisenberg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard