Assumption on another symbolic Variable affecting a previous assumption

조회 수: 1 (최근 30일)
Why is the assumption I made being changed by the next assumption I do on another variable ?
The assumpitons on Phi_geod and Phi_dot_geod are being changed by the assumptions on the variables lambda_geod and lambda_dot_geod.
Code:
syms Phi_geod(t) lambda_geod(t)
syms Phi_dot_geod(t) lambda_dot_geod(t)
assumptions(Phi_geod)
ans = Empty sym: 1-by-0
assume(Phi_geod(t),"real");
assumptions(Phi_geod)
ans = 
assume(lambda_geod(t),"real");
assumptions(Phi_geod)
ans = 
assume(Phi_dot_geod(t),"real");
assume(lambda_dot_geod(t),"real");
assumptions(Phi_geod)
ans = 

채택된 답변

Dyuman Joshi
Dyuman Joshi 2024년 4월 4일
Because assume over-writes assumptions.
From the Tips section in the documentation page -
"assume removes any assumptions previously set on the symbolic variables. To retain previous assumptions while adding an assumption, use assumeAlso."
As mentioned in the note above, you need to use assumeAlso, after using assume() the first time.
syms Phi_geod(t) lambda_geod(t)
syms Phi_dot_geod(t) lambda_dot_geod(t)
assumptions(Phi_geod)
ans = Empty sym: 1-by-0
assume(Phi_geod(t),"real");
assumptions(Phi_geod)
ans = 
assumeAlso(lambda_geod(t),"real");
assumptions(Phi_geod)
ans = 
assumeAlso(Phi_dot_geod(t),"real");
assumeAlso(lambda_dot_geod(t),"real");
ans = 
assumptions(Phi_geod)
ans = 
  댓글 수: 5
Dyuman Joshi
Dyuman Joshi 2024년 4월 5일
편집: Dyuman Joshi 2024년 4월 5일
Yes, the class of y is symfun and the class of y(t) is not symfun.
And yes, the statement should be more precise as you have stated.
syms y(t)
class(y)
ans = 'symfun'
class(y(t))
ans = 'sym'
try
assume(y(t),'real')
catch ME
ME.message
end
assumptions
ans = 
try
assume(y,'real')
catch ME
ME.message
end
ans = 'Assumptions on symbolic functions not supported. Make assumptions on symbolic variables and expressions instead.'
y(t) = t^2;
%returns the function definition
y
y(t) = 
%returns the expression
y(t)
ans = 
Christian Luciano Maendle
Christian Luciano Maendle 2024년 4월 5일
Thank you very much! This constructive discussion has made it very clear to me. Thank you for your help! :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by