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/29 15:20]
jojo1973
playground:playground [2021/10/11 13:50] (current)
jojo1973 created
Line 1: Line 1:
-==== Numerical integration ==== +Have fun!
- +
-Numeric integration of symbolic expressions is performed 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. +
- +
----- +
- +
-=== Example 1: Bound function on closed interval === +
- +
-|  pic  | $$ \int^{2}_{0} x^{10}e^{\left(4x^{3}-3x^{4}\right)} \,dx $$  ||| +
-|  :::  |  tol=10<sup>-4</sup>   | **7.258 3**76 114 514 225 ...  |  Δ = -1.9·10<sup>-5</sup> +
-|  :::  |  tol=10<sup>-8</sup>   | **7.258 395 17**3 115 920 ...  |  Δ = 2.5·10<sup>-9</sup> +
-|  :::  |  tol=10<sup>-12</sup>  | **7.258 395 170 61**5 141 ...  |  Δ = 8.5·10<sup>-13</sup> +
-|  :::  |  Exact at the precision shown  | **7.258 395 170 614 291** ...  |   Δ ≤ 10<sup>-16</sup> +
- +
- +
-|{{:manual:warning-145066_640.png?100 |Warning!}} The user must take care of implicit substitutions when the expression to integrate __contains trigonometric functions__. For example, if the angle mode is set to degrees, the expression $ \sin x $ is actually interpreted as $ \sin\left(\frac{\pi}{180}x\right) $, whose anti-derivative is **not** $-\cos x$, but $-\frac{180}{\pi}\cos\left(\frac{\pi}{180}x\right) $. Unexpected results will follow if the user disregards this occurrence! |+
  • playground/playground.1632954044.txt.gz
  • Last modified: 2021/09/29 15:20
  • by jojo1973