Solved

Numerical Analysis

Posted on 2000-02-14
6
585 Views
Last Modified: 2011-10-03
How can I calculate the 'Error Function'*  I need a full level of accuracy.  My current method of integrating using trapezium rule and simpson's rule etc.. are not accurate and too slow.  I need something like Excel must use uses to calculate to full accuracy in quick time.

Links to sites with algorithms or code would be ok, i'm envisaging some sort of convergent number sequence must exist.

*Integral of 2/sqrt(pi) * exp(-x**2)
0
Comment
Question by:deighton
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2520063
My advice : SAL
http://www.llp.fu-berlin.de/lsoft/B/1/index.shtml
It if source c/c++ codes for every
in Numeric Analysis!
0
 
LVL 4

Accepted Solution

by:
jos010697 earned 200 total points
ID: 2522256
Bluntly stolen from Abramowitz and Stegun:

erf(x)= 1-e^(-x*x)*sum(i,1,5), a{i]*t^i) + e(x)

where t=1/(1+p*x)

where p= 0.3275911

where a[1]=  0.254829592
           a[2]= -0.284496736
           a[3]=  1.421413741
           a[4]=-1.453152027
           a[5]=1.061405429

The inaccuracy e(x) is at most 1.5E-7

kind regards,

Jos aka jos@and.nl
0
 
LVL 18

Author Comment

by:deighton
ID: 2527970
That looks like an improvement on the formula I've got.

Code unusual not c?  I don't know how to code it into c.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 18

Author Comment

by:deighton
ID: 2528006
With some mods i'm getting good answers in VB

1 - Exp(-x ^ 2) * (0.254829592 * t - 0.284496736 * t ^ 2 + 1.421413741 * t ^ 3 - 1.453152027 * t ^ 4 + 1.061405429 * t ^ 5)

Is what I used.

0
 
LVL 18

Author Comment

by:deighton
ID: 2528012
The e(x) at the end through me.
0
 
LVL 4

Expert Comment

by:jos010697
ID: 2534086
The e(x) term is the absolute error (sic) of this approximation of the
error function; and, of course, it is not part of the approximation formula
itself ...

kind regards,

Jos aka jos@and.nl
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Which version of C should I use when Perl is too slow? 13 181
How to set environment variables in C 2 82
Programming Arduino to control a Max7219 using C 2 127
Problem to ASCII 1 176
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now