Re: Delayed Evaluation of NDSolve Arguments
- To: mathgroup at smc.vnet.net
- Subject: [mg62973] Re: Delayed Evaluation of NDSolve Arguments
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Fri, 9 Dec 2005 06:19:42 -0500 (EST)
- Organization: Uni Leipzig
- References: <dnbmas$5ks$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
f[t_?NumericQ] := 1;
sol = NDSolve[{x'[t] == f[t], x[0] == 0}, x[t],
{t, 0, 1}];
Plot[Evaluate[x[t] /. sol[[1]]], {t, 0, 1}]
Regards
Jens
"ben" <benjamin.friedrich at gmail.com> schrieb im
Newsbeitrag news:dnbmas$5ks$1 at smc.vnet.net...
| Dear All,
|
| is there a way to prevent NDSolve to evaluate
its arguments
| right on the spot?
|
| Inside my differential equation
|
| x'[t]=F[x[t],t,f[x[t],t]],
|
| I want to use a function f[x,t] which
| makes only sense, when called with
| numeric arguments.
| So everything would be fine, if NDSolve
| would evaluate the differential equation
| at each time step.
| However, the differential equation is only
| evaluated once at the beginning, and
| then only numerical values are plugged
| into the evaluated equation at each time step.
|
| Below is a baby example of my problem
|
| f[t_]:=If[NumericQ[t],1,0];
|
| sol=NDSolve[{x'[t]==f[t],x[0]==0},x[t],{t,0,1}];
|
| x[t]/.sol[[1]]
| 0.
| (* I want x[t]=t ! *)
|
| Any help would be appreciated
| Benjamin
|