       Re: Calculations with Interpolating Functions

• To: mathgroup at smc.vnet.net
• Subject: [mg88526] Re: Calculations with Interpolating Functions
• From: oshaughn <oshaughn at northwestern.edu>
• Date: Wed, 7 May 2008 07:09:42 -0400 (EDT)
• References: <fvpcqn\$mhn\$1@smc.vnet.net>

On May 6, 6:44 am, Jo=E3o Paulo Casquilho <j... at fct.unl.pt> wrote:
> Hi
>
> I obtain an Interpolating function as a solution of a differential equation
> with the command NDSolve, lets call it =93solution=94, which gives x(t). Next I
Your solution is of form
solution =    {x->InterpolatingFunction[...]}
The expression 'Integrate' performs a *symbolic, exact* integral,
which can be done on interpolating functions since their form is
known.  It cannot be done in general.
So try this:
xSol[t_] := (x[t]/.solution)
NIntegrate[ Sin[xSol[t]], {t,0, tmax}];

> want to use this solution for further calculations. With the commands
> =93result=Evaluate[x(t)/. First[solution]]=94 or =93result=  x(t)/.solution,
> {t,0,tmax}=94 I do the plot x(t) without any problems. Now, with version 5.2 I
> manage to integrate x(t) or linear functions of it.  But when I try to
> integrate non linear functions of x(t), like x(t)^2 or Sin[x(t)] (which is
> what I want),  Mathematica is unable to give a numerical result, all I get
> is an integral saying that there is an InterpolatingFunction in the
> integrand. With Mathematica 6 the linear integration does not work either.
>
> Any help would be appreciated.
>
> Best Regards
>
> Joao Paulo

• Prev by Date: Trouble computing conjugates
• Next by Date: Definite integral problem
• Previous by thread: Re: Calculations with Interpolating Functions
• Next by thread: Re: Calculations with Interpolating Functions