playground:playground

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
playground:playground [2021/09/27 12:02]
jojo1973
playground:playground [2021/10/11 13:50]
jojo1973 created
Line 1: Line 1:
-==== Numerical integration ==== +Have fun!
- +
-Numeric integration of symbolic expressions is implemented in **newRPL** via the ''[[manual:chapter6:solvers:cmd_numint|NUMINT]]'' command which implements the [[https://en.wikipedia.org/wiki/Adaptive_Simpson%27s_method|Adaptive Simpson's method]]. +
- +
-''[[manual:chapter6:solvers:cmd_numint|NUMINT]]'' accepts four arguments: +
- +
-  * the mono-variate function to integrate, either in __symbolic__ or __program__ form; +
-  * the lower integration limit; +
-  * the upper integration limit; +
-  * the error tolerance. +
- +
-If the **function** to integrate is expressed in symbolic form it must respect a precise syntax: +
- +
-  * it must be written as an equation; +
-  * the left side must be in the form ''//func//(//var//)'' where ''//var//'' is the integrating variable and ''//func//'' is the function's name; +
-  * the right side is a function, expressed in terms of ''//var//''+
- +
-For example valid expressions are: +
-<code> +
-F(X)=X*LN(X) +
-G(Z)=Z^2-2*COS(Z) +
-VEL(T)=ACC*T +
-</code> +
-As shown above, the functions may refer to global or local variables; the function's name is only descriptive and bears no relevance to the calculation. +
- +
-Alternatively, the function can be written as a program which __accepts exactly one numeric argument and returns exactly one numeric result__. The expressions above can be rewritten as: +
-<code> +
-« DUP LN * » +
-« DUP SQ SWAP COS 2 * - » +
-« 'ACC' RCL * » +
-</code> +
- +
-The **integration limits** can be either real or complex __finite__ numbers; symbolic constants are accepted and silently converted to numerical values. +
- +
-The **error tolerance** is a real number used to specify the required precision of the calculation: when two successive iterations differ by a value which is less than the tolerance the calculation stops. +
- +
----- +
- +
-=== Examples === +
- +
-The following examples are calculated with 16 precision digits at three different tolerances. If available, the analytic result is provided for comparison. +
- +
-^  Function  ^  Tolerance  ^^^  Exact Solution  ^^ +
-^    ^  ''1E-4''  ^  ''1E-8''  ^  ''1E-12''  ^    ^ +
-| $ \int^{5/4}_{0} \cos x^2 \,dx $  |  0.977 4  |  0.977 437 67  |  0.977 437 670 72  |  $ \sqrt\frac{\pi}{2} C\left(\sqrt\frac{2}{\pi} x\right) \Biggr|^{x=5/4}_{x=0} $  |  0.977 437 670 720 3  | +
- +
  • playground/playground.txt
  • Last modified: 2021/10/11 13:50
  • by jojo1973