int2                 package:rmutil                 R Documentation

_V_e_c_t_o_r_i_z_e_d _T_w_o-_d_i_m_e_n_s_i_o_n_a_l _N_u_m_e_r_i_c_a_l _I_n_t_e_g_r_a_t_i_o_n

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

     'int' performs vectorized numerical integration of a given
     two-dimensional function.

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

     int2(f, a=c(-Inf,-Inf), b=c(Inf,Inf), eps=1.0e-6, max=16, d=5)

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

       f: The function (of two variables) to integrate, returning
          either a scalar or a vector.

       a: A two-element vector or a two-column matrix giving the lower
          bounds. It cannot contain both -Inf and finite values.

       b: A two-element vector or a two-column matrix giving the upper
          bounds. It cannot contain both Inf and finite values.

     eps: Precision.

     max: The maximum number of steps, by default set to 16.

       d: The number of extrapolation points so that 2k is the order of
          integration, by default set to 5; d=2 is Simpson's rule.

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

     The vector of values of the integrals of the function supplied.

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

     J.K. Lindsey

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

     f <- function(x,y) sin(x)+cos(y)-x^2
     int2(f, a=c(0,1), b=c(2,4))
     #
     fn1 <- function(x, y) x^2+y^2
     fn2 <- function(x, y) (1:4)*x^2+(2:5)*y^2
     int2(fn1, c(1,2), c(2,4))
     int2(fn2, c(1,2), c(2,4))
     int2(fn1, matrix(c(1:4,1:4),ncol=2), matrix(c(2:5,2:5),ncol=2))
     int2(fn2, matrix(c(1:4,1:4),ncol=2), matrix(c(2:5,2:5),ncol=2))

