Clear Filters
Clear Filters

Error using symengine Unable to prove '2*(c1 + c2 + 1)^(1/2) == 0 & 35 < 5*c1 + 5*c2 + 5' literally.

3 views (last 30 days)
I run the code and it returns error "Error using symengine Unable to prove '2*(c1 + c2 + 1)^(1/2) == 0 & 35 < 5*c1 + 5*c2 + 5' literally."
Please help me.
clear all
clc
syms c1 c2
S=50;
r=15;
mu=5;
sigma=2;
L=3;
m=5;
mu_ccLm=(c1+c2+(2*L)-m)*mu
sigma_ccLm=((c1+c2+(2*L)-m)^0.5)*sigma
mm=normcdf(S-r,mu_ccLm,sigma_ccLm)

Accepted Answer

Walter Roberson
Walter Roberson on 17 Nov 2023
syms c1 c2
S=50;
r=15;
mu=5;
sigma=2;
L=3;
m=5;
mu_ccLm=(c1+c2+(2*L)-m)*mu
mu_ccLm = 
sigma_ccLm=((c1+c2+(2*L)-m)^0.5)*sigma
sigma_ccLm = 
mm=normcdf(S-r,mu_ccLm,sigma_ccLm)
Conversion to logical from sym is not possible.

Error in normcdf>localnormcdf (line 127)
if sigma > 0

Error in normcdf (line 50)
[varargout{1:max(1,nargout)}] = localnormcdf(uflag,x,varargin{:});
That is the error message I expect for this situation.
There is no special symbolic normcdf() call, so your parameters are being processed by the normal numeric normcdf() call. Several of the statistics-related functions test input parameters numerically in order, such as if they want to have logic similar to
if sigma > 0
do the normal calculation
else
output 0, or nan, or as appropriate
end
There is not much you can do about this, other than to copy the implementing code for normcdf and editing out the numeric tests.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!