View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default inverse error function

How can I find an inverse error function on Excel, using functions that
are
available?


I could have sworn there was a better way, but I don't see it at the moment.
If you don't get a better reply, here's something I put together.
We note that it's only accurate to 7-8 digits because Excel's Erf function
is not very accurate either.
I'm using Excel 2007, so Erf is a worksheet function. If using an earlier
version, set a vba reference to the ATP.

Sub TestIt()
Debug.Print InverseErf(0.1)
Debug.Print InverseErf(0.5)
Debug.Print InverseErf(0.9)
End Sub

Function InverseErf(n)
If n < 0 Or n = 1 Then Exit Function

Dim P As Double
Dim g As Double
Dim J As Long 'Counter
With WorksheetFunction
P = .SqrtPi(1)
g = 0
For J = 1 To 15
g = g + (Exp(g * g) * P * (n - .Erf(g))) / 2
' Debug.Print J; g
Next J
End With
InverseErf = g
End Function


Three known results from Math Program:
Note the slight error in Excel.

'InverseErf [0.1]
'0.0888559904942577
'
'InverseErf [0.5]
'0.4769362762044698
'
'InverseErf [0.9]
'1.163087153676674


Note that Excel can not take the Erf between -1 & 0. (Bug!)
therefore, just note that InverseErf(-x) = - InverseErf(+x)
--
HTH :)
Dana DeLouis


"Wan" wrote in message
...
How can I find an inverse error function on Excel, using functions that
are
available?