Assumption Ignored Symbolic PDF

6 views (last 30 days)
Lea on 26 Feb 2023
Commented: Paul on 27 Feb 2023
I want to define as the probability density function of the random variable z. is the cumulative density function.
As , if is the probability density function of z.
However, Matlab ignores this assumption (see code below). Why is that the case and how can I fix it?
Thanks for any help :)
% Set symbols
syms x y beta db dc d
syms z f(z) F(z) % z, its PDF and CDF
syms rd(z) rp(z) % other functions that depend on z
% Assumptions on parameters
assume(beta<1 & beta>0)
assume(F(z)<=1 & F(z)>=0) % CDF of z
% PDF of z
f(z) == diff(F(z),z)
ans = 
assume(int(f(z), z, 0,1)==1)
Warning: Ignored assumptions on constants.
Vb = log(x-db) + beta * int((z * log(rp(z)*db)*f(z)), z, 0,1) ...
+ beta * int(((1-z) * log(rd(z)*db)*f(z)), z, 0,1)
Vb = 
% differentiate Vb w.r.t. db and set equal to 0
diff_Vb_db = diff(Vb, db) == 0
diff_Vb_db = 
isolate(diff_Vb_db, db)
ans = 
Walter Roberson
Walter Roberson on 26 Feb 2023
assume(int(f(z), z, 0,1)==1)
You have implicitly told MATLAB that f is a function of a single variable. The definite integral of a function of a single variable is a constant. Constant == constant is either symtrue or symfalse, and assuming() symtrue or symfalse is ignored.
If you had declared f as being a function of more than one variable, then the int() would not be considered a constant.

Sign in to comment.

Accepted Answer

Paul on 26 Feb 2023
I'm not aware of a way to put an assumption like that on an integral.
In this problem, it seems like the actual form of f(z) doesn't matter, so I suppose you could just assign f(z) to be any function that satisfies the integral constraint.
Or, these manipulations worked, but I'm not sure they will generalize. I had to play around a bit to get the expressions into the correct form for the subs command to work
syms f(z)
syms db beta x real
assumeAlso(db ~= 0);
assumeAlso(db ~= x);
eqn = beta*int(-f(z)*(z-1)/db,z,0,1) + beta*int(f(z)*z/db,z,0,1) + 1/(db - x) == 0
eqn = 
eqn = simplify(eqn)
eqn = 
eqn = expand(eqn)
eqn = 
eqn = subs(eqn,int(f(z),z,0,1),1)
eqn = 
eqn = beta/db - simplify(solve(eqn,beta)/db) == 0
eqn = 
Paul on 27 Feb 2023
I agree that assume doesn't allow for assuming the integral is a particular constant, which is why the original solution posted above used subs for the integral (after some manipulation to get the expression into a form where subs would work). However, I'm wondering if that's the expected behavior based on the linked doc page, which says:
"The toolbox does not support assumptions on symbolic functions. Make assumptions on symbolic variables and expressions instead." (emphasis added)
Let's test this with a simple case
syms x y
ans = "expression"
We see that x*y is an expression, so it should be assumable
assume(x*y == 1);
ans = 
It is. And the assumption yields the expected result
ans = 
Now try with int
syms f(z)
ans = "expression"
Also an expression. But this expression is not assumable
assume(int(f(z),z,0,1) == 1)
Warning: Ignored assumptions on constants.
ans = 
What's the difference between x*y and the int(...) expressions as far as assume() is concerned?

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!