Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7562

Re: Rule replacement doesn't work after NDSolve?

From gac <g.crlsn@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Rule replacement doesn't work after NDSolve?
Date 2012-01-04 10:05 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <je18a2$3c9$1@smc.vnet.net> (permalink)

Show all headers | View raw


Thanks very much for the reply.  Your suggestion works as you say, but I'm still confused.  I thought that the replacement is for the function, not the arguments.

> rules must be applied before the arguments are set
> (as is done in the
> plots).
> 

Why, then, does this work? 

sol2 = NDSolve[{y'[t] == 1/x[t]^2, x'[t] == 1/y[t], x[0] == 1, y[0] == 1}, {x, y}, {t, 0, 1}]
y[0.5] /. sol2
x[0.5] /. sol2

One difference I see is that the output in the PDE case has the arguments z,t on the lhs:

{Subscript[x, 1][z,t]->InterpolatingFunction[{{0.,20.},{0.,10.}},<>][t,z],...

But the output in the ODE case does not have the argument on the lhs:

{x->InterpolatingFunction[{{0.,1.}},<>],...

And, if it's a matter of the order of operations, why does this statement also work for the ODE case:

y[t] /. sol2 /. {t -> 0.5}

There's an important difference between the way NDSolve returns in the PDE case and in the ODE case.  I'd like to better understand the difference.

Thanks again for the solution.

Regards.

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: Rule replacement doesn't work after NDSolve? gac <g.crlsn@gmail.com> - 2012-01-04 10:05 +0000
  Re: Rule replacement doesn't work after NDSolve? A Retey <awnl@gmx-topmail.de> - 2012-01-05 11:01 +0000

csiph-web