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

8 views (last 30 days)
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?

Answers (2)

Walter Roberson
Walter Roberson on 25 Jul 2015
It appears to me that you tried to use the syntax symsum(expr,var,a,b) but instead you used the syntax symsum(expr,var,[a,b])
  6 Comments
dina guermaz
dina guermaz on 25 Jul 2015
Using your last code (and the first one), Matlab still giving an 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 Untitled11 (line 16)
ss = symsum(to_sum, k, 0, m-1);
By the way there is a - missed in your code
Walter Roberson
Walter Roberson on 26 Jul 2015
I would need the toolbox to do more testing, sorry.
One thing I note is that the "[has]" suggests to me that inside symsum() a MuPAD has() call is being attempted and is failing.
Did you happen to create your own MuPad procedures? Look for .mu files on your path. http://www.mathworks.com/help/symbolic/use-your-own-mupad-procedures.html . Though the possibility of having overridden has() is more something I would associate with a MuPAD library that has somehow automatically been executed. I have not examined how MuPAD user libraries are created.
Maybe try the instructions at http://www.mathworks.com/help/symbolic/source-code-of-the-mupad-library-functions.html to display 'symsum' and 'has'

Sign in to comment.


Dharini V
Dharini V on 20 Mar 2017
Edited: Walter Roberson on 20 Mar 2017
Error using mupadmex
Error in MuPAD command: The dimensions do not match.
[(Dom::Matrix(Dom::ExpressionField()))::_mult2]
Error in sym/privBinaryOp (line 1693)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in sym/mtimes (line 179)
X = privBinaryOp(A, B, 'symobj::mtimes');
Error in first (line 78)
E_phi=1j*beta*exp(-1j*beta*r)*cos(theta)*(Py*cos(phi)-Px*sin(phi))/(2*pi*r);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!