0
$\begingroup$

How to make simple iteration in Mathematica for this three equations and save $q$ for each step. If we define $q'=dq/dx$, $q''=dq'/dx$ we have two equations

(1) $q''[j+1]=a_1(q[j+1]-q[j])-a_3q'[j]-a_5q''[j]$,

(2) $q'[j+1]=a_2(q[j+1]-q[j])+a_4q'[j]+a_6q''[j]$,

And we should substitute in third

(3) $q[j+1]=Q_2q[j]+Q_3q'[j]+Q_4q''[j]$

$a_i$ and $Q_k$ ($i=1,\ldots,6$; $k=1,2,3$) are functions of $\delta(x)$. Where $\delta(x)=0.01$ for example. For each $\delta(x)$ I need $q$.

Regards,

  • 0
    J.M. I wrote that ai and Qk are the function of the x I mean (delta x). This is not a Runge Kutta. habitmelon original differential equation is R1*q''(x)+R2*q'[x]+R3*q[x]=F(x), Ri contants, but I don`t want another method for solving. Just help about programing in mathematica for simple iteration which I wrote.2011-08-30

1 Answers 1

3

You can just use a For loop, following the manual. Equation 3 has no [j+1] on the right, so should be calculated first. Then equations 1 and 2 can be calculated as you already have q[j+1].

For[j=0,j
  • 0
    No, nothing. Here is the original file http://www.sendspace.com/file/xha9z02011-09-01