# Tsunamis Program on Page 129, Mathematics Beyond Mathematica

Posted 6 months ago
728 Views
|
4 Replies
|
0 Total Likes
|
 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:
4 Replies
Sort By:
Posted 6 months ago
 Manipulate[Plot3D[Evaluate[u[t, x] /. Quiet[NDSolve[{ \!$$\*SuperscriptBox[\(u$$, TagBox[ RowBox[{"(", RowBox[{"2", ",", "0"}], ")"}], Derivative], MultilineFunction->None]\)[t, x] == d + c*u[t, x] + b*u[t, x]^2 + a*u[t, x]^3 + \!$$\*SuperscriptBox[\(u$$, TagBox[ RowBox[{"(", RowBox[{"0", ",", "2"}], ")"}], Derivative], MultilineFunction->None]\)[t, x], u[0, x] == E^-x^2, \!$$\*SuperscriptBox[\(u$$, TagBox[ RowBox[{"(", RowBox[{"1", ",", "0"}], ")"}], Derivative], MultilineFunction->None]\)[0, x] == 0, u[t, -x0] == u[t, x0]}, u, {t, 0, x0}, {x, -x0, x0}]]], {x, -x0, x0}, {t, 0, x0}, Mesh -> None, ColorFunction -> "Rainbow", MaxRecursion -> 2, PlotPoints -> 50], {{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}] `
Posted 6 months ago
 AlexanderThank you very much.Very nice.Would you mind if I forwarded your solution to Jose Guillermo Sanchez Leon with the idea that he can update his book Mathematica Beyond Mathematics?Since I am using this to learn and get some insight into Mathematica, I am curious why you did not include the Methods. ...I guess the answer may be that it is not necessary and just a distraction that is not needed.Sam Kohn