11-14-2023, 07:05 AM
This calculates the Gauss error function and the complementary Gauss error function:
This are standard functions of many math libraries of other programming languages.
Code: (Select All)
'The Gauss error function and the complementary Gauss error function DIM AS _FLOAT a, n a = 0.05 PRINT erf##(a) PRINT erfc##(a) FUNCTION erf## (value AS DOUBLE) 'the Gauss error function t## = 1 / (1 + 0.5 * ABS(value)) tau## = t## * EXP(-value ^ 2 - 1.26551223 + 1.00002368 * t## + 0.37409196 * t## ^ 2 + 0.09678418 * t## ^ 3 - 0.18628806 * t## ^ 4 + 0.27886807 * t## ^ 5 - 1.13520398 * t## ^ 6 + 1.48851587 * t## ^ 7 - 0.82215223 * t## ^ 8 + 0.17087277 * t## ^ 9) IF value >= 0 THEN erf## = 1 - tau## ELSEIF value < 0 THEN erf## = tau## - 1 END IF END FUNCTION FUNCTION erfc## (value AS DOUBLE) 'the complementary Gauss error function erfc## = 1 - erf##(value) END FUNCTION
This are standard functions of many math libraries of other programming languages.