I'm learning to handle the output of pdsolve. It is a module and I'm quite new to that. The objective is to plot the solution for different values of, say, time t, in a fairly systematic way. I'll consign here my progress for reference. Feel free to comment if you have suggestions.

 sol := pdsolve
  ( diff(u(x, t), t) = (1/10)*(diff(u(x, t), x, x))
  , {u(0, t) = 0, u(x, 0) = 1, (D[1](u))(1, t) = 0}
  , numeric
  );
My first attempt was to combine seq and sol:-plot. My initial impression was that it wasn't working, so I looked for other ways. It turns out that it does work. Here:
seq( sol:-plot( t = i ), i=0..2 );

I didn't think that was good initially. But actually, it does work if you further wrap it with plots:-display:

plots:-display(seq( sol:-plot( t = i ), i=0..2 )); 

It is obvious, but so often I miss the obvious. And since it took me a few minutes to realize that I had actually managed to do what I wanted, I explored alternatives. This does not work:

sol:-plot( t = [1,2] );

it would have been intuitive and simple but sol:-plot doesn't take a list of values. I'm not sure if the use of the tilde here would help.

I also tried a loop, which works too:

for i from 1 to 2 by 1/2 do
  p[i]:=sol:-plot(t = i):
  pp:=[p[i]]:
end do:

but like seq, one mustn't forget to wrap it all with a plots:-display();


Please Wait...