Jump to content

Numerical integration/Gauss-Legendre Quadrature: Difference between revisions

m
→‎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'')
:::* &nbsp; multiplication using &nbsp; [<b>···</b> '''*.5'''] &nbsp; instead of division using &nbsp; [<b>···</b> '''/2''']
:::* &nbsp; a generic approach for setting the &nbsp; ''numeric digits''
:::* &nbsp; a better test for earlier termination (stopping) of calculations
:::* &nbsp; a more precise value for &nbsp; '''pi'''
:::* &nbsp; 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 &nbsp; '''pi'''.
:::* &nbsp; 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 &nbsp; '''pi'''. &nbsp; &nbsp; If faster speed is desired,
<br>the number of the decimal digits of &nbsp; '''pi''' &nbsp; can be reduced.
 
<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>exists nested &nbsp; '''do''' &nbsp; loops with different (grouped) indentations, &nbsp; 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>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.