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
    But what is $\theta$ then? The equation $dx/dt = \cosh \theta$ doesn't make sense unless you tell us what $\theta$ is, and if it's related to $x$ or $t$ somehow. (If $\theta$ is just a parameter, then the right-hand side of the ODE can be seen as a constant, and the solution is $x(t)=x(0)+t \cosh \theta$; no need to use Runge-Kutta for that.) :)2011-04-13
  • 0
    hi, sorry for not being too clear, but i have a system of non-linear coupled ode's, so, say d(theta)/dt = dx/dt. Does that help?2011-04-13
  • 0
    Erhm, not really... So $\theta=x$ then?!?2011-04-13
  • 0
    lol, sorry, i'm just using a very, very bad example, i don't want a specific answer, i just wanted to know the procedure for calculating the rk4 algorithm when the function f(x,t) is a function of another parameter which in turn is a function of x and t.2011-04-13
  • 0
    mathuser, people might be much more helpful with your situation if you just post the "nonlinear coupled ODEs" that you have to begin with.2011-04-14

1 Answers 1