Learn R Programming

geophys (version 1.4-1)

erf: Error Function

Description

Error Function

Usage

erf(x)
philpotts.erf(x)
erfc(x)
erfinv(x)

Arguments

x

Value

error function

Details

Uses pnorm to calculate the error function. erfinv returns the inverse of the erf function.

See Also

philpotts.erf

Examples

Run this code
# NOT RUN {
j = seq(from=0, to=5.5, by=0.01)
 y = erf(j)   
phil = philpotts.erf(j)

 plot(j,y)
points( j, phil, pch=3, col='red'  )


#### plot the difference
plot(j, y-phil)
lines(j, y-phil)


#####  inverse of erf function:

 j = seq(from=0, to=5.5, by=0.1)
 y = erf(j)

for(i in 1:length(j))
   {

     z = erfinv(y[i])
     print(paste(i, y[i], j[i], z, sep=" "))
   }


# }

Run the code above in your browser using DataLab