5.21.24 Rewrite an expression with different options : convert convertir
convert takes two arguments an expression and an option.
convert rewrites this expression applying rules depending
on the option. Valid options are :
-
sin converts an expression like trigsin.
- cos converts an expression like trigcos.
- sincos converts an expression like sincos.
- trig converts an expression like sincos.
- tan converts an expression like halftan.
- exp converts an expression like trig2exp.
- ln converts an expression like trig2exp.
- expln converts an expression like trig2exp.
- string converts an expression into a string.
- matrix converts a list of lists into a matrix.
- polynom converts a Taylor series into a polynomial
by removing the remainder (cf 5.25.22).
- parfrac or partfrac or fullparfrac converts a rational
fraction into its partial fraction decomposition (5.29.9).
convert can also :
-
convert units, for example
convert(1000_g,_kg)=1.0_kg (cf 8.1.4).
- write a real as a continued fraction :
convert(a,confrac,’fc’) writes a as a continued fraction
stored in fc. Do not forget to quote the last argument if it
was assigned.
For example, convert(1.2,confrac,’fc’)=[1,5] and fc contains the
continued fraction equal to 1.2 (cf 5.8.7).
- transform an integer into the list of its digits in a
base, beginning with the units digit (and reciprocally)
-
convert(n,base,b) transforms the integer n into the list of its
digits in base b beginning with the units digit.
For example,
convert(123,base,10)=[3,2,1] and reciprocally
- convert(l,base,b) transforms the list l into the integer n
which has l as list of its
digits in base b beginning with the units digit.
For example,
convert([3,2,1],base,10)=123 (cf 5.5).