bodyAsExpression           package:Ryacas           R Documentation

_G_e_t _b_o_d_y _o_f _f_u_n_c_t_i_o_n _a_s _a_n _e_x_p_r_e_s_s_i_o_n.

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

     Get body of function as an expression.

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

     bodyAsExpression(x)

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

       x: An R function. 

_D_e_t_a_i_l_s:

     This function is similar to the R 'body' function except that
     function returns a call object whereas this one returns an
     expression usable in Ryacas calculations.

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

     An expression.

_S_e_e _A_l_s_o:

     'body'

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

     ## Not run: 

     # construct an R function for the Burr probability density
     # function (PDF) given the Burr cumulative distribution function (CDF)
     BurrCDF <- function(x, c = 1, k = 1) 1-(1+x^c)^-k

     # transfer CDF to yacas
     yacas(BurrCDF)

     # create a template for the PDF from the CDF
     BurrPDF <- BurrCDF

     # differentiate CDF and place resulting expression in body
     body(BurrPDF) <- yacas(expression(deriv(BurrCDF(x,c,k))))[[1]]

     # test out PDF
     BurrPDF(1)

     ## End(Not run)

