News:
Homework solutions 1-3 are online. 4-5 will be posted Tuesday afternoon.
- Homework is due at the beginning of class. Homework is due every
class. TTh sections turn in two homework sets on Tuesdays and one on Thursday.
- Discussing mathematics can be effective in learning, and we encourage
collaboration with other students for homework. We ask you however to
turn in your own copy and list names of collaborators if you should
have done a significant part of your homework in a group. Even if you
work with others, it is a good strategy to work on homework problems
first on your own. Honing your problem solving skills will have
enormous benefits also in other fields.
- Use words to explain your work, if it is necessary. Show your work.
- We follow the honor code.
Code for problem 4a). Find the value U[0.6.7]
f[x_]:=Sin[Pi 7x];
g[x_]:=5 Sin[5 Pi x];
U = NDSolveValue[
{D[u[t,x],{t,2}]-D[u[t,x],{x,2}]==0,
u[0,x]==f[x],
Derivative[1,0][u][0,x] == g[x],
DirichletCondition[u[t,x]==f[0],x==0],
DirichletCondition[u[t,x]==f[1],x==1]},
u,{t,0,1},{x,0,1}];
Animate[Plot[U[t,x],{x,0,1},
PlotRange->{-2,2}],{t,0,1}]
Plot[U[t,0.5], {t, 0, 1}]
Code for problem 4b) We want to see U[t,0.6,0.7]
A = Rectangle[{0, 0}, {1, 1}]; Clear[t, x, y];
f[x_, y_] := Sin[2 Pi x] Abs[Sin[3 Pi y]];
g[x_, y_] := 3 Sin[Pi x] Sin[Pi y];
U = NDSolveValue[{D[u[t, x, y], {t, 2}] -
Inactive[Laplacian][u[t, x, y], {x, y}] == 0,
u[0, x, y] == f[x, y], Derivative[1, 0, 0][u][0, x, y] == g[x, y],
DirichletCondition[u[t, x, y] == 0, True]},
u, {t, 0, 2 Pi}, {x, y} \[Element] A];
Plot3D[U[4, x, y], {x, 0, 1}, {y, 0, 1}]
Animate[ContourPlot[U[t, x, y], {x, 0, 1}, {y, 0, 1}], {t, 0, 2 Pi}]
Example code for problem 5:
f[t_,x_]:=(1/Sqrt[t])*Exp[-x^2/(4t)];
Simplify[ D[f[t,x],t] == D[f[t,x],{x,2}]]