| > | with(plots); |
Here is an animation for the first heat equation example in Ch10PartIV: both end points are held at 0 degrees while the metal rod is initially a uniform 10 degrees.
| > | animate(sum(40/(2*n-1)/Pi*sin((2*n-1)*Pi*x)*exp(-(2*n-1)^2*Pi^2*t) ,n=1..50), x=0..1,t=0..0.5,numpoints=1000,frames=100); |
![[Plot]](Images/Heat_1.gif)
Here is a crazy example. The initial temp is the function below defined using the piecewise command.
| > | f := x -> piecewise(x<.2, 0, x>=.2 and x<=.4 , -500*(x-0.2)*(x-0.4), x>0.4 and x<0.6, 0, x>=0.6 and x<=0.8, 4, x>0.8, 0); |
| > | plot(f(x),x=0..1); |
![[Plot]](Images/Heat_3.gif)
| > | c := n -> 2*int(sin(n*Pi*x)*f(x) ,x=0..1); |
| > | plot( sum( c(n)*sin(n*Pi*x), n=1..50 ) ,x=-1..1);
|
![[Plot]](Images/Heat_5.gif)
| > | animate(sum( c(n)*sin((n)*Pi*x)*exp(-(n^2*Pi^2*t)) ,n=1..50), x=0..1,t=0..0.2,numpoints=1000,frames=100); |
![[Plot]](Images/Heat_6.gif)
| > |
| > |
| > |