@sym: x = assume (x, cond, cond2, …) ¶@sym: x = assume (x, 'clear') ¶@sym: [x, y] = assume ([x y], …) ¶@sym: assume (x, cond, cond2, …) ¶@sym: assume (x, 'clear') ¶@sym: assume ([x y], …) ¶New assumptions on a symbolic variable (replace old if any).
This function has two different behaviours depending on whether it has an output argument or not. The first form is simpler; it returns a new sym with assumptions given by cond, for example:
syms x
x1 = x;
x = assume(x, 'positive');
assumptions(x)
  ⇒ ans =
    {
      [1,1] = x: positive
    }
assumptions(x1)  % empty, x1 still has the original x
  ⇒ ans = {}(0x0)
Another example to help clarify:
x1 = sym('x', 'positive')
  ⇒ x1 = (sym) x
x2 = assume(x1, 'negative')
  ⇒ x2 = (sym) x
assumptions(x1)
  ⇒ ans =
    {
      [1,1] = x: positive
    }
assumptions(x2)
  ⇒ ans =
    {
      [1,1] = x: negative
    }
The second form—with no output argument—is different; it attempts to find all instances of symbols with the same name as x and replace them with the new version (with cond assumptions). For example:
syms x
x1 = x;
f = sin(x);
assume(x, 'positive');
assumptions(x)
  ⇒ ans =
    {
      [1,1] = x: positive
    }
assumptions(x1)
  ⇒ ans =
    {
      [1,1] = x: positive
    }
assumptions(f)
  ⇒ ans =
    {
      [1,1] = x: positive
    }
To clear assumptions on a variable use assume(x, 'clear'), for example:
syms x positive f = sin (x); assume (x, 'clear') isempty (assumptions (f)) ⇒ ans = 1
Warning: the second form operates on the caller’s
workspace via evalin/assignin.  So if you call this from other
functions, it will operate in your function’s workspace (and not
the base workspace).  This behaviour is for compatibility
with other symbolic toolboxes.
FIXME: idea of rewriting all sym vars is a bit of a hack, not well tested (for example, with global vars.)
See also: @@sym/assumeAlso, assume, assumptions, sym, syms.
Package: symbolic