6.23.26 Rewriting an expression with different options: convert convertir =>
Xcas has many commands to convert expressions into different
forms; the convert command (or its infixed version
=>) is a different way to call many of these functions.
-
convert takes two or more arguments:
-
expr, an expression.
- option, an option specifying which rewrite rules to
use. A third argument might be necessary for some options.
Possible values of option are:
-
sin, to convert an expression like trigsin
(see Section 6.23.23).
- cos, to convert an expression like trigcos
(see Section 6.23.24).
- sincos, to convert an expression like sincos
(see Section 6.23.13).
- trig, to convert an expression like sincos
(see Section 6.23.13).
- tan, to convert an expression like halftan
(see Section 6.23.19).
- exp, to convert an expression like trig2exp
(see Section 6.23.21).
- ln, to convert an expression like trig2exp
(see Section 6.23.21).
- expln, to convert an expression like trig2exp
(see Section 6.23.21).
- string, to convert a expression into a string.
- matrix, to convert a list of lists into a matrix.
- array, to turn a table into an array (see
Section 6.46.1).
- polynom, to convert a series (see Section 6.36.2)
into a polynomial
by removing the remainder (see Section 6.27.25) or
to convert a list representing a polynomial into a polynomial
in internal sparse multivariate form (see
Section 6.27.2 and Section 6.27.6).
- parfrac (or partfrac or fullparfrac), to convert a rational
function into its partial fraction decomposition (see
Section 6.32.9).
- interval, to convert an expression which evaluates to a
number into an interval (see Section 6.38.8).
- list (or no argument), to convert a polynomial in
internal sparse multivariate format (see Section 6.27.2)
into a list.
- unit, a unit, to convert a unit object to a new
compatible unit (see Section 11.1.4).
The values of option that require a third argument:
-
contfrac, to convert a number into a continued
fraction. (See Section 6.7.7.) The third argument
will be the name of a variable to store the continued fraction
into (which must be quoted the variable was assigned).
- base, to convert a number into a different base
(beginning with the units digit). If expr is a number,
then the third argument will be base to convert to (see
Section 6.4.2), if expr is a list of
numbers, then the third argument will be the base to convert
from (and expr will be a list of the digits in this
base, starting with the units digit).
Finally, if expr is an expression with units (see
Section 11.1.1), then option can be new units to convert to
(see Section 11.1.4).
- convert(expr,option[,extraop])
returns the expression with the requested conversions done.
Examples.