Re: Rule replacement doesn't work after NDSolve?
- To: mathgroup at smc.vnet.net
- Subject: [mg123992] Re: Rule replacement doesn't work after NDSolve?
- From: gac <g.crlsn at gmail.com>
- Date: Wed, 4 Jan 2012 05:03:29 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
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.
- Follow-Ups:
- Re: Rule replacement doesn't work after NDSolve?
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Rule replacement doesn't work after NDSolve?