Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'NDSolve cant solve simple PDE' topicStudent Support Forum > General > Archives > "NDSolve cant solve simple PDE"

Help | Reply To Topic
Author Comment/Response
02/22/09 9:38pm

MATHEMATICA can't solve this elementary diffusion problem:

current[x,t] = D[n[x,t],x]
D[current[x,t], x] = D[n[x,t],t]

n[x,0] = Sin[Pi x]
n[0,t] = 0
n[1,t] = 0

I asked it to solve this simply by:

NDSolve[{current[x,t] == D[n[x,t],x], D[current[x,t],x] == D[n[x,t],t], n[x,0] == Sin[Pi x], n[0,t] == 0, n[1, t] == 0}, {n,
current}, {x, 0, 1}, {t, 0, 1}]

and it gave me an error.

However, if I took the 1st equation (current[x,t] = D[n[x,t],x]) and plugged it in by hand into the second equation, and then asked mathematica to solve it...

NDSolve[{D[n[x,t],{x,2}] == D[n[x,t],t], n[x,0] == Sin[Pi x], n[0,t] == 0, n[1, t] == 0}, n, {x, 0, 1}, {t, 0, 1}] works. I get no error, that is, mathematica has no problem solving it.

But I should not have to solve anything by hand! Mathematica should have known to solve this system. Does anyone know how to have mathematica do it by itself, that is, solve the system of PDEs for functions of 2 variables as in the problem I presented? Why was I getting an error!

URL: ,
Help | Reply To Topic