Simple C Program For Trapezoidal Rule

Jan 26, 2016  How to create a 3D Terrain with Google Maps and height maps in Photoshop - 3D Map Generator Terrain - Duration: 20:32. Orange Box Ceo 1,069,853 views.

  1. Multiple Application Trapezoidal Rule
  2. Simple C Program For Trapezoidal Ruler
  3. Trapezoidal Rule Calculator Wolfram
2.00
Maths › Calculus › Quadrature ›
Computes the definite integral of a function using the trapezoidal rule.
Controller: CodeCogs
Contents

Interface

Excel

Multiple Application Trapezoidal Rule


Overview

This module computes the area beneath either a user supplied function or a set of discrete points, using an approximation which assumes the function is linear between each two consecutive points.Consider a two times differentiable function , two distinct abscissas and a positive integer . Then the following approximation holds:with an error bound of:This is a quadrature formula known as the trapezoidal rule. From the formula of the error bound you may notice that e.g. if one doubles the number of points , the approximation error is decreased four times. To better understand how this rule works, observe the following picture - the area between abscissas and is approximated by a trapezoid.Below you will find examples that show how to use each version of the function and the error estimates in each case.

References:

  • Mihai Postolache - 'Metode Numerice', Editura Sirius
  • Mathworld, http://mathworld.wolfram.com/TrapezoidalRule.html

Authors

Lucian Bentea (September 2006)

Trapezoidal

doubletrapezoidal( intn
double(*f)(double)[function pointer]
doublea
doubleb )
This version is to be used when you wish to pass the function to integrate as an argument, instead of passing an array with its values at distinct points.

Example 1

In what follows an approximation is found for the definite integraland the absolute error from its actual value is estimated.

Output

Parameters

nthe number of sample points of the function f, from which to approximate
fthe function to integrate
athe inferior limit of integration
bthe superior limit of integration
For

Returns

The definite integral of the given function from a to b.
Source Code

Source code is available when you buy a Commercial licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.


Trapezoidal

doubletrapezoidal( intn
const double*values
doublea
doubleb )
This version is to be used when the function is not known analytically, but a table with its values at equally spaced abscissas is available.

Example 2

The code below gives an approximation for the definite integraland estimates the absolute error from its actual value.

Output

Parameters

nthe number of sample points of the function f, from which to approximate
valuesan array with the values of the function at equally spaced abscissas
athe inferior limit of integration
bthe superior limit of integration

Returns

The definite integral of the given function from a to b.
Source Code

Source code is available when you buy a Commercial licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

Simple C Program For Trapezoidal Ruler

Matlab trapezoidal rule

Trapezoidal Rule Calculator Wolfram