While computing the integral with symbolic variables using the “int” function, “int” by default, uses strict mathematical rules. For instance, these rules do not allow to rewrite “acos(cos(x))” as “x”. A potential solution is to use “int” with the argument “IgnoreAnalyticConstraints” set to “true”.
Note: This option can provide simpler results for expressions but can lead to results that do not always hold for all values of variables.
More information can be found in the documentation link below:
Assuming “c_1” and “c_2” are also symbolic variables, please find a code snippet for your reference below.
syms l ct m cf c_1 c_2
% Method 1
ncons_ = int(l^(c_1+c_2) * exp(-l*3), l)
ncons = eval(- subs(ncons_, l, 0))
method1_result = eval(subs(ncons, [m, ct, cf, c_1, c_2], [2, sum([3,4]), ...
prod(1./factorial([3,4])), 3, 4]))
% Method 2
ncons_ = int(l^(c_1+c_2) * exp(-l*(m+1)), l, "IgnoreAnalyticConstraints", true)
ncons = eval(- subs(ncons_, l, 0))
method2_result = eval(subs(ncons, [m, ct, cf, c_1, c_2], [2, sum([3,4]), ...
prod(1./factorial([3,4])), 3, 4]))