I suspect there may be a mistake when Guillermo puts in his code D[u[t,x],t]==0/.t[RightArrow]0 since the equation above is [PartialD]u(0,x)/ [PartialD]t==0 and not [PartialD]u(t,x)/ [PartialD]t==0. Please let me know if you agree or disagree.
Also I cannot get the program copied from his text to work.
Please help
Attached is the workbook which contains my copying of the program (p.129) from his book and a version that I cut and pasted from his book with some corrections to the errors caused by cutting and pasting.
Sam Kohn
Clear["Global`*"]
Manipulate[
Plot3D [Evaluate[
u[t, x] /.
Quiet[NDSolve[
Evaluate[{D[u[t, x], t, t] ==
D[u[t, x], x, x] + a u[t, x]^3 + b u[t, x]^2 + c u[t, x] + d,
u[0, x] == e^-x^2, D[u[t, x], t] == 0, u[t, -x0] == u[t, x0]}],
u, {t, 0, x0}, {x, -x0, x0},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"DifferenceOrder" -> "Pseudospectral", "MinStepSize" -> 0.2}}]]],
{x, -x0, x0}, {t, 0, x0}, MeshFunctions -> {#3 &},
Mesh -> None,
ColorFunction -> "Rainbow",
PlotPoints -> 20,
MaxRecursion -> 1],
{{a, -0.3}, -4, 0}, {{b, -0.6}, -4, 0}, {{c, 0.8}, -4, 1}, {{d, 0}, -1,
1}, {{x0, 16, "Solution Range"}, 5, 20}, ControlPlacement -> Left,
ContentSize -> {400, 300}]
4.2 .5 Tsunamis We can model very complex natural phenomena.The \
following demonstration simulates a tsunami using the following system of \ partial differential equations : ([PartialD]2 u (t, x) /[PartialD]t2) == (([PartialD]2 u (t, x) /[PartialD]x2) + au (t, x) 3 + bu (t, x) 2 + cu (t, x) + d), with u (0, x) == e^-(x^2), [PartialD]u (t, x)/ [PartialD]t == 0, u (t, -x0) == u (t, x0) (http : // mathworld.wolfram.com/news/2005 - 01 - 14/tsunamis)
\[FilledSmallSquare]We solve it with NDSolve using a, b, c, d,
x0 as parameters.We can show dynamically the behavior of the system by \
modifying the parameter values.
Manipulate[
Plot3D[Evaluate[
u[t, x] /.
Quiet[NDSolve[
Evaluate[{D[u[t, x], t, t] ==
D[u[t, x], x, x] + au[t, x]^3 + bu[t, x]^2 + cu[t, x] + d,
u[0, x] ==
e^(-x^2, D[u[t, x], t] == 0 /. t \[RightArrow] 0,
u[t, -x0] == u[t, x0]}], u, {t, 0, x0}, {x, -x0, x0},
Method \[RightArrow] {"MethodOfLines",
"SpatialDiscretization" \[RightArrow] {"TensorProductGrid",
"DifferenceOrder" \[RightArrow] "Pseudospectral",
"MinStepSize" \[RightArrow] 0.2}}]]], {x, -x0, x0}, {t, 0, x0},
MeshFunctions \[RightArrow] {#3 &}, Mesh \[RightArrow] None,
ColorFunction \[RightArrow] "Rainbow", PlotPoints \[RightArrow] 20,
MaxRecursion \[RightArrow] 1], {{a, -0.3}, -4, 0}, {{b, -0.6}, 4,
0}, {{c, 0.8}, -4, 1}, {{d, 0}, -1, 1}, {{x0, 16, "Solution Range"}, 5, 20},
ControlPlacement \[RightArrow] Left, ContentSize \[RightArrow] {400, 300}]
What is right above was copied and pasted from the book by Guillermo. I think I made all the corrections caused by cut and paste errors. I also think there may be a mistake when Guillermo puts in his code D[u[t,x],t]==0/.t[RightArrow]0 since the equation above is [PartialD]u(0,x)/ [PartialD]t==0 and not [PartialD]u(t,x)/ [PartialD]t==0. Please let me know if you agree or disagree.
Attachments: