Message Boards Message Boards

0
|
4161 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

NDSolve bug: wrong answer

Posted 10 years ago

Please excuse me if the question has already been answered somewhere else, but I was not able to find it. Could somebody tell me what I am doing wrong here? The solution of DSolve is of course correct (u[t,x] = 5tx, u[1,10]/.sol = 50), but the one of NDSolve is going in the complete wrong direction (u[1,10]/.soln = -50). Why??? Do you get the same values when you run the code? Where did I write something wrong? This is really driving me nuts!

sol = DSolve[
{
 0 + D[u[t, x], {x, 2}] == 0
 , u[t, 0] == 0
 , (D[u[t, x], x] /. x -> 10) == 5*t
 }
, {u}
, {t, x}
][[1]];
u[1, 10] /. sol
(*50*)

soln = NDSolve[
{
 0 + D[u[t, x], {x, 2}] == 0
 , u[t, 0] == 0
 , (D[u[t, x], x] /. x -> 10) == 5*t
 }
, {u}
, {t, 0, 1}
, {x, 0, 10}
][[1]];
u[1, 10] /. soln
(*-50*)
POSTED BY: Mauricio Lobos
DSolve[{D[u[t, x], {x, 2}] == 0, 
  u[t, 0] == 0, (D[u[t, x], x] /. x -> 10) == 5 t}, u[t, x], {t, x}]

{{u[t, x] -> 5 t x}}
POSTED BY: S M Blinder
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract