Jaydan Aguirre

Answered

2022-07-04

The problem is of the following form: $\frac{dr}{dt}$=$f(r)$, so $\frac{1}{f(r)}dr=dt$. My goal is to get some r(t) from this differential equation by numerically integrating this, that is, a value for r at every t. The conditions are $r(0)={r}_{0}$ and $r(\mathrm{\infty})=\mathrm{\infty}$. The problem I run into is that I am not quite sure what the limits would be to get such values for r(t). Any suggestions on where to go from this would be greatly appreciated, thanks.

Answer & Explanation

Sariah Glover

Expert

2022-07-05Added 16 answers

First of all, this is a first order problem, you do not get to fix two conditions, only one. Once you choose $r(0)={r}_{0}$, the solution is determined for all t and it may or may not satisfy $r(\mathrm{\infty})=\mathrm{\infty}$. The simplest method you can use is Euler's method: you choose equally spaced points ${t}_{0},{t}_{1}={t}_{0}+h,{t}_{2}={t}_{0}+2h,\cdots $ and build the sequence

$\{\begin{array}{l}{R}_{0}=r({t}_{0})={r}_{0}\\ {R}_{n+1}={R}_{n}+hf({R}_{n})\end{array}$

Naturally, ${R}_{i}$ will be the approximate value of $r({t}_{i})$. You may have to use very small h for precise results but it has the advantage of being very easy to implement. If you want more accurate methods, you may want to lookup Runge-Kutta methods.

In terms of the integral form of the equation this corresponds to say that

$r(t+h)=r(t)+{\int}_{t}^{t+h}f(r(s))\phantom{\rule{thinmathspace}{0ex}}ds\approx r(t)+hf(r(t)).$

$\{\begin{array}{l}{R}_{0}=r({t}_{0})={r}_{0}\\ {R}_{n+1}={R}_{n}+hf({R}_{n})\end{array}$

Naturally, ${R}_{i}$ will be the approximate value of $r({t}_{i})$. You may have to use very small h for precise results but it has the advantage of being very easy to implement. If you want more accurate methods, you may want to lookup Runge-Kutta methods.

In terms of the integral form of the equation this corresponds to say that

$r(t+h)=r(t)+{\int}_{t}^{t+h}f(r(s))\phantom{\rule{thinmathspace}{0ex}}ds\approx r(t)+hf(r(t)).$

Most Popular Questions