Re: Table to find lower and upper estimate
- To: mathgroup at smc.vnet.net
- Subject: [mg68188] Re: Table to find lower and upper estimate
- From: "Valeri Astanoff" <astanoff at yahoo.fr>
- Date: Sat, 29 Jul 2006 01:00:01 -0400 (EDT)
- References: <ea72lp$k6p$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
T Harris wrote:
> Hello,
>
>
>
> I hope someone could tell me where to look to or if easy enough, to advise
> me on how to use Mathemetica for the type of problem I have below. I
> already have worked it and have the lower estimate to be -475 and the upper
> estimate to be -85. I was hoping to put Mathematica to a practical use here
> and I really don't know how to do this. I have typed the problem in
> exactly as shown in James Stewart's, Calculus 5th Edition.
>
>
>
> Here it is:
>
> A table of values of an increasing function f is shown. Use the table to
> find lower and upper estimates for f(x) dx.
>
> x
> 0
> 5
> 10
> 15
> 20
> 25
>
> f(x)
> -42
> -37
> -25
> -6
> 15
> 36
>
>
>
>
> Thanks to anyone with advice.
>
>
> T Harris
Hello T.
It seems convenient to use Interpolation
with InterpolationOrder set to 0
(a flat interpolation):
In[1]:=xi={0,5,10,15,20,25};
yi={-42,-37,-25,-6,15,36};
In[3]:=upperdata=Transpose[{xi,yi}]
Out[3]={{0,-42},{5,-37},{10,-25},{15,-6},{20,15},{25,36}}
In[4]:=upper=Interpolation[upperdata,InterpolationOrder -> 0];
In[5]:=Integrate[upper[x],{x,0,25}]
Out[5]=-85
In[6]:=loweryi=Prepend[Most[yi],0]
Out[6]={0,-42,-37,-25,-6,15}
In[7]:=lowerdata=Transpose[{xi,loweryi}]
Out[7]={{0,0},{5,-42},{10,-37},{15,-25},{20,-6},{25,15}}
In[8]:=lower=Interpolation[lowerdata,InterpolationOrder -> 0];
In[9]:=Integrate[lower[x],{x,0,25}]
Out[9]=-475
hth
Valeri