Integral: Difference between revisions

From NARS2000
Jump to navigationJump to search
 
(10 intermediate revisions by the same user not shown)
Line 25: Line 25:
==Introduction==
==Introduction==


TBD
According to [https://en.wikipedia.org/wiki/Numerical_integration Wikipedia], "In analysis, '''numerical integration''' comprises a broad family of algorithms for calculating the numerical value of a definite integral".
<br />
<br />
<br />
 


This implementation uses several different algorithms to achieve this as well as extends these algorithms to Infinite and Left and Right semi-infinite intervals.


==Notation==
==Notation==


The symbol chosen for this operator is the Integral Sign (<apl><_sg/></apl>), entered from the keyboard as Alt-’S’ or Alt-Shift-'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 Alt-Shift-'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/applications-integration/1-apps-indefinite-integral.php Applications of the Indefinite Integral]</li>
  <li>[https://www.intmath.com/applications-integration/2-area-under-curve.php Area Under a Curve by Integration]</li>
  <li>[https://www.intmath.com/applications-integration/3-area-between-curves.php Area Between 2 Curves using Integration]</li>
  <li>[https://www.intmath.com/applications-integration/4-volume-solid-revolution.php Volume of Solid of Revolution by Integration]</li>
  <li>[https://www.intmath.com/applications-integration/shell-method-volume-solid-revolution.php Shell Method: Volume of Solid of Revolution]</li>
  <li>[https://www.intmath.com/applications-integration/5-centroid-area.php Centroid of an Area by Integration]</li>
  <li>[https://www.intmath.com/applications-integration/6-moments-inertia.php Moments of Inertia by Integration]</li>
  <li>[https://www.intmath.com/applications-integration/7-work-variable-force.php Work by a Variable Force using Integration]</a></li>
  <li>[https://www.intmath.com/applications-integration/8-electric-charges.php Electric Charges by Integration]</li>
  <li>[https://www.intmath.com/applications-integration/9-average-value-function.php Average Value of a Function by Integration]</li>
  <li>[https://www.intmath.com/applications-integration/10-force-liquid.php Force Due to Liquid Pressure by Integration]</a></li>
  <li>[https://www.intmath.com/applications-integration/11-arc-length-curve.php Arc Length of a Curve using Integration]</a></li>
  <li>[https://www.intmath.com/applications-integration/12-arc-length-curve-parametric-polar.php Arc Length of Curve: Parametric, Polar Coordinates]</a></li>
</ol>


==Variants==
==Variants==


There are several different algorithms that may be used for Numerical Integration, two of which are [https://en.wikipedia.org/wiki/Gaussian_quadrature Gauss-Legendre] and [https://en.wikipedia.org/wiki/Newton%E2%80%93Cotes_formulas Newton-Cotes]. The default algorithm is Gauss-Legendre, however, the faster but less accurate Newton-Cotes algorithm may be selected via the Variant operator as in
There are several different algorithms that may be used for Numerical Integration; the main (and default) one is based upon the Tanh-Sinh Quadrature code in David H. Bailey's [https://www.davidhbailey.com/dhbsoftware/arprec-2.2.18.tar.gz ARPREC] package.  Other algorithms include [https://en.wikipedia.org/wiki/Gaussian_quadrature Gauss-Legendre] and [https://en.wikipedia.org/wiki/Newton%E2%80%93Cotes_formulas Newton-Cotes] taken from Laurent Fousse's CRQ (Correctly Rounded Quadrature) [https://github.com/lfousse/crq Numerical Integration] code written in MPFR as described in [https://tel.archives-ouvertes.fr/tel-00477243/document this paper].  These algorithm may be selected via the Variant operator as in


<apll><pre>
<apll><pre>
       ⎕FPC←128
       ⎕FPC←128
       {1+1○⍵}∫⍠'g' ○2<_x/>  ⍝ Gauss-Legendre
       {1+1○⍵}<_sg/>⍠'g' ○2<_x/>  ⍝ Gauss-Legendre
6.2831853071795864769252867665590057683<_mark>9</_mark>  
6.2831853071795864769252867665590057683<_mark>9</_mark>  
       {1+1○⍵}∫⍠'n' ○2<_x/>  ⍝ Newton-Cotes
       {1+1○⍵}<_sg/>⍠'n' ○2<_x/>  ⍝ Newton-Cotes
6.2831853071795864769252867665<_mark>5</_mark>899537749
6.283185307179586476925286766559005<_mark>7</_mark>1385
       ○2<_x/>    ⍝ Exact answer
       ○2<_x/>    ⍝ Exact answer
6.28318530717958647692528676655900576839
6.28318530717958647692528676655900576839
</pre></apll>
</pre></apll>


The Order of the Numerical Integration (the number of rectangles used to approximate the result) is, by default, <apll>100</apll>.  That number may be changed via the Variant operator as in
The Order of the Numerical Integration (the number of rectangles used to approximate the result) is, by default, <apll>128</apll> for the Gauss-Legendre algorithm, and <apll>32</apll> for Newton-Cotes.  That number may be changed via the Variant operator as in


<apll><pre>
<apll><pre>
       N←17<_x/>
       N←17<_x/>
       {÷1+⍵*2}∫⍠'g' N
      ⎕PP←60 ⋄ ⎕FPC←512
1.5120405040<_mark>7</_mark>629183188001289665203330309
       {÷1+⍵*2}<_sg/>⍠'g' N
       {÷1+⍵*2}∫⍠('g' 60) N
1.5120405040791739263291383891879796566219342815871082643439<_mark>7</_mark>
1.5120405040791739<_mark>2</_mark>727026418786910512212
       {÷1+⍵*2}<_sg/>'n' N
      {÷1+⍵*2}∫⍠('g' 70) N
1.512040504079173926329138<_mark>3</_mark>4207540700696171248671126465236073
1.512040504079173926<_mark>3</_mark>3179507126314397112
       {÷1+⍵*2}<_sg/>⍠('n' 64) N
       {÷1+⍵*2}∫⍠('g' 80) N
1.51204050407917392632913838918797965662193428158<_mark>7</_mark>22152948792
1.512040504079173926329<_mark>1</_mark>42042030891168
       {÷1+⍵*2}<_sg/>⍠('n' 96) N
       {÷1+⍵*2}∫⍠('g' 90) N
1.5120405040791739263291383891879796566219342815871082643439<_mark>7</_mark>
1.512040504079173926329138<_mark>3</_mark>9289394666393
       ¯3○N    ⍝ Exact answer
       ¯3○N    ⍝ Exact answer
1.51204050407917392632913838918797965662
1.51204050407917392632913838918797965662193428158710826434397
</pre></apll>
</pre></apll>
<p>There are additional choices for algorithms such as</p>
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<tr>
  <th align="left">Algorithm</th>
  <th align="left">Syntax</th>
  <th align="left">Source</th>
</tr>
<tr>
  <td>Gauss-Legendre</td>
  <td><apll><_sg/>⍠'G'</apll></td>
  <td>David H. Bailey's ARPREC ARPREC C++ code</td>
</tr>
<tr>
  <td>Error Function</td>
  <td><apll><_sg/>⍠'E'</apll></td>
  <td>David H. Bailey's ARPREC ARPREC C++ code</td>
</tr>
<tr>
  <td>Tanh-Sinh</td>
  <td><apll><_sg/>⍠'T'</apll></td>
  <td>David H. Bailey's ARPREC ARPREC C++ code</td>
</tr>
<tr>
  <td valign="top">Tanh-Sinh</td>
  <td valign="top"><apll><_sg/>⍠'t'</apll> and <apll><_sg/></apll></td>
  <td valign="top">David H. Bailey's ARPREC ARPREC C++ code<br/>translated to C &mdash; it is the default algorithm</td>
</tr>
<tr>
  <td>Gauss-Legendre</td>
  <td><apll><_sg/>⍠'g'</apll></td>
  <td>Laurent Fousse's CRQ code</td>
</tr>
<tr>
  <td>Newton-Cotes</td>
  <td><apll><_sg/>⍠'n'</apll></td>
  <td>Laurent Fousse's CRQ code</td>
</tr>
<tr>
  <td>Tanh-Sinh</td>
  <td><apll><_sg/>⍠'d'</apll></td>
  <td>Graeme Dennes Excel Spreadsheet code</td>
</tr>
</table>
<br/>
==Default Algorithm==
<p>When the Variant operator is applied to the default algorithm, the first number is used to replace the exponent <apll>N=8</apll> in the calculation of the outer loop limit: <apll>12×2*N</apll>.  Increasing this value (as in <apll><_sg/>⍠N</apll>) provides greater precision at the cost of performance.  Additionally, two levels of precision (and via another calculation, Comparison Tolerance) are used in this algorithm, one for certain internal values (e.g., abscissa and weights) and the other for more precise calculations (twice the first precision).  By default, the precision for less precise calculations is the current value of <apll>⎕FPC</apll>.  The Comparison Tolerance values are expressed as negative integers to a power of <apll>10</apll> as in <apll>10*-1+⌊⎕FPC×10⍟2</apll>.  It may be changed for any particular calculation by supplying a second numeric argument to the Variant operator as in <apll><_sg/>⍠(N1 N2)</apll>, where the first number is a positive integer used as the loop limit exponent and the second number is the negative integer power of <apll>10</apll>, i.e. it replaces <apll>-1+⌊⎕FPC×10⍟2</apll> in the above statement.</p>
<p>Not all of these additional algorithm's may be supported in future versions.</p>


==Examples==
==Examples==


For example,
The formula for the [https://en.wikipedia.org/wiki/Parabola#Similarity_to_the_unit_parabola Unit Parabola] is <apll>{⍵*2}</apll> whose Integral is <apll>{1<_r/>3×⍵*3}</apll>, and so the Integral of the Unit Parabola from <apll>-a</apll> to <apll>a</apll> is <apll>-/{1<_r/>3×⍵*3}a,-a ←→ 2<_r/>3×a*3</apll>:
 
<apll><pre>
      ⎕FPC←128
      a←2 ⋄ (-a){⍵*2}<_sg/>a
5.33333333333333333333333333333333333334
      2<_r/>3×a*3
16<_r/>3    ⍝ ←→ 5.33333333333333333333333333333333333333333333333333333333333
</pre></apll>
 
This may be used to calculate the [https://en.wikipedia.org/wiki/Parabola#Area_enclosed_between_a_parabola_and_a_chord Area Enclosed Between a Parabola and a Chord], the formula for which is two-thirds of the area of the surrounding rectangle of the chord, the line tangent to the Vertex, and the two sides <apll>x=-a</apll> and <apll>x=a</apll>.


The Integral of <apll>{⍵*2}</apll> is <apll>{(⍵*3)÷3}</apll>, and so the Integral of that function from <apll>0</apll> to <apll>1</apll> is <apll>÷3</apll>:
Because the Unit Parabola curves upward and away from the X-axis, the above Integral returns the area under (i.e. below and outside) the Parabola.  In this case, because we're Integrating from <apll>-a</apll> to <apll>a</apll>, the chord is the line <apll>y={⍵*2} a ←→ y=a*2</apll>.  The top of the rectangle (chord) is of length <apll>a--a ←→ 2×a</apll> and of height <apll>y ←→ a*2</apll>, whose area is <apll>(2×a)×a*2 ←→ 2×a*3</apll>.  Subtracting the result of the Integral from the rectangle's area and multiplying this by two-thirds yields the area enclosed between a chord and a Parabola.


<apll><pre>
<apll><pre>
       ⎕FPC←128
       2<_r/>3×(2×a*3)-(-a){⍵*2}<_sg/>a
      {⍵*2}∫1
7.1111111111111111111111111111111111111
0.333333333333333333333333333333333333334   
</pre></apll>
</pre></apll>


Line 83: Line 182:


<apll><pre>
<apll><pre>
       {1+1○⍵}∫○2<_x/> ⋄ ○2<_x/>
       {1+1○⍵}<_sg/>○2<_x/> ⋄ ○2<_x/>
6.28318530717958647692528676655900576839
6.283185307179586476925286766559005768<_mark>3</_mark>4
6.28318530717958647692528676655900576839
6.28318530717958647692528676655900576839
</pre></apll>
</pre></apll>
Line 91: Line 190:


<apll><pre>
<apll><pre>
       {1○⍵}∫○2<_x/>
       {1○⍵}<_sg/>○2<_x/>
¯5.12499200004882449667902954237053816394<_E/>¯40
6.69453502284549420282962009846618284241<_E/>¯42
</pre></apll>
</pre></apll>


A [https://en.wikipedia.org/wiki/Normal_distribution Normal Distribution] is defined as <apll>nd←{(*¯0.5×⍵*2)÷√○2<_x/>}</apll>.  Integrating it over the entire width from <apll>¯∞</apll> to <apll>∞</apll> yields an answer of <apll>1</apll> (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:
A [https://en.wikipedia.org/wiki/Normal_distribution Normal Distribution] is defined as <apll>nd←{(*¯0.5×⍵*2<_x/>)÷√○2<_x/>}</apll>.  Because this instance of the algorithm is scaled properly, integrating it over the entire width from <apll>¯∞</apll> to <apll>∞</apll> yields an answer of <apll>1</apll> (the area under the curve):


<apll><pre>
<apll><pre>
       ¯20 nd∫⍠150 20
       ¯∞ nd<_sg/> ∞
1.00000000000000000000000000000000000002
1
</pre></apll>
</pre></apll>


Line 105: Line 204:


<apll><pre>
<apll><pre>
       ⍪¯1 ¯2 ¯3 nd∫¨ 1 2 3
       ⍪¯1 ¯2 ¯3 nd<_sg/>¨ 1 2 3
0.682689492137085897170465091264075844955   ⍝ 68%
0.682689492137085897170465091264075844958   ⍝ 68%
0.954499736103641585599434725666933125056   ⍝ 95%
0.954499736103641585599434725666933125059   ⍝ 95%
0.997300203936739810946696370464810045244    ⍝ 99.7%
0.997300203936739810946696370464810045244    ⍝ 99.7%
</pre></apll>
</pre></apll>
Line 115: Line 214:
==Numerical Differentiation==
==Numerical Differentiation==


Note that [[Derivative]], the inverse of this operator, has also been implemented.
Note that [[Derivative]], the inverse of this operator, has also been implemented. These two features may be combined in various ways, for example, to calculate [https://en.wikipedia.org/wiki/Arc_length#Finding_arc_lengths_by_integrating Arc Length].
 
The formula for Arc Length is simply <apll>arclen←{4○⍺⍺∂⍵}</apll> which can be used on any given function.  For example, the upper half of a unit circle is represented by the function <apll>{0○⍵}</apll>.  The interval <apll>[-√0.5, √0.5]</apll> is then a quarter of a circle, whose length is


==Acknowledgements==
<apll><pre>
      ⎕FPC←512 ⋄ ⎕PP←60
      (-√0.5<_x/>){0○⍵}arclen<_sg/>√0.5<_x/>
1.5707963267948966192313216916397514420985846996875529104874<_mark>7</_mark>
      ○0.5<_x/>    ⍝ Exact length = 1<_r/>2<_pi/>1
1.57079632679489661923132169163975144209858469968755291048747</pre></apll>


This feature is entirely based on Laurent Fousse's [https://github.com/lfousse/crq Numerical Integration] code written in MPFR as described in [https://tel.archives-ouvertes.fr/tel-00477243/document this paper].
The arc length of the Unit Parabola from <apll>0</apll> to <apll>1</apll> is
 
<apll><pre>
      {⍵*2}{4○⍺⍺∂⍵}∫1
1.4789428575445974338279060194339144350716974305950082518812<_mark>1</_mark>
      (1<_r/>2×(√5<_r/>16)÷1<_r/>4)+1<_r/>4×⍟(1<_r/>2+√5<_r/>16)÷1<_r/>4      ⍝ Exact length (from Wikipedia, "Parabola#Arc_length")
1.47894285754459743382790601943391443507169743059500825188121
</pre></apll>

Latest revision as of 15:04, 29 August 2021

Z←{L} f R returns the definite Integral of the function f between the points L and R.
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.

Introduction

According to Wikipedia, "In analysis, numerical integration comprises a broad family of algorithms for calculating the numerical value of a definite integral".

This implementation uses several different algorithms to achieve this as well as extends these algorithms to Infinite and Left and Right semi-infinite intervals.

Notation

The symbol chosen for this operator is the Integral Sign (), entered from the keyboard as Alt-’S’ or Alt-Shift-'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:

  1. Area between curves
  2. Distance, Velocity, Acceleration
  3. Volume
  4. Average value of a function
  5. Work
  6. Center of Mass
  7. Kinetic energy; improper integrals
  8. Probability
  9. Arc Length
  10. Surface Area

and more taken from the website Interactive Mathematics:

  1. Applications of the Indefinite Integral
  2. Area Under a Curve by Integration
  3. Area Between 2 Curves using Integration
  4. Volume of Solid of Revolution by Integration
  5. Shell Method: Volume of Solid of Revolution
  6. Centroid of an Area by Integration
  7. Moments of Inertia by Integration
  8. Work by a Variable Force using Integration</a>
  9. Electric Charges by Integration
  10. Average Value of a Function by Integration
  11. Force Due to Liquid Pressure by Integration</a>
  12. Arc Length of a Curve using Integration</a>
  13. Arc Length of Curve: Parametric, Polar Coordinates</a>

Variants

There are several different algorithms that may be used for Numerical Integration; the main (and default) one is based upon the Tanh-Sinh Quadrature code in David H. Bailey's ARPREC package. Other algorithms include Gauss-Legendre and Newton-Cotes taken from Laurent Fousse's CRQ (Correctly Rounded Quadrature) Numerical Integration code written in MPFR as described in this paper. These algorithm may be selected via the Variant operator as in

      ⎕FPC←128
      {1+1○⍵}⍠'g' ○2x  ⍝ Gauss-Legendre
6.28318530717958647692528676655900576839 
      {1+1○⍵}⍠'n' ○2x  ⍝ Newton-Cotes
6.28318530717958647692528676655900571385
      ○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 Gauss-Legendre algorithm, and 32 for Newton-Cotes. That number may be changed via the Variant operator as in

      N←17x
      ⎕PP←60 ⋄ ⎕FPC←512
      {÷1+⍵*2}⍠'g' N
1.51204050407917392632913838918797965662193428158710826434397
      {÷1+⍵*2}⍠'n' N
1.51204050407917392632913834207540700696171248671126465236073
      {÷1+⍵*2}⍠('n' 64) N
1.51204050407917392632913838918797965662193428158722152948792
      {÷1+⍵*2}⍠('n' 96) N
1.51204050407917392632913838918797965662193428158710826434397
      ¯3○N    ⍝ Exact answer
1.51204050407917392632913838918797965662193428158710826434397 

There are additional choices for algorithms such as

Algorithm Syntax Source
Gauss-Legendre ⍠'G' David H. Bailey's ARPREC ARPREC C++ code
Error Function ⍠'E' David H. Bailey's ARPREC ARPREC C++ code
Tanh-Sinh ⍠'T' David H. Bailey's ARPREC ARPREC C++ code
Tanh-Sinh ⍠'t' and David H. Bailey's ARPREC ARPREC C++ code
translated to C — it is the default algorithm
Gauss-Legendre ⍠'g' Laurent Fousse's CRQ code
Newton-Cotes ⍠'n' Laurent Fousse's CRQ code
Tanh-Sinh ⍠'d' Graeme Dennes Excel Spreadsheet code


Default Algorithm

When the Variant operator is applied to the default algorithm, the first number is used to replace the exponent N=8 in the calculation of the outer loop limit: 12×2*N. Increasing this value (as in ⍠N) provides greater precision at the cost of performance. Additionally, two levels of precision (and via another calculation, Comparison Tolerance) are used in this algorithm, one for certain internal values (e.g., abscissa and weights) and the other for more precise calculations (twice the first precision). By default, the precision for less precise calculations is the current value of ⎕FPC. The Comparison Tolerance values are expressed as negative integers to a power of 10 as in 10*-1+⌊⎕FPC×10⍟2. It may be changed for any particular calculation by supplying a second numeric argument to the Variant operator as in ⍠(N1 N2), where the first number is a positive integer used as the loop limit exponent and the second number is the negative integer power of 10, i.e. it replaces -1+⌊⎕FPC×10⍟2 in the above statement.

Not all of these additional algorithm's may be supported in future versions.

Examples

The formula for the Unit Parabola is {⍵*2} whose Integral is {1r3×⍵*3}, and so the Integral of the Unit Parabola from -a to a is -/{1r3×⍵*3}a,-a ←→ 2r3×a*3:

      ⎕FPC←128
      a←2 ⋄ (-a){⍵*2}a
5.33333333333333333333333333333333333334
      2r3×a*3
16r3     ⍝ ←→ 5.33333333333333333333333333333333333333333333333333333333333

This may be used to calculate the Area Enclosed Between a Parabola and a Chord, the formula for which is two-thirds of the area of the surrounding rectangle of the chord, the line tangent to the Vertex, and the two sides x=-a and x=a.

Because the Unit Parabola curves upward and away from the X-axis, the above Integral returns the area under (i.e. below and outside) the Parabola. In this case, because we're Integrating from -a to a, the chord is the line y={⍵*2} a ←→ y=a*2. The top of the rectangle (chord) is of length a--a ←→ 2×a and of height y ←→ a*2, whose area is (2×a)×a*2 ←→ 2×a*3. Subtracting the result of the Integral from the rectangle's area and multiplying this by two-thirds yields the area enclosed between a chord and a Parabola.

      2r3×(2×a*3)-(-a){⍵*2}a
7.1111111111111111111111111111111111111

The Integral of the 1+Sine function from 0 to ○2 is ○2:

      {1+1○⍵}○2x ⋄ ○2x
6.28318530717958647692528676655900576834
6.28318530717958647692528676655900576839

and the Integral of the Sine function from 0 to ○2 is (essentially) 0

      {1○⍵}○2x
6.69453502284549420282962009846618284241E¯42

A Normal Distribution is defined as nd←{(*¯0.5×⍵*2x)÷√○2x}. Because this instance of the algorithm is scaled properly, integrating it over the entire width from ¯∞ to yields an answer of 1 (the area under the curve):

      ¯∞ nd ∞
1

Integrating this same function for one, two, and three standard deviations on either side yields the 3-sigma rule of :

      ⍪¯1 ¯2 ¯3 nd¨ 1 2 3
0.682689492137085897170465091264075844958    ⍝ 68%
0.954499736103641585599434725666933125059    ⍝ 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. These two features may be combined in various ways, for example, to calculate Arc Length.

The formula for Arc Length is simply arclen←{4○⍺⍺∂⍵} which can be used on any given function. For example, the upper half of a unit circle is represented by the function {0○⍵}. The interval [-√0.5, √0.5] is then a quarter of a circle, whose length is

      ⎕FPC←512 ⋄ ⎕PP←60
      (-√0.5x){0○⍵}arclen√0.5x
1.57079632679489661923132169163975144209858469968755291048747
      ○0.5x     ⍝ Exact length = 1r2p1
1.57079632679489661923132169163975144209858469968755291048747

The arc length of the Unit Parabola from 0 to 1 is

      {⍵*2}{4○⍺⍺∂⍵}∫1
1.47894285754459743382790601943391443507169743059500825188121
      (1r2×(√5r16)÷1r4)+1r4×⍟(1r2+√5r16)÷1r4       ⍝ Exact length (from Wikipedia, "Parabola#Arc_length")
1.47894285754459743382790601943391443507169743059500825188121