Closed jdh8 closed 3 years ago
Are you compiling lolremez from source? The real functions are declared in lol/src/lol/math/real.h
and implemented in lol/src/math/real.cpp
(note that lol
is a Git submodule). You could for instance look for exp(
in these files and implement erf
in a similar fashion, e.g. using a Taylor/Maclaurin series.
It looks like a Bürmann series might have a good convergence rate.
erf()
is now available if you compile from source, and will be in the next release. It’s a quick and dirty implementation for now, and I don’t know how to test its accuracy properly, but I tested the precision by computing (erf(x+ε)-erf(x))/ε
which should be close to the derivative of erf
, aka 2/sqrt(π)*exp(-x²)
:
# lolremez '(erf(4+1e-50)-erf(4))/1e-50'
1.269823467186655826835016359930571628776564403116531674080842983563179750336408e-7
# lolremez '2/sqrt(π)*exp(-4²)'
1.269823467186655826835016359930571628776564403116582467019530449796253150990805e-7
^ first differing digit
I'm trying to approximate erf. How do I extend or link to lolremez?