问题
I am trying to evaluate a definite integral using the following code :
m=4;
t=4;
n=5;
P=10;
reset(symengine)
syms x;
syms k;
mean=int(log(1+P*x/t)*symsum( factorial(k)*x^(n-m)*exp(-x)/factorial(k+n-m)*feval(symengine,'laguerreL',n-m,k,x)*feval(symengine,'laguerreL',n-m,k,x),k,[0,m-1]) ,x,0,inf)
But it gives the following error:
Error using mupadmex
Error in MuPAD command: The number of arguments is incorrect. [has]
Evaluating: sum
Error in sym/symsum (line 114)
rSym = mupadmex('symobj::map',fsym.s,'symobj::symsum',x.s,a.s,b.s);
Error in Untitled2 (line 32)
mean=int(log(1+P*x/t)*symsum( factorial(k)*x^(n-m)*exp(-x)/factorial(k+n-m)*feval(symengine,'laguerreL',n-m,k,x)*feval(symengine,'laguerreL',n-m,k,x),k,[0,m-1]) ,x,0,inf)
However, when I evaluate the integral without some functions:
mean=int(log(1+P*x/t)*symsum( feval(symengine,'laguerreL',n-m,k,x)*feval(symengine,'laguerreL',n-m,k,x),k,[0,m-1]) ,x,0,inf)
I get an answer which is Inf
. Any idea?
回答1:
I found the solution. it consists in using gamma(k+n-m+1) to compute (k+n-m)!, since there is a bug when performing the factorial of a symbolic variables.
来源:https://stackoverflow.com/questions/31624985/error-using-mupadmex-error-in-sym-symsum-evaluate-a-definite-integral