adaptlob               package:cwhmath               R Documentation

_N_u_m_e_r_i_c_a_l_l_y _e_v_a_l_u_a_t_e _i_n_t_e_g_r_a_l _u_s_i_n_g _a_d_a_p_t_i_v_e _r_u_l_e.

_D_e_s_c_r_i_p_t_i_o_n:

     'adaptsim' and 'adaptlob' approximate the integral of the function
     'f' using _adaptive_ Simpson and Lobatto rule. Both methods can
     deal with discontinuous functions.

     'adaptlob' is more efficient than 'adaptsim' when the accuracy
     requirement  is high. For lower tolerances, 'adaptsim' is
     generally (but not always) more efficient than 'adaptlob', but
     less reliable.

     Both routines show excellent response to changes in the tolerance.

     The function 'f' must return a vector of output values if given a
     vector of input values.

     'adapt...(f,a,b)' approximates the integral of 'f(x)' from 'a' to
     'b' to _machine_ precision.

     'adapt...(f,a,b,tol)' integrates to a _relative_ error of tol.

     'adapt...(f,a,b,tol,trace)' displays the left end point of the
     current interval, the interval length, and the partial integral.

     'adapt...(f,a,b,tol,trace,P1,P2,...)' allows coefficients P1, ...
     to be passed directly to the function f: g <- f(x,P1,P2,...)

_U_s_a_g_e:

     adaptsim(f,a,b,tol=.Machine$double.eps,trace=FALSE,...)
     adaptlob(f,a,b,tol=.Machine$double.eps,trace=FALSE,...)

_A_r_g_u_m_e_n_t_s:

       f: function to be integrated.

       a: starting abscissa of integral.

       b: ending abscissa of integral.

     tol: error tolerance > 0.

   trace: if TRUE then trace will be displayed.

     ...: additional coefficients for function  'f'  if necessary.

_V_a_l_u_e:

     The approximate value of the integral.

_A_u_t_h_o_r(_s):

     Christian W. Hoffmann, christian.hoffmann@wsl.ch, 
      <URL: http://www.wsl.ch/staff/christian.hoffmann>

_S_o_u_r_c_e:

     Walter Gautschi, 08/03/98. Reference: Gander, Computermathematik,
     Birkhaeuser, 1992.

_R_e_f_e_r_e_n_c_e_s:

     Gander, W., Gautschi, W., 2000. Adaptive Quadrature - Revisited.
     ETH Zurich, DI IWR technical report 306. BIT 40, 1, 84-101.

_E_x_a_m_p_l_e_s:

     FexGander <- function(xx) ifelse(xx < 1,xx+1,ifelse(xx <= 3, 3 - xx, 2 ))
     adaptsim(FexGander,0,5,2.0e-6,TRUE) # 7.499949 instead of 7.5
     adaptlob(FexGander,0,5,2.0e-6,TRUE) # 7.500002 instead of 7.5
     adaptsim(FexGander,0,5)-7.5 # -7.993606e-15 instead of 0

