Error using symengine. Either base or exponent must be a scalar.
11 views (last 30 days)
Show older comments
I got this error when running an iterating program on a distribution function.
ans =
logical
1
ans =
logical
1
Error using symengine
Either base or exponent must be a scalar.
Error in sym/privBinaryOp (line 1030)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in ^ (line 330)
B = privBinaryOp(A, p, 'symobj::mpower');
Error in researcheff (line 13)
y1=(valueadd/w/alpha)^(1/(beta-1));
Error in viterate (line 32)
x1=researcheff(v,I,Im,P,f,Q,w,mb1,mb2);
Error in patentsim (line 88)
[v1,A1,G1,moment1] = viterate(v0,A0,G0,f);
The strange thing is I used isscalar function to check both the base and the exponent, which turns out that they are both scalar (the first two lines are the results for the check). The program goes as follow
function y=researcheff(v,I,Im,P,f,Q,w,mb1,mb2)
global lambda;
global alpha;
global beta;
global theta;
syms mu a w r na nb1 nb2;
va1= (I*subs(v,mu,mu*lambda^a)+(1-I)*(Q+v))*f;
va2= mb1*(Im*(subs(v,mu,mu*lambda^a)-P)+(1-I)*v)*f;
va= va1-va2;
valueadd=int(va,a,[0 1]);
isscalar(valueadd/w/alpha)
isscalar(1/(beta-1))
y1=(valueadd/w/alpha)^(1/(beta-1));
va2= mb2*(Im*(subs(v,mu,mu*lambda^a)-P)+(1-I)*v)*f;
va= va1-va2;
valueadd=int(va,a,[0 1]);
y2=(valueadd*mu^theta/w/alpha)^(1/(beta-1));
y= piecewise(mu>=1, y1, (0<mu)&(mu<1), y2, 0);
end
I don't know if it helps but to clarify the variables a litte, v,I,Im,P are some functions on the 7 variables after syms; f is a distribution function; Q and w are supposed to be two scalars; mb1 and mb2 are two matching probability functions concerning na, nb1 and nb2.
5 Comments
Answers (0)
See Also
Categories
Find more on Assumptions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!