If you enter
the Xcas will return it unevaluated, since Xcas doesn’t know what type of value the variable is supposed to represent.
The assume (or supposons) command will let you tell Xcas some properties of a variable without giving the variable a specific value. For example, if you enter
then Xcas will assume that var is a positive real number, and so for example
will be evaluated to
You can put one or more conditions in the assume command by combining them with and and or. For example, if you want the variable a to be in [2,4) ∪ (6,∞), you can enter
If a variable has attached assumptions, then making another assumption with assume will remove the original assumptions. To add extra assumptions, you can either use the additionally command or give assume a second argument of additionally. If you assume that b > 0 with
and you want to add the condition that b < 1, you can either enter
As well as equalities and inequalities, you can make assumptions about the domain of a variable. If you want n to represent a positive integer, for example, you can enter
If you want n to be a positive integer, you can add the condition
You can use the about command to check the assumptions on a variable; for the above positive integer n, if you enter
you will get
The first element tells you that n is an integer, the second element tells you that n is between 0 and +infinity, and the third element tells you that the value 0 is excluded.
If you assume that a variable is equal to a specific value, such as
then by default the variable c will remain unevaluated in later levels. If you want an expression involving c to be evaluated, you would need to put the expression inside the evalf command; if you enter
then you will get
Right below the assume(c = 2) command line there will be a slider, namely arrows pointing left and right with the value 2 between them. These can be used to change the values of c. If you click on the right arrow, the assume(c = 2) command will transform to
and the value between the arrows will be 2.2. Also, any later levels where the variable c is evaluated will be re-evaluated with the value of c now 2.2. The output to evalf(c^2 + 3 will become
The -10.0 and 10.0 in the assume line represent the smallest and largest values that c can become using the sliders. You can set them yourself in the assume command, as well as the increment that the value will change; if you want c to start with the value 5 and vary between 2 and 8 in increments of 0.05, then you can enter
You can remove any assumptions you have made about a variable with the purge command; if you enter
then a will no longer have any assumptions made about it. You can remove assumptions from more than one variable at a time;
will remove any assumptions about a and b.