MathGroup Archive 2012

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

Search the Archive

TimeValue around NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127743] TimeValue around NDSolve
  • From: Joe <design at rcn.com>
  • Date: Sat, 18 Aug 2012 03:44:23 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

(*  #1  This expression works.   I am trying to get the Present Value using a variable discountRate for each value in this table. *)
age = 65;
eqn1 = y'[t] == 4.7/100 *y[t] - 5300;
sol1 = y[t] /. NDSolve[{eqn1, y[age] == 100000}, y[t], {t, age, 110}];
Table[sol1, {t, age, 85}]

(*  #2  This attempt fails  *)
Manipulate[
 age = 65;
 eqn1 = y'[t] == 4.7/100 *y[t] - 5300;
 sol2 = TimeValue[y[t] /. { NDSolve[{eqn1, y[age] == 100000}, y[t], {t, age, 110}]}, discountRate/100, 0];
 Table[sol2, {t, age, 85}],
  {{discountRate, 1.6, "Discount Rate"}, .8, 3, .1,Appearance -> {"Labeled", Tiny}}
]

(*  #3  In the complete applet, this method calculates the PV correctly on opening but does not respond to the discountRate slider and eventually causes an error *)
Manipulate[
 age = 65;
 eqn1 = y'[t] == 4.7/100 *y[t] - 5300;
 sol2 = y[t] /. NDSolve[{eqn1, y[age] == 100000}, y[t], {t, age, 110}];
 Table[TimeValue[sol2, discountRate/100, 0], {t, age, 85}],
   {{discountRate, 1.6, "Discount Rate"}, .8, 3, .1, Appearance -> {"Labeled", Tiny}}
]

I hope this is a better description of the problem than I provided several days ago.  

Joe Rimback
design at rcn.com
Gaithersburg, MD



  • Prev by Date: Inconsistent behavior of RegionFunction in ContourPlot and ListContourPlot
  • Next by Date: Re: Using a huge list of random numbers from random.org
  • Previous by thread: Re: Inconsistent behavior of RegionFunction in ContourPlot and ListContourPlot
  • Next by thread: Re: TimeValue around NDSolve