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

How do I solve the pde:

$\ -s_x(x,t) -p(x,t)s_t(x,t)=p(x,t)$

for s(x,t) when p(x,t)=2x, subject to the condition s(0,t)=0?

Generally p(x,t) may not be analytical so I would like to use finite differences to transform this into a linear algebra problem:

$\ (-D_x-pD_t)s=p $ But how do I incorporate my "boundary" condition s(0,t)=0 into this?

Thanks in advance for any answers!

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

To find the solution you will also need an initial condition like $s(x,0)=\phi(x)$, $x\ge0$. Choose $\Delta x>0$ and $\Delta t>0$, and let $s_{j,k}\approx s(j\,\Delta x,k\,\Delta t)$, $p_{j,k}=p(j\,\Delta x,k\,\Delta t)$ for $j,k\ge0$. The initial condition is then $$s_{j,0}=\phi(j\,\Delta x),\quad j\ge0,$$ and the boundary condition $$s_{0,k}=0,\quad k\ge0.$$

The simplest finite difference approximation is $$ -\frac{s_{j+1,k}-s_{j,k}}{\Delta x}-p_{j,k}\,\frac{s_{j,k+1}-s_{j,k}}{\Delta t}=p_{j,k},\quad j,k\ge0. $$ If $p_{j,k}\ne0$for all $j,k\ge0$, then $$ s_{j,k+1}=\frac{1}{p_{j,k}}\frac{\Delta t}{\Delta x}(s_{j,k}-s_{j+1,k})-\Delta t,\quad j,k\ge0. $$

share|cite|improve this answer

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.