Algorithm Error Function
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this how to calculate error function in casio calculator site About Us Learn more about Stack Overflow the company Business Learn
Inverse Error Function Calculator
more about hiring developers or posting ads with us Mathematics Questions Tags Users Badges Unanswered Ask Question _ Mathematics complementary error function Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute: Sign up Here's how complementary error function calculator it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top How to accurately calculate the error function erf(x) with a computer? up vote 9 down vote favorite 2 I am looking for an accurate algorithm to calculate the error function I have tried using [this formula] (http://stackoverflow.com/a/457805) (Handbook of Mathematical Functions, formula
Error Function Table
7.1.26), but the results are not accurate enough for the application. statistics algorithms numerical-methods special-functions share|cite|improve this question edited Jan 10 '14 at 4:47 pnuts 1056 asked Jul 20 '10 at 20:20 badp 6741225 You may want to take a look at python's code.google.com/p/mpmath or other libraries that advertise a "multiple precision" feature. Also, this may be a better question for stack overflow instead, since it's more of a computer science thing. –Jon Bringhurst Jul 20 '10 at 20:26 @Jon: Nope, I'm not interested in a library, there is no such library for the language I'm writing in (yet). I need the mathematical algorithm. –badp Jul 20 '10 at 20:49 Have you tried numerical integration? Gaussian Quadrature is an accurate technique –Digital Gal Aug 28 '10 at 1:25 GQ is nice, but with (a number of) efficient methods for computing $\mathrm{erf}$ already known, I don't see the point. –J. M. Aug 29 '10 at 23:07 add a comment| 4 Answers 4 active oldest votes up vote 9 down vote accepted I am assuming that you need the error
function erf(x) The following code first appeared as Python code in my blog post Stand-alone error function erf. See that post for documentation. See also Relating error function matlab erf and Φ.#include
Python Error Function
1.421413741; double a4 = -1.453152027; double a5 = 1.061405429; double p = 0.3275911; // Save the sign of x int sign = http://math.stackexchange.com/questions/97/how-to-accurately-calculate-the-error-function-erfx-with-a-computer 1; if (x < 0) sign = -1; x = fabs(x); // A&S formula 7.1.26 double t = 1.0/(1.0 + p*x); double y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x); return sign*y; } void testErf() { // Select a http://www.johndcook.com/blog/cpp_erf/ few input values double x[] = { -3, -1, 0.0, 0.5, 2.1 }; // Output computed by Mathematica // y = Erf[x] double y[] = { -0.999977909503, -0.842700792950, 0.0, 0.520499877813, 0.997020533344 }; int numTests = sizeof(x)/sizeof(double); double maxError = 0.0; for (int i = 0; i < numTests; ++i) { double error = fabs(y[i] - erf(x[i])); if (error > maxError) maxError = error; } std::cout << "Maximum error: " << maxError << "\n"; } A&S refers to Handbook of Mathematical Functions by Abramowitz and Stegun. See Stand-alone error function for details of the algorithm.This code is in the public domain. Do whatever you want with it, no strings attached.Other versions: C#, PythonMore stand-alone numerical code Search for: Subscribe to my newsletter John D. Cook© All rights reserved. Search for:
of the ACM CACM Homepage archive Volume 5 Issue 9, Sept. 1962 Page 483 ACM New York, NY, USA tableofcontents doi>10.1145/368834.368893 1962 Article Bibliometrics ·Downloads (6 http://dl.acm.org/citation.cfm?id=368893 Weeks): 0 ·Downloads (12 Months): 6 ·Downloads (cumulative): 139 ·Citation Count: 1 Recent authors with related interests Concepts in this article powered by Concepts inAlgorithm 123: Real error function, ERF(x) Error function In mathematics, the error function (also called the Gauss error function) is a special function of sigmoid shape which occurs in probability, statistics and partial differential equations. It error function is defined as: (When x is negative, the integral is interpreted as the negative of the integral from x to zero. morefromWikipedia Italic type In typography, italic type is a cursive typeface based on a stylized form of calligraphic handwriting. Owing to the influence from calligraphy, such typefaces often slant slightly to the right. Different glyph shapes from roman type are also error function calculator usually used¿another influence from calligraphy. True italics are therefore distinct from oblique type, in which the font is merely distorted into a slanted orientation. morefromWikipedia Bracket Brackets are tall punctuation marks used in matched pairs within text, to set apart or interject other text. Used unqualified, brackets refer to different types of brackets in different parts of the world and in different contexts. morefromWikipedia Tools and Resources Buy this Article Recommend the ACM DLto your organization Request Permissions TOC Service: Email RSS Save to Binder Export Formats: BibTeX EndNote ACMRef Share: | Contact Us | Switch to single page view (no tabs) **Javascript is not enabled and is required for the "tabbed view" or switch to the single page view** Powered by The ACM Digital Library is published by the Association for Computing Machinery. Copyright © 2016 ACM, Inc. Terms of Usage Privacy Policy Code of Ethics Contact Us Useful downloads: Adobe Reader QuickTime Windows Media Player Real Player Did you know the ACM DL App is now available? Did you know your Organization can subscribe to the ACM Digital Libra