Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10948
| From | Roland Franzius <roland.franzius@uos.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Could someone else verify that an example from the Numerical |
| Date | 2012-07-16 03:45 +0000 |
| Message-ID | <ju02oe$48k$1@smc.vnet.net> (permalink) |
| References | <jttv31$gut$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Am 15.07.2012 10:30, schrieb W Craig Carter:
> I am looking at the example on page 348 of the tutorial for a numerical solution to the Sine-Gordon equation.
> (http://www.wolfram.com/learningcenter/tutorialcollection/AdvancedNumericalDifferentialEquationSolvingInMathematica/).
> It doesn't work for me for M8.0.4, MacBook, MacOs 10.7.4. Can someone else verify that this doesn't work?
>
> Here is the example:
>
> L = 10; (*the tutorial has L=-10, but I think that is a typo. In any case, the example doesn't work with + or - *)
>
> state = First[NDSolve`ProcessEquations[{D[u[t, x, y], t, t] ==
> D[u[t, x, y], x, x] + D[u[t, x, y], y, y] - Sin[u[t, x, y]],
> u[0, x, y] == Exp[-(x^2 + y^2)],
> Derivative[1, 0, 0][u][0, x, y] == 0,
> u[t, -L, y] == u[t, L, y], u[t, x, -L] == u[t, x, L]}, u,
> t, {x, -L, L},
> {y, -L, L},
> Method -> {"MethodOfLines",
> "SpatialDiscretization" -> {"TensorProductGrid",
> "DifferenceOrder" -> "Pseudospectral"}}]]
>
> GraphicsGrid[Partition[Table[
> NDSolve`Iterate[state, tau];
> Plot3D[
> Evaluate[
> u[tau, x, y] /.
> NDSolve`ProcessSolutions[state, "Forward"]], {x, -L, L}, {y, -L,
> L}, PlotRange -> {-1/4, 1/4}],
> {tau, 0, 20, 5}], 2]]
The graphics constructs have changed in vs8 and I encounter an internal
error in the replacement procedure above resulting in empty solution
lists except the last element.
Consider the following alternative
(* you can skip the << lines *)
<<"DifferentialEquations`NDSolveProblems`";
<<"DifferentialEquations`NDSolveUtilities`";
<<"FunctionApproximations`";
L=10;
state=First@NDSolve`ProcessEquations[
{D[u[t,x,y],t,t]==D[u[t,x,y],x,x]+D[u[t,x,y],y,y]-Sin[u[t,x,y]],
u[0,x,y]==Exp[-(x^2+y^2)],
Derivative[1,0,0]u][0,x,y]==0,
u[t,-L,y]==u[t,L,y],
u[t,x,-L]==u[t,x,L]},
u,t,{x,-L,L},{y,-L,L},
Method->{
"MethodOfLines",
"SpatialDiscretization"->{"TensorProductGrid","DifferenceOrder"Ž"Pseudospectral"}}]
Generate the time table of the interpolation functions of solutions and
time derivatives
pl=Flatten@Table[(NDSolve`Iterate[state,t];NDSolve`ProcessSolutions[state,"Forward"]),{t,0.0,1.0,0.25}
]
Map the Plot3D into table of solutions u
Partition[Plot3D[#,{x,-10,10},{y,-10,10}]&/@
(Table[u[t,x,y],{t,0,1,0.25}]/.pl),2]
Hope it helps
--
Roland Franzius
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Could someone else verify that an example from the Numerical Solutions to Differential Equations isn't working. W Craig Carter <ccarter@MIT.EDU> - 2012-07-15 08:30 +0000 Re: Could someone else verify that an example from the Numerical Roland Franzius <roland.franzius@uos.de> - 2012-07-16 03:45 +0000 Re: Could someone else verify that an example from the Numerical "Nasser M. Abbasi" <nma@12000.org> - 2012-07-16 09:00 +0000 Re: Could someone else verify that an example from the Numerical W Craig Carter <ccarter@MIT.EDU> - 2012-07-17 05:32 +0000
csiph-web