Numerical integration: Difference between revisions
Content added Content deleted
(Add Swift) |
Artoria2e5 (talk | contribs) (→top: minor: format) |
||
Line 1: | Line 1: | ||
{{task|Arithmetic operations}} |
{{task|Arithmetic operations}} |
||
Write functions to calculate the definite integral of a function |
Write functions to calculate the definite integral of a function <big><big> {{math|1=''ƒ(x)''}} </big></big> using ''all'' five of the following methods: |
||
:* [[wp:Rectangle_method|rectangular]] |
|||
:** left |
|||
:** right |
|||
:** midpoint |
|||
:* [[wp:Trapezoidal_rule|trapezium]] |
|||
:* [[wp:Simpson%27s_rule|Simpson's]] (composite) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
Simpson's method is defined by the following pseudo-code: |
Simpson's method is defined by the following pseudo-code: |
||
Line 28: | Line 28: | ||
Demonstrate your function by showing the results for: |
Demonstrate your function by showing the results for: |
||
* |
* {{math|1=ƒ(x) = x<sup>3</sup>}}, where '''x''' is [0,1], with 100 approximations. The exact result is 1/4, or 0.25. |
||
* |
* {{math|1=ƒ(x) = 1/x}}, where '''x''' is [1,100], with 1,000 approximations. The exact result is the natural log of 100, or about 4.605170 |
||
* |
* {{math|1=ƒ(x) = x}}, where '''x''' is [0,5000], with 5,000,000 approximations. The exact result is 12,500,000. |
||
* |
* {{math|1=ƒ(x) = x}}, where '''x''' is [0,6000], with 6,000,000 approximations. The exact result is 18,000,000. |
||
⚫ | |||
⚫ | |||
'''See also''' |
'''See also''' |
||
* [[Active object]] for integrating a function of real time. |
* [[Active object]] for integrating a function of real time. |
||
* [[Numerical integration |
* [[Special:PrefixIndex/Numerical integration]] for other integration methods. |
||
<br><br> |
|||
⚫ | |||
=={{header|ActionScript}}== |
=={{header|ActionScript}}== |