Anonymous user
Numerical integration/Gauss-Legendre Quadrature: Difference between revisions
Numerical integration/Gauss-Legendre Quadrature (view source)
Revision as of 01:04, 7 April 2016
, 8 years ago→version 2: changed the comments in the REXX section header.
(→version 2: added a (glyph) pointer to indicate where the computed value differs from the true value, also added output indicating how many decimal digits were exact.) |
m (→version 2: changed the comments in the REXX section header.) |
||
Line 1,620:
:::* some static variables instead of repeated expressions
:::* calculations using full (specified) precision (''numeric digits'')
:::* multiplication using [<b>···</b> '''*.5'''] instead of division using [<b>···</b> '''/2''']
:::* a generic approach for setting the ''numeric digits''
:::* a better test for earlier termination (stopping) of calculations
:::* a more precise value for '''pi'''
:::* shows an arrow that points where the GLQ number matches the exact value
<br>The speed of this REXX program is largely dependent on the number of decimal digits in '''pi'''.▼
:::* displays the number of decimal digits that match the exact value
<br>The use of "vertical bars" is one of the very few times to use leading comments, as there isn't that many situations where there ▼
▲<br>The speed of this REXX program is largely dependent on the number of decimal digits in '''pi'''. If faster speed is desired,
<br>the number of the decimal digits of '''pi''' can be reduced.
▲
<br>exists nested '''do''' loops with different (grouped) indentations, and practically no space on the right side of the statements.
<br>It presents a good visual indication of what's what, but it's the dickens to pay when updating the code.
Line 1,667 ⟶ 1,672:
say sep; xdif=compare(strip(z), trueV); say right("↑", 6+1+xdif)
say left('', 6+1) trueV " {exact value}"; say
say 'Using ' digs " digit precision, the",
'N-point Gauss─Legendre quadrature (GLQ) had an accuracy of ' xdif-2 " digits."
exit /*stick a fork in it, we're all done. */
Line 1,719 ⟶ 1,724:
20.03574985481980379794918723893165612035620824636572692881130650209278521036177419 {exact value}
Using 82 digit precision, the N-point Gauss─Legendre quadrature (GLQ) had an accuracy of 74 digits.
</pre>
|