Unable to obtain value from interpolation function integration
- To: mathgroup at smc.vnet.net
- Subject: [mg59581] Unable to obtain value from interpolation function integration
- From: Alastair <ajr at ananzi.co.za>
- Date: Fri, 12 Aug 2005 03:37:58 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I'm a newbie so apologies if something similar has been asked before. I'm trying to solve the following coupled differential equations : y1'= -( λr+ λd)*y1 + λs*y2 + (1-UnitStep[t-86400]*4.04E17*f(t), y2' = λd*y1 - λs*y2, with f(t) = (0.0022 + 0.0086/(1 + t/3600) + 1.89E-7*t - 7.60E-12*t^2 + 1.72E-16*t^3 - 1.77E-21 t^4 + 6.27E-27*t^5) (The values of the constants are: λr = 7.31E-10, λd = 5.63E-8 and λs = 5e-7.) I have used NDSolve to solve the differential equation and obtained interpolation functions for y1[t] and y2[t] which Iâ??ve assigned to the variable â??solutionâ??. I am able to plot the interpolations functions. I can also obtain specific values of the interpolation function. However, when I integrate the interpolation function I am able to plot the resulting function but unable to obtain the values at specific values of t. The commands are used in my mathematica file, once I obtained the interpolation functions, are: Plot[Evaluate[(y1[t]* λr)V2*((DCFI*br + DCFE)) + (y2[t]*DCFG* λr)/PCUArea /. solution], {t, 0, 100000. }]) DInt[t_] := Integrate[(y1[t]* λr)V2*((DCFI*br + DCFE)) + (y2[t]*DCFG* λr)/PCUArea /. solution], t] (The values of the constants are: DCFI = 4.8E-6,DCFEA = 2.77E-11, DCFG = 2.85E-16) Plot[Evaluate[DInt[t]], {t,0,100000.}] y1[91800] /. solution N[DInt[90000.]] /. solution NIntegrate[y1[t] /. solution, {t, 90000, 91800}] Everything except the last two lines works. The second to last line gives the error: NIntegrate::inum Integrand y1[t] /. is not numerical at {t} = {90900.}. The last line gives the error: Integrate::ilim: Invalid integration variable or limit(s) in 90000.`.