Symbolic integration of Student's t density in MATLAB -
i want integrate student's t-density in matlab matlab seems fail , returns same expression without calculations. ideas on how proceed. know should evaluate 1 trick force matlab it.
syms x s mu nu g = @(x) gamma(1/2*(nu+1))/(gamma(nu/2)*sqrt(pi*nu*s^2))*(1 + 1/nu*(x-mu)^2/s^2)^(-1/2*(nu+1)); int(g(x), x, -inf, inf)
i tried in way:
syms x nu mu s f = gamma(1/2*(nu+1))/(gamma(nu/2)*sqrt(pi*nu*s^2))*(1 + 1/nu*(x-mu)^2/s^2)^(-1/2*(nu+1)) int(f)
and works! got answer:
-(gamma(nu/2 + 1/2)*(mu - x)*hypergeom([1/2, nu/2 + 1/2], 3/2, -(mu - x)^2/(nu*s^2)))/(pi^(1/2)*gamma(nu/2)*(nu*s^2)^(1/2))
but if try definite integration doesn't works:
int(f, 0, 1) ans = int(gamma(nu/2 + 1/2)/(pi^(1/2)*gamma(nu/2)*((mu - x)^2/(nu*s^2) + 1)^(nu/2 + 1/2)*(nu*s^2)^(1/2)), x, 0, 1)
so went , read this: if matlab unable find answer integral of function f, returns int(f)
. (http://www.mathworks.com/help/symbolic/integration.html) answer can't solved!
Comments
Post a Comment