MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9581] NDSolve
  • From: "N. Kinoshita" <nk204 at hermes.cam.ac.uk>
  • Date: Thu, 13 Nov 1997 01:40:42 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

I have a question about NDSolve.

I have three functions called 'kdot', lkdot' and 'lhdot'. They are
functions of 'k', 'lk' and 'lh'.

I define 'kdotfun', 'lkdotfun' and 'lhdotfun' which are functions only
of [k] by using:
   kdotfun=kdot/.{lk->lk[k],lh->lh[k]};
   lkdotfun=lkdot/.{lk->lk[k],lh->lh[k]};
   lhdotfun=lhdot/.{lk->lk[k],lh->lh[k]};

Now I do NDSolve which looks like

   kbgp=0.12;lkprime=-0.5;lhprime=-1;

  
solpolicy=NDSolve[{lk'[k]==If[k==kbgp,lkprime,Evaluate[lkdotfun/kdotfun]],
  
lh'[k]==If[k==kbgp,lhprime,Evaluate[lhdotfun/kdotfun]],lk[kbgp]==lkbgp,
   lk[kbgp]==lkbgp,lh[kbgp]==lhbgp},{lk,lh},{k,kbgp/2,kbgp*2}];
   lkpolicy=lk/.First[solpolicy];lhpolicy=lh/.First[solpolicy];

This works fine.
Then, I wanted to do the second integration.

   kdotfun2=kdot/.{k->k[t],lk->lkpolicy[k[t]],lh->lhpolicy[k[t]]};

   NDSolve[{k'[t]==kdotfun2,k[0]==kbgp/2},k,{t,0,10}]

This returns the message that 'Right hand side does not evaluate at
t=...' So, I tried wrapping 'kdotfun2' by Evaluate[kdotfun2]. Again,
'Right hand side does note evaluate at t=...'.  I aborted it after a
few seconds. This time I get a terribly long error message in the
message box and terribly long output which took a few minutes to
finish.

Could anybody suggest what went wrong and how to correctly integrate
'kdotfun2'? I really appreciate your attention.

By the way, what I am trying to do is called 'time elimination method',
which would be of great interest to economists who study economic
growth model.


Noriaki Kinoshita
University of Cambridge


P.S.   I just typed in all the commands by hand. I apologise if there
are  any errors.



  • Prev by Date: AxesOrigin and PlotRange
  • Next by Date: Loading Packages
  • Previous by thread: AxesOrigin and PlotRange
  • Next by thread: Re: Lists and subsets