The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Re: [mg7943] Area under Curve
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Andrei Constantinescu

Posts: 32
Registered: 12/7/04
Re: [mg7943] Area under Curve
Posted: Jul 30, 1997 2:34 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Fri, 25 Jul 1997, Sankar Baruah wrote:

> I am new to Mathematica and would really appreciate some pointers from
> experienced users. I have a 2 variable data set of about 50
> observations. I want to plot each obseravtion and calculate the area
> under the curve. How do I do this in Mathematica ?
> Are there examples in the Mathematica Book and/or are there separate
> application notes etc. available ?
> Thanks.
> Sankar.

Hi Sankar,

there is no need to be experienced to solve this problem.
You have many solutions to do this (take also a look at the Mma books):

1. your data is really: {..., {xi, f[xi]}, ... }

- try ListIntegrate
- try an Interpolation + Integration
- write a simple Trapez system as the one below.

2. you data is {..., {xi,yi}, ... } - a closed curve.

- I do not know the function but, the following
simple function functioned pretty well:

Cint[ data_ ] := Module[{mylist,intg},
imax = Length[data];
mylist = Append[ data, data[[1]] ];
intg = 0;
Do[ intg += 0.25 (mylist[[i,2]] + mylist[[i+1,2]])
(mylist[[i+1,1]] - mylist[[i,1]]);
intg += - 0.25 (mylist[[i,1]] + mylist[[i+1,1]])
(mylist[[i+1,2]] - mylist[[i,2]])
, {i,imax} ];
Print[ intg / 4524., " [MJ /m^3]"]

a + andrei

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.