The as_function_of command creates a function defined by an expression, even if the desired variable already has a value.
Example.
Input:
Output:
sin | ⎛ ⎝ | x | ⎞ ⎠ |
Input:
Output:
√ |
|
Input:
Output:
Input:
Output:
√ |
|
Warning !!
If the variable b has been assigned several times, the first
assignment of b following the last assignment of a
will be used. Moreover, the order used is the order of validation of
the commandlines, which may not be reflected by the Xcas interface if
you reused previous commandlines.
Example.
Input:
a:=2 b:=2*a+1 b:=3*a+2 c:=as_function_of(b,a) |
Output:
So c(x) is equal to 2*x+1. But: Input:
a:=2 |
b:=2*a+1 |
a:=2 |
b:=3*a+2 |
c:=as_function_of(b,a) |
Output:
So c(x) is equal to 3*x+2.
Hence the line where a is defined must be reevaluated before the good
definition of b.