Need help with an Algebra calculation
I have written a program to calculate the area under a curve, using the area of a trapezium rule. As there are two values that vary and not one, the integration rule wont work. So I want to work out each trapezium's area and then sum them.
I have set up two arrays, x and y. The user enters the values into x and then y. Now i need to make the calculation using the following rule, using i as the current value:
This gives the area for each trapezium. Then I need to sum them all together to give a total area and thus the area under a curve.
P.S. the area of a trapezium:
Area = (interval width * positive difference in heights)/2
Can anyone help me with the for statements to do this please?