In Maple and in Mupad, one would use the subs command to substitute a variable by a value in an expression. But the order of the arguments differ between Maple and Mupad. Therefore, to achieve compatibility, Xcas subs command arguments order depends on the mode
subs returns the expression with the substitution done.
Note that subs does not quote its argument, hence
in a normal evaluation process, the substitution variable should
be purged otherwise it will be replaced by its assigned value
before substitution is done.
Input in Maple mode (if the variable a is purged else input
purge(a)) :
^
2+1)Output
^
2+1Input in Maple mode (if the variables a and b are purged else input purge(a,b)):
^
2+b)Output :
^
2+1Input :
^
2+1,a=2)or :
^
2+1,a,2)Output (if the variable a is purged else input purge(a)) :
Input :
^
2+b,[a=2,b=1])or :
^
2+b,[a,b],[2,1])Output (if the variables a and b are purged else input purge(a,b)) :
^
2+1