I think that's a misreading of the Tip wrt to the "symbolic variables" the tip is referencing. In that context, the symbolic variables are referencing the variables in the input to the assume command.
For example:
syms x y
class(x), class(y)
ans = 'sym'
ans = 'sym'
assumptions
ans =
Empty sym: 1-by-0
assume(x,'positive')
assumptions
ans =
assume(y,'integer'); % doesn't change assumption on x
assumptions
ans =
assume(x,'real'); % removes previous assumption on x, doesn't change assumption on y
assumptions
ans =
However, assume() seems to work differently when the inputs are symfun, rather than sym
syms x(t) y(t)
class(x)
ans = 'symfun'
class(y)
ans = 'symfun'
assumptions % all assumptions cleared on x and y after call to syms
ans =
Empty sym: 1-by-0
assume(x(t),'positive')
assumptions
ans =
Here, adding an assumption on y(t), which I assume is treated as a symbolic expression by assume, does remove assumptions on x. i don't understand why that is the case.
assume(y(t),'integer'); % does change assumption on x?
That is because the symbolic functions are functions of the same symbolic variable - The assumptions are set on the independent variables, because the function is dependent on them as well.
((( This is not explicitly mentioned in the documentation, but is my understading, additionally, based on this statement in the tips section - "The toolbox does not support assumptions on symbolic functions. Set assumptions on symbolic variables and expressions instead." )))
Here, I have used a different independent variable to define y -
syms x(t) y(s)
class(x)
ans = 'symfun'
class(y)
ans = 'symfun'
assumptions
ans =
Empty sym: 1-by-0
assume(x(t),'positive')
assumptions
ans =
assume(y(s),'integer')
assumptions
ans =
As you can see, the assumption on x(t) is not affected.
When you change the assumption w.r.t to independent variables, the assumptions on any depending variables/functions also gets cleared -
I was wondering about exactly this, i.e., how y(t) is treated by assume(). I said "[y(t)] is treated as a symbolic expression", because I saw that symfun is not listed as an allowable input to assume, but y(t) is, or appears to be, an expression
syms y(t)
isSymType(y(t),'expression')
ans = logical
1
This works
assume(y(t),'positive')
z(t) = 2*y(t);assumptions
ans =
isAlways(z(t)>0)
ans = logical
1
which suggests that y(t) is being treated as an expression.
But this throws an error
try
assume(y,'real')
catch ME
ME.message
end
ans = 'Assumptions on symbolic functions not supported. Make assumptions on symbolic variables and expressions instead.'
presumably because the class of y ( not y(t) ) is a symfun.
I suspect that your other observation about the interaction between the independent variable in the expression y(t) is really at the heart of this situation.
Based on the evidence, when the doc says: "assume removes any assumptions previously set on the symbolic variables."
perhaps it should say: "assume removes any assumptions previously set on the symbolic variables and removes assumptions previously set on any expressions that contain the symbolic variables"
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Translated by
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.