Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
erf() - The Gauss error function
#1
This calculates the Gauss error function and the complementary Gauss error function:
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.
Reply
#2
Hey!  A FUNCTION!!

I give it a number!  It returns a number!  Now what these numbers do, how I'd make use of them, or why I'd ever need them is completely beyond me.  Too bad there's no demo showcasing their functionality, nor any description of their reason for existence, but at least they're functions!
Reply
#3
https://en.wikipedia.org/wiki/Error_function

... only a function, but a nice function!
Isn't it?
Reply
#4
How does the variable " n " factor into this Error Function ( ie Dim as _Float a,n) ? Is this the variable holding the results of the function? If so, how does it hold that value if there is no assignment statement in the code.
Reply
#5
(11-14-2023, 07:28 AM)BSpinoza Wrote: https://en.wikipedia.org/wiki/Error_function

... only a function, but a nice function!
Isn't it?

Looks like a great way to make the letter S continuous over infiniy in both directions.
erf# ? A: Is the sound the S makes being stretched like that ;-))

Haven't I seen something like this function for Neural Net setup and training?
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#6
(11-14-2023, 03:18 PM)Dimster Wrote: How does the variable " n " factor into this Error Function ( ie Dim as _Float a,n) ? Is this the variable holding the results of the function? If so, how does it hold that value if there is no assignment statement in the code.
the 'n' isn't necessary, you can remove it.
Reply
#7
As I understand it, Gaussian-Error function is a way to determine the degree of error in something. For example: opinion polls.
1500 people are asked which party they want to vote for or intend to vote for. The result can never be 100% (safety). The question here is always: How high is the error quotient?
The Gaussian-Error function should provide a reliable answer here - or I misunderstood the whole thing.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Function Pointers? BlameTroi 5 238 02-20-2026, 05:55 PM
Last Post: BlameTroi
  Compile error when .bas name is same as a directory (linux) Dav 3 779 10-18-2024, 03:32 PM
Last Post: Kernelpanic
  Error Message bplus 3 888 08-20-2024, 09:03 PM
Last Post: Pete
  double error Jack 1 619 08-16-2024, 08:43 PM
Last Post: Pete
  function "_ARCSEC()" is wrong? BSpinoza 16 3,437 10-31-2023, 04:23 PM
Last Post: SMcNeill

Forum Jump:


Users browsing this thread: