0
$\begingroup$

I have a quick question that I'm having a little trouble with, it seems simple enough but i just need a bit of clarification.

If I had a system of ode's and I was to choose the runge kutta 4 method to solve, then how would i go about obtaining the correct equation for $k_2$ if the original function $f(x_n, t_n) = \frac{dx}{dt}$ is a function of, say, $\theta$ (and not $x$ or $t$)?

E.g. if $\frac{dx}{dt} = \cosh(\theta) = f(x_n, t_n)$ then for $k_1$, Ii would use $k_1 = h f(x_n, t_n) = h(\cosh(\theta))$

but for $k_2$ the general equation is $k_2 = h f(x_n + \frac{k_1}{2}, t_n + \frac{h}{2})$ so would my desired equation for $k_2$ specific to my problem be:

$k_2 = h(\cosh(\theta)+\frac{k_1}{2})$

or

$k_2 = h(\cosh(\theta+\frac{k_1}{2})) $ ?

Thanks!

  • 0
    mathuser, people might be much more help$f$ul with your situation i$f$ you just post the "nonlinear coupled ODEs" that you have to begin with.2011-04-14

1 Answers 1

1

As Hans Lundmark says, you should use the same variable on both sides of the equation. If $\theta$ is a function of $x$ you should plug that in to get everything in terms of $x$. If $\theta =x$, you are just confusing yourself by using one on the left and one on the right. you are trying to integrate $\frac{dx}{dt}=\cosh(x)$, as you say $k_1=h\cosh(x)$ and $k_2=hf(x+\frac{k_1}{2})=h\cosh(x+\frac{k_1}{2})$

  • 0
    If you have $\frac{d\theta}{dt}=f(x,\frac{dx}{dt},t)$ and $\frac{dx}{dt}=(x,t)$ you have two integrations and need two sets of $k$'s, one for $x$ and one for $\theta$. Is that what you were asking?2011-04-13