Assumption Ignored Symbolic PDF
11 ビュー (過去 30 日間)
古いコメントを表示
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(x>0)
assume(y>0)
assume(beta*x<y)
assume(beta<1 & beta>0)
assume(F(z)<=1 & F(z)>=0) % CDF of z
% PDF of z
f(z) == diff(F(z),z)
assume(f(z)>=0)
assume(int(f(z), z, 0,1)==1)
%*************************************************************************************
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)
%*************************************************************************************
% differentiate Vb w.r.t. db and set equal to 0
diff_Vb_db = diff(Vb, db) == 0
isolate(diff_Vb_db, db)
3 件のコメント
Walter Roberson
2023 年 2 月 26 日
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.
採用された回答
Paul
2023 年 2 月 26 日
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 = simplify(eqn)
eqn = expand(eqn)
eqn = subs(eqn,int(f(z),z,0,1),1)
eqn = beta/db - simplify(solve(eqn,beta)/db) == 0
12 件のコメント
Paul
2023 年 2 月 27 日
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
symType(x*y)
We see that x*y is an expression, so it should be assumable
assume(x*y == 1);
assumptions
It is. And the assumption yields the expected result
simplify(x*y)
Now try with int
syms f(z)
symType(int(f(z),z,0,1))
Also an expression. But this expression is not assumable
assume(int(f(z),z,0,1) == 1)
assumptions
What's the difference between x*y and the int(...) expressions as far as assume() is concerned?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Assumptions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!