[Date Index]
[Thread Index]
[Author Index]
Re: Calculus and InterpolatingFunction
*To*: mathgroup at smc.vnet.net
*Subject*: [mg121622] Re: Calculus and InterpolatingFunction
*From*: Richard Hofler <rhofler at bus.ucf.edu>
*Date*: Thu, 22 Sep 2011 07:27:33 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*References*: <201109210933.FAA13140@smc.vnet.net>
Hello,
One straightforward solution is to transform the values in the list that you call data.
(* display the list for comparison later *)
data=RandomReal[#]*2&/@Range[1,10]
(* display the new list to confirm that it is correctly transformed *)
newdata=Flatten[(1+#)&/@data]
g=Interpolation[newdata];
Integrate[g[x],{x,1,10}]
{0.293708,2.9835,1.05602,5.14945,2.92964,6.02907,13.5116,5.89785,8.41953,11.2031}
{1.29371,3.9835,2.05602,6.14945,3.92964,7.02907,14.5116,6.89785,9.41953,12.2031}
61.7534
Richard
-----Original Message-----
From: Just A Stranger [mailto:forpeopleidontknow at gmail.com]
Sent: Wednesday, September 21, 2011 5:33 AM
To: mathgroup at smc.vnet.net
Subject: [mg121622] Calculus and InterpolatingFunction
I'm trying to get a definite integral for an InterpolatingFunction. It works if it is the function by itself, but not for some reason arithmetically combining the InterpolatingFunction with another function makes it not return a value. e.g.
In[1]:=
data = RandomReal[#]*2 & /@ Range[1, 10]; f = Interpolation[data];
> Integrate[f[x], {x, 1, 10}]
Out[1]:=40.098
So far so good. But just a little bit of arithmetic in the integral and it doesn't work anymore:
In[2]:=
Integrate[f[x]+1, {x, 1, 10}]
Out[2]:=
Integrate[Plus[1, InterpolatingFunction[][x]], List[x, 1, 10]]
(That last answer was actually the output with //FullForm applied) Why won't it give me a numerical evaluation? Is there anyway to make a continuous function from data that will seemlessly work with Integrate? I'm thinking of constructing a piecwise function using Fit, Piecwise, and a Table for the arguments to Piecewise. But I would think Interpolation might have worked and been easier. I want to figure out if I am I doing something wrong with Interpolation before I start trying to tackle a slightly more complicated piecewise defined function ?
Prev by Date:
**Re: passing Indeterminate and Infinity to C via MathLink**
Next by Date:
**Re: Getting list of cities of Puerto Rico using Wolfram**
Previous by thread:
**Re: Calculus and InterpolatingFunction**
Next by thread:
**Re: Calculus and InterpolatingFunction**
| |