Group Abstract Group Abstract

Message Boards Message Boards

Tsunamis Program on Page 129, Mathematics Beyond Mathematica

Posted 8 years ago

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:
POSTED BY: Samuel Kohn
4 Replies
Posted 8 years ago

Alex

I am happy I asked you the question. Thank you.

I will forward your elegant solution to Guillermo so that he can improve his text.

Sam

POSTED BY: Samuel Kohn
Posted 8 years ago

Alexander

Thank 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

POSTED BY: Samuel Kohn
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard