Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to solve three equations which are of the form shown below numerically:

$\frac{\partial v}{\partial t}=f(v,y)$

$\frac{\partial}{\partial t}\left(vy\right)=f(v,y,z)$

$\frac{\partial}{\partial t}\left(vy^{2}\right)+\frac{\partial}{\partial t}\left(z\right)=f(v,y,z)$

where $v$, $y$ and $z$ are all functions of time ($t$) and space ($x$).

I know the initial values of the variables. I am desperate to know which numerical method to use to solve them. I was thinking of explicit Euler but I think that would not be possible due to the non-linearity cause by the $y^2$ term. I will be coding in Matlab. Would I need to linearize the equation and how?

Thanks very much.

share|cite|improve this question
up vote 2 down vote accepted

I will use $v'$, $y'$, $z'$ for the derivatives with respect to time, and $f$ for $f(v,y,z)$. We would like to reformulate this system to give us explicit expressions for these derivatives.

The first equation remains unchanged: $$v' = f.$$

Apply the product rule in the second equation and eliminate the $v'$ term using the first equation and rearrange terms: $$y' = \frac{f}{v} - \frac{fy}{v}.$$

Apply the product rule in the third equation, eliminate $v'$, $y'$ using the first two equations and rearrange: $$z' = -f -fy^2 +2f^2y.$$

These equations can now be solved by one of many methods. Explicit Euler is a poor choice; it has stability issues and large error. I suggest using one of MatLab's built in solvers. You can find the details of the implementation on their website.

share|cite|improve this answer
Thanks very much. Just to check something I have done previously, if I was to solve the first two equations (without any $z$), without applying the product rule, using explicit Euler, could I just solve the first equation for $v$ and the second equation for $vy$ and then divide $vy$ by the old $v$ to get the new $y$? – Hooman May 14 '12 at 8:34
Yeah, that sounds like it should work. It's equivalent to solving: $v' = f(v,Y/v)$ and $Y' = f(v,Y/v)$ with $Y = vy$. – in_wolframAlpha_we_trust May 14 '12 at 8:41
Thanks again. Another concern I had was that the third equation is non-linear and hence it would need to be linearized first somehow. I was told to look into methods such as predictor-corrector and so treat the $y^2$ in left hand side of the third equation as:$y^{n+1}y^{n}$ to find $y$ at an intermediate time step and then correct its result to find the new $y$. I am a bit confused by that really. – Hooman May 15 '12 at 8:05
The built in solvers I linked to can handle the non-linearity without a problem. If you prefer a less "black-box" approach to numerical analysis you can have a look at this page… which explains a very simple predictor-corrector method. There isn't really space to explain the entire field of numerical analysis in this comment box, so I recommend you pick up "A First Course in Numerical Analysis" by A. Iserles. – in_wolframAlpha_we_trust May 15 '12 at 11:47
Also, you've asked six questions and had four of them answered. I suggest that you accept some of those answers if they have helped you. To accept an answer click on the check mark beneath the upvote/downvote arrows next to the answer. – in_wolframAlpha_we_trust May 15 '12 at 11:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.