Error with symbolic integral: Input arguments must be convertible to floating-point numbers

18 visualizzazioni (ultimi 30 giorni)
I am trying to code the following symbolic integral:
FY(y) = beta_2^alpha_2/(gamma(alpha_1)*gamma(alpha_2))*int(t^(alpha_2-1)*exp(-beta_2*t)*(gamma(alpha_1)-igamma(alpha_1,beta_1*(t+y))),t,max(0,-y),Inf)
I get an error saying:
Error using symengine
Input arguments must be convertible to floating-point numbers.
Error in sym/privBinaryOp (line 1013)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in sym/max (line 73)
C = privBinaryOp(X, Y, 'symobj::zipWithImplicitExpansion', 'symobj::maxComplex');
I have narrowed the issue down to the lower limit of integration i.e.
max(0,-y)
How do I fix this?

Risposta accettata

Nicolas Schmit
Nicolas Schmit il 25 Gen 2018
All arguments of the max() function must be convertible to floating point (numeric) numbers. You cannot use max() with purely symbolic variables. Instead, you can use the piecewise() function.
This will not work
syms x a b;
int(x*log(1 + x), max(0, -a), b)
But this will work
syms x a b;
int(x*log(1 + x), piecewise(-a > 0, -a, 0), b)

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by