Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Area under a curve

  1. Nov 19, 2015 #1
    i want to calculate area under the curve but i do no not know what function does it satisfies. how should i proceed ?
  2. jcsd
  3. Nov 19, 2015 #2


    User Avatar

    Staff: Mentor

    I'm not sure what you are asking about. Do you have a known function f(x) which you want to integrate, and wonder how to do it numerically?
  4. Nov 19, 2015 #3
    no i don't know f(x) i just have x and y datapoints
  5. Nov 19, 2015 #4


    User Avatar

    Staff: Mentor

    Then you need to decide how to interpolate between the data points. Some possibilities:
    • Use the points to define "stair-steps" (a series of rectangles)
    • Construct straight lines between the points (a series of trapezoids)
    • Do a least-squares fit to a suitable type of function (polynomial, exponential, etc.)
    • Construct a spline curve that passes through all the points exactly.
  6. Nov 19, 2015 #5


    User Avatar
    Science Advisor

    The best you can do is:
    1. Sort the data points in ascending order in the xn
    2. The best approximation for the area between (xj, yj) and (xj+1, yj+1) is given by [itex]A_{j}=(x_{j+1}-x_{j})\cdot\frac{y_{j+1}+y_{j}}{2} [/itex] (this is called the trapezoid rule)
    3. Add up these areas.
  7. Nov 19, 2015 #6


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    If the x values of the data points occur at regular intervals, you can use a numerical integration technique like Simpson's Rule to perform the calculations. Simpson's Rules are based on using second- and third-order interpolation functions, which is usually more accurate than the simpler trapezoidal rule.

    You really should plot your data to see which method would give you the accuracy of result you desire.
  8. Nov 23, 2015 #7
    okay i will try all your suggestions.
    thank you for your help.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook