Learn R Programming

PWEALL (version 1.3.0.1)

spf: A utility function

Description

A utility function to calculate a ratio.

Usage

spf(x=seq(-1,1,by=0.2),eps=1.0e-3)

Value

fx1

when \(l=0\);

fx2

when \(l=1\);

fx3

when \(l=2\).

Arguments

x

A vector

eps

tolerance

Author

Xiaodong Luo

Details

This is to calculate $$\Phi_l(x)=\frac{\int_0^x s^le^{-s}ds}{x^{l+1}},\hspace{0.5cm}l=0,1,2.$$ This function is well defined even when x=0. However, it is numerical chanllenging to calculate it when x is small. So when \(|x|\le \code{eps}\) we approximate this function and the absolute error is \(\code{eps}^5\).

References

Luo, et al. (2017)

Examples

Run this code
fun<-spf(x=seq(-1,1,by=0.2),eps=1.0e-3)
fun

Run the code above in your browser using DataLab