MathGroup Archive 2009

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

Search the Archive

Re: Integration of Interpolation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105916] Re: [mg105896] Integration of Interpolation
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Fri, 25 Dec 2009 00:34:47 -0500 (EST)
  • References: <200912240515.AAA25812@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

Integrate is a SYMBOLIC integrator; it can't integrate numerical  
interpolating functions.

You might use NIntegrate or NDSolve instead, but that would require p3 and  
p4 to have numerical values.

If they did, you could try solving for xP via

Clear[xP]
xP = xP /.
   First@NDSolve[{xP'[t] == qFC[t], xP[0] == 0}, xP, {t, 0, tMax}]

Bobby

On Wed, 23 Dec 2009 23:15:01 -0600, blamm64 <blamm64 at charter.net> wrote:

> Hi All,
>
> Well, my problem with NDSolve diagnosing delay differential algebraic
> equations where there are no explicit delay arguments is because I
> defined a "function of an InterpolatingFunction"; it never gets
> evaluated apparently because Integrate cannot deal with it unless the
> InterpolatingFunction is not "changed" in any way.
>
> Now, I searched the forums and found some posts regarding essentially
> what my post is titled, but I could only find instances where the user
> was basically trying to get rid of integrations of
> InterpolatingFunctions being tied to a particular argument, and what I
> want is just the precise reverse of that.
>
> I have an dataset I interpolate.  The independent argument is pressure
> difference.  I have a quantity tied to the integral of that function
> derived from the dataset.  The quantity is displacement and it is tied
> to time-dependent pressure difference "sent through" that function
> (volumetric flow rate as a function of pressure difference across it.
>
> I "played around" and came up with the following.  Please consider:
>
> Model
>
> fmodel[delp_]=30 (-(1/(delp+1)^3)+1);
>
> Data
>
> qdata = Table[{delp,fmodel[delp]},{delp,0,1000,1}]; (* note this is
> not actual data I have *)
>
> Interpolation
>
> qFConIN = Interpolation[qdata,InterpolationOrder->2];
>
> Interpolation with time dependent variables in the needed form p3[t] -
> p4[t] "pre-loaded"
>
> dp3p4 = p3[t]-p4[t];
>
> qFC[t_]=qFConIN[dp3p4]
> Out[5]= InterpolatingFunction[{{0,1000}},<>][p3[t]-p4[t]]
>
> Interpolation with time dependent variables "pre-loaded", but no
> independent argument (t) on l.h.s.
>
> qFCnoT=qFConIN[dp3p4]
> Out[6]= InterpolatingFunction[{{0,1000}},<>][p3[t]-p4[t]]
>
> Derivatives (zero and higher) work fine (see below after setting
> explicit, but dummy, p3[t] and p4[t])
>
> dfmodeldt=D[fmodel[dp3p4],t];
>
> dqFCdt=D[qFC[t],t]
> Out[8]= InterpolatingFunction[{{0,1000}},<>][p3[t]-p4[t]] (p3'[t]-
> (p4'[t])
>
> dqFCnoTdt=D[qFCnoT,t]
> Out[9]= InterpolatingFunction[{{0,1000}},<>][p3[t]-p4[t]] (p3'[t]-
> (p4'[t])
>
> Integration of Model
>
> xPfmodel[t_]=Integrate[fmodel[dp3p4],{s,0,t}];
>
> Intergration of "pre-loaded" interpolation (will FAIL)
> Next is what I wanted, but this is what is causing NDSolve to diagnose
> the diffeqs as delay (I have several functions of xP[t] as terms in
> the diffeqs, e.g. fDoor[xP[t]]*qFC[t]/areaPh ... where fDoor is a
> force as a function of displacement function ... qFC[t] gets evaluated
> just fine ... and qFC[t]/areaPh is a fluid velocity, and qFC[t] is the
> pre-defined regulation of that flow which in turn constrains the
> displacement xP[t] )
>
>
> xP[t_]=Integrate[qFC[s],{s,0,t}]
> The output here is Integralsign, limits 0 to t, InterpolatingFunction
> [{{0,1000}},<>][p3[s]-p4[s]] ds
>
> Now here's where it gets interestingly strange
> Even with strange leading t, this integration with "pre-loaded" time-
> dependent arguments (but no independent argument t on the
> interpolation function), apparently works (see below)
>
> xP2[t_]=Integrate[qFCnoT,{s,0,t}]
> Out[12]= t InterpolatingFunction[{{0,1000}},<>][p3[t]-p4[t]]
>
> Now define "dummy" pressures, as functions of time.  In actuality, p3
> [t] and p4[t] can vary according to the physics modeled by the diffeqs
> (they are two of five time dependent variables in my diffeqs).  All we
> need ensure here is their initial value difference is zero
>
> p3[t_]=30+4 t;
> p4[t_]=30;
>
> Derivatives work fine (a bit higher InterpolationOrder would make
> disparity less)
>
> N[{dqFCdt/.t->2,dqFCnoTdt/.t->2,D[fmodel[dp3p4],t]/.t->2},6]
> Out[15]= {0.0571875,0.0571875,0.0548697}
>
> Integral of model at p3[6] - p4[6]
>
> xPfmodel[6]
> Out[16]= 562464/3125
>
> APPARENTLY works
>
> In[17]:= xP2[6]
> Out[17]= 562464/3125
>
> FAILS
>
> xP[2]
> The output is Integralsign, limits 0 to 2, InterpolatingFunction
> [{{0,1000}},<>][4 s] ds
>
> Now, I tried several different models, and several different p3 and p4
> functions, and I always got agreement between xPfmodel and xP2.
>
> But that really does not *prove* anything.  My problem (one of them
> anyway) is I don't know enough Mathematica semantics to decide if xP2
> will always do what I need.  I never need the time derivative of xP
> since I already have it explicitly (qFC[t]).
>
> Can anyone enlighten me?  What I need to know is the *proper* way to
> get what I need done which is integrate and InterpolatingFunction,
> rather, a function of an InterpolatingFunction.  What is the *correct*
> way of getting what is represented by xP[t_] = Integrate[qFC[s], {s,
> 0,t}] (but obviously does not work)?
>
> Thanks,
> -Brian L.
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: solving equations
  • Next by Date: Manipulate Plot command - blank plot
  • Previous by thread: Integration of Interpolation
  • Next by thread: Re: Integration of Interpolation