Difference between revisions of "Integral"
Line 35:  Line 35:  
The symbol chosen for this operator is the Integral Sign (<apl><_sg/></apl>), entered from the keyboard as Alt’S’ or AltShift's' (U+222B), and used in mathematics for Integration.  The symbol chosen for this operator is the Integral Sign (<apl><_sg/></apl>), entered from the keyboard as Alt’S’ or AltShift's' (U+222B), and used in mathematics for Integration.  
+  
+  ==Applications==  
+  
+  There are many, many applications of Numerical Integration. Here are but a few taken from [https://www.whitman.edu Whitman College]'s Mathematics Department's Calculus Online course:  
+  
+  <ol>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.01.html Area between curves]</li>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.02.html Distance, Velocity, Acceleration]</li>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.03.html Volume]</li>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.04.html Average value of a function]</li>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.05.html Work]</li>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.06.html Center of Mass]</li>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.07.html Kinetic energy; improper integrals]</li>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.08.html Probability]</li>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.09.html Arc Length]</li>  
+  <li>[https://www.whitman.edu/mathematics/calculus_online/section09.10.html Surface Area]</li>  
+  </ol>  
+  
+  and more taken from the website [https://www.intmath.com Interactive Mathematics]:  
+  
+  <ol>  
+  <li>[https://www.intmath.com/applicationsintegration/1appsindefiniteintegral.php Applications of the Indefinite Integral]</li>  
+  <li>[https://www.intmath.com/applicationsintegration/2areaundercurve.php Area Under a Curve by Integration]</li>  
+  <li>[https://www.intmath.com/applicationsintegration/3areabetweencurves.php Area Between 2 Curves using Integration]</li>  
+  <li>[https://www.intmath.com/applicationsintegration/4volumesolidrevolution.php Volume of Solid of Revolution by Integration]</li>  
+  <li>[https://www.intmath.com/applicationsintegration/shellmethodvolumesolidrevolution.php Shell Method: Volume of Solid of Revolution]</li>  
+  <li>[https://www.intmath.com/applicationsintegration/5centroidarea.php Centroid of an Area by Integration]</li>  
+  <li>[https://www.intmath.com/applicationsintegration/6momentsinertia.php Moments of Inertia by Integration]</li>  
+  <li>[https://www.intmath.com/applicationsintegration/7workvariableforce.php Work by a Variable Force using Integration]</a></li>  
+  <li>[https://www.intmath.com/applicationsintegration/8electriccharges.php Electric Charges by Integration]</li>  
+  <li>[https://www.intmath.com/applicationsintegration/9averagevaluefunction.php Average Value of a Function by Integration]</li>  
+  <li>[https://www.intmath.com/applicationsintegration/10forceliquid.php Force Due to Liquid Pressure by Integration]</a></li>  
+  <li>[https://www.intmath.com/applicationsintegration/11arclengthcurve.php Arc Length of a Curve using Integration]</a></li>  
+  <li>[https://www.intmath.com/applicationsintegration/12arclengthcurveparametricpolar.php Arc Length of Curve: Parametric, Polar Coordinates]</a></li>  
+  </ol>  
==Variants==  ==Variants== 
Revision as of 03:21, 20 January 2020


L is an optional Real numeric singleton which represents the lower bound of the definite Integral. If it is omitted, 0 is used.  
R is a Real numeric singleton which represents the upper bound of the definite Integral.  
f is an arbitrary monadic function whose argument and result are both Real numeric singletons. 
Contents
Introduction
TBD
Notation
The symbol chosen for this operator is the Integral Sign (∫), entered from the keyboard as Alt’S’ or AltShift's' (U+222B), and used in mathematics for Integration.
Applications
There are many, many applications of Numerical Integration. Here are but a few taken from Whitman College's Mathematics Department's Calculus Online course:
 Area between curves
 Distance, Velocity, Acceleration
 Volume
 Average value of a function
 Work
 Center of Mass
 Kinetic energy; improper integrals
 Probability
 Arc Length
 Surface Area
and more taken from the website Interactive Mathematics:
 Applications of the Indefinite Integral
 Area Under a Curve by Integration
 Area Between 2 Curves using Integration
 Volume of Solid of Revolution by Integration
 Shell Method: Volume of Solid of Revolution
 Centroid of an Area by Integration
 Moments of Inertia by Integration
 Work by a Variable Force using Integration</a>
 Electric Charges by Integration
 Average Value of a Function by Integration
 Force Due to Liquid Pressure by Integration</a>
 Arc Length of a Curve using Integration</a>
 Arc Length of Curve: Parametric, Polar Coordinates</a>
Variants
There are several different algorithms that may be used for Numerical Integration, two of which are GaussLegendre and NewtonCotes. The default algorithm is GaussLegendre, however, the faster but less accurate NewtonCotes algorithm may be selected via the Variant operator as in
⎕FPC←128 {1+1○⍵}∫⍠'g' ○2x ⍝ GaussLegendre 6.28318530717958647692528676655900576839 {1+1○⍵}∫⍠'n' ○2x ⍝ NewtonCotes 6.28318530717958647692528676655900580189 ○2x ⍝ Exact answer 6.28318530717958647692528676655900576839
The Order of the Numerical Integration (the number of rectangles used to approximate the result) is, by default, 128 for the GaussLegendre algorithm, and 64 for NewtonCotes. That number may be changed via the Variant operator as in
N←17x ⎕PP←60 ⋄ ⎕FPC←512 {÷1+⍵*2}∫⍠'g' N 1.51204050407917392632913838918797965663103904910367167450076 {÷1+⍵*2}∫⍠('g' 150) N 1.51204050407917392632913838918797965662193427820023884786854 {÷1+⍵*2}∫⍠('g' 170) N 1.51204050407917392632913838918797965662193428158710682038154 ¯3○N ⍝ Exact answer 1.51204050407917392632913838918797965662193428158710826434397
Examples
For example,
The Integral of {⍵*2} is {(⍵*3)÷3}, and so the Integral of that function from 0 to 1 is ÷3:
⎕FPC←128 {⍵*2}∫1 0.333333333333333333333333333333333333334
The Integral of the 1+Sine function from 0 to ○2 is ○2:
{1+1○⍵}∫○2x ⋄ ○2x 6.28318530717958647692528676655900576839 6.28318530717958647692528676655900576839
and the Integral of the Sine function from 0 to ○2 is (essentially) 0
{1○⍵}∫○2x ¯5.12499200004882449667902954237053816394E¯40
A Normal Distribution is defined as nd←{(*¯0.5×⍵*2)÷√○2x}. Integrating it over the entire width from ¯∞ to ∞ yields an answer of 1 (the area under the curve). However, this Integration code doesn't handle infinities as yet, so instead we integrate the function over 20 standard deviations on either side with more rectangles used in the approximation to yield a number within rounding error of the correct answer:
¯20 nd∫⍠150 20 1.00000000000000000000000000000000000002
Integrating this same function for one, two, and three standard deviations on either side yields the 3sigma rule of :
⍪¯1 ¯2 ¯3 nd∫¨ 1 2 3 0.682689492137085897170465091264075844955 ⍝ 68% 0.954499736103641585599434725666933125056 ⍝ 95% 0.997300203936739810946696370464810045244 ⍝ 99.7%
which describes about how many of the values in a normal distribution lie within one, two, and three standard deviations from the mean.
Numerical Differentiation
Note that Derivative, the inverse of this operator, has also been implemented.
Acknowledgements
This feature is entirely based on Laurent Fousse's Numerical Integration code written in MPFR as described in this paper.