Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple problems in Erf and InvErf methods #57

Merged
merged 1 commit into from Jun 5, 2016

Conversation

takano-akio
Copy link
Contributor

This pull request fixes errors in normcdf, inverf, inverfc and invnormcdf.

normcdf

By definition, normcdf = (/2) . erfc . negate . (/sqrt 2). However,

Prelude Numeric.AD Data.Number.Erf> diff ((/2) . erfc . negate . (/sqrt 2)) 1
0.2419707245191434
Prelude Numeric.AD Data.Number.Erf> diff normcdf 1
-0.3961674381354548

inverf etc.

inverf . erf and erf . inverf should be both identity functions (within their domain), so their derivative should be const 1. However,

Prelude Numeric.AD Data.Number.Erf> diff (inverf . erf) 1
0.7483717940991074
Prelude Numeric.AD Data.Number.Erf> diff (erf . inverf) 0.4
0.8235235351131942

There are similar issues with inverfc and invnormcdf.

@ekmett ekmett merged commit f3e13bf into ekmett:master Jun 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants