Error using mupadmex, Error in sym/symsum (Evaluate a definite integral)

▼魔方 西西 提交于 2019-12-12 02:25:22

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!