Q1: I do a simple integration below in Octave and wanna do it in R as well, not sure how though. R's integrate(f,from,to) doesn't have a "with respect to" argument, please advise.
Q2: For the f below, say it is a joint pdf (0<x,y <inf) and I wanna get P(X<Y) such that I first integrate f with respect to x from 0 to y, then with respect to y from 0 to inf. int(f,x,0,y) doesn't work.
Q3: Also, in Octave, how do you do multiple integration at once?
Q2: For the f below, say it is a joint pdf (0<x,y <inf) and I wanna get P(X<Y) such that I first integrate f with respect to x from 0 to y, then with respect to y from 0 to inf. int(f,x,0,y) doesn't work.
Q3: Also, in Octave, how do you do multiple integration at once?
Code:
pkg load symbolic
syms x y
f = 2*exp(-x)*exp(-2*y);
int(f,x,1,inf); #integrate with respect to x
int(ans,y,0,1); #integrate with respect to y
#f is a pdf with <0,x,y<inf
#P(X<Y) is 1/3
int(f,x,0,y) #doesn't work
Last edited:
