Assumption on another symbolic Variable affecting a previous assumption

1 visualización (últimos 30 días)
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 = 

Respuesta aceptada

Dyuman Joshi
Dyuman Joshi el 4 de Abr. de 2024
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 comentarios
Dyuman Joshi
Dyuman Joshi el 5 de Abr. de 2024
Editada: Dyuman Joshi el 5 de Abr. de 2024
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 el 5 de Abr. de 2024
Thank you very much! This constructive discussion has made it very clear to me. Thank you for your help! :)

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by