Symbolic algebra and Mathematics with Xcas

# Symbolic algebra and Mathematics with `Xcas` ### Renée De Graeve, Bernard Parisse University of Grenoble I

© 2002, 2007 Renée De Graeve, Bernard Parisse
`renee.degraeve@wanadoo.fr`
`bernard.parisse@ujf-grenoble.fr`

# Contents

# Chapter 1 Index

# Index

, 2.2.3 ’, 2.12.3 ’*’, 2.16.1 ’+’, 2.11.1, 2.14.1, 2.16.1 ’-’, 2.11.1, 2.14.1, 2.16.1 ’/’, 2.16.1 (), 2.35.1 *, 2.16.1, 2.31.4, 2.38.7, 2.42.3 +, 2.4.9, 2.4.10, 2.11.1, 2.14.1, 2.16.1, 2.31.2, 2.35.7, 2.38.3, 2.42.2 +,-,*,/,^, 2.9.2 +infinity, 2.1 ,, 2.35.2 -, 2.11.1, 2.14.1, 2.16.1, 2.31.3, 2.38.4, 2.42.2 ->, 2.15.1 -infinity, 2.1 .*, 2.38.5, 2.42.9 .+, 2.38.3, 2.42.2 .-, 2.38.4, 2.42.2 .., 2.34.1, 2.35.4 ./, 2.38.6, 2.42.10 .^, 2.42.11 /, 2.16.1, 2.31.8, 2.31.11, 2.43.2 :=, 2.15.1 <, 2.2.2 <=, 2.2.2 ==, 2.2.2 >, 2.2.2 >=, 2.2.2 [], 2.34.2, 2.35.3, 2.35.4, 2.35.6, 2.37, 2.37.12 2.14.2, 2.16.4 2.14.2, 2.16.5 $, 2.14.2, 2.17.5, 2.35.5 %, 2.6.11, 2.14.2, 2.31, 2.32 %{ %}, 2.36.1 &*, 2.42.3 &&, 2.2.3 &^, 2.42.7 ^, 2.11.1, 2.14.1, 2.31.9, 2.42.7 _, 5.1.1, 5.2.1 !, 2.7.1 !=, 2.2.2, 2.2.3 ", 2.4.1 Airy_Ai, 2.9.11 Airy_Bi, 2.9.11 a2q, 2.49.2 abcuv, 2.25.12 about, 2.22.1 abs, 2.11.5, 2.16.2 acos, 2.16.2, 2.21.1 acos2asin, 2.21.6 acos2atan, 2.21.7 acosh, 2.16.2 acot, 2.21.1 acsc, 2.21.1 add, 2.37.29 adjoint_matrix, 2.46.9 algvar, 2.54.4 and, 2.2.3 animate, 3.17.1 animate3d, 3.17.2 animation, 3.17.3 append, 2.37.16 apply, 2.37.32 approx, 4.2 arccos, 2.16.2, 2.21.1 arccosh, 2.16.2 arcLen, 2.17.2 arcsin, 2.16.2, 2.21.1 arcsinh, 2.16.2 arctan, 2.16.2, 2.21.1 arctanh, 2.16.2 areaplot, 3.7 arg, 2.11.6 as_function_of, 2.16.6 asc, 2.4.5 asec, 2.21.1 asin, 2.16.2, 2.21.1 asin2acos, 2.21.8 asin2atan, 2.21.9 asinh, 2.16.2 assume, 2.22.1, 2.22.1 at, 2.37.2, 2.42.12 atan, 2.16.2, 2.21.1 atan2acos, 2.21.11 atan2asin, 2.21.10 atanh, 2.16.2 atrig2ln, 2.21.18 augment, 2.37.15, 2.42.23 Beta, 2.9.8 Binary, 2.14.3 BlockDiagonal, 2.41.4 barycentre, 2.11.10 base, 2.5 basis, 2.43.9 bernoulli, 2.8.9 binomial, 2.7.2 bisection_solver, 4.4.1 bitand, 2.3.1 bitor, 2.3.1 bitxor, 2.3.1 black, 3.1.1 blockmatrix, 2.42.21 blue, 3.1.1 border, 2.42.26 boxwhisker, 2.39, 2.42.31 brent_solverbrent_solver, 4.4.2 c1oc2, 2.10.11 c1op2, 2.10.9 canonical_form, 2.12.6 cat, 2.4.8, 2.4.10 ceil, 2.16.2 ceiling, 2.16.2 center2interval, 2.34.4 cFactor, 2.12.10 changebase, 2.43.8 char, 2.4.6 charpoly, 2.46.6 chinrem, 2.25.13 cholesky, 2.48.1 chrem, 2.6.23 coeff, 2.24.3 coeffs, 2.24.3 col, 2.42.14 colDim, 2.42.34 coldim, 2.42.34 collect, 2.24.12 colNorm, 2.45.4 colnorm, 2.45.4 color, 3.1.1 , 4.4.2 colspace, 2.43.14 comb, 2.7.2 combine, 2.20.2 comDenom, 2.28.7 companion, 2.46.10 complexroot, 2.29.1 concat, 2.37.15, 2.42.23 confrac, 2.8.7 conique, 2.49.5 conique_reduite, 2.49.6 conj, 2.11.8 contains, 2.37.24 content, 2.24.10 contourplot, 3.8 convert, 2.5, 2.21.23, 2.24.22, 5.1.4 convertir, 2.21.23, 2.24.22 cos, 2.21.1 cos, 2.20.2, 2.21.23 cosh, 2.16.2, 2.16.2 cot, 2.21.1 count, 2.37.25, 2.42.27 count_eq, 2.37.26, 2.42.28 count_inf, 2.37.27, 2.42.29 count_sup, 2.37.28, 2.42.30 courbe_polaire, 3.12 crationalroot, 2.29.4 cross, 2.38.8 crossP, 2.38.8 crossproduct, 2.38.8 cSolve, 2.51.7 csc, 2.21.1 cumSum, 2.4.3, 2.37.30, 2.42.5 curl, 2.50.5 cyan, 3.1.1 cycle2perm, 2.10.4 cycleinv, 2.10.14 cycles2permu, 2.10.3 cyclotomic, 2.25.14 cZzeros, 2.12.12 Delete, 2.14.3 Det, 2.32.5 DIGITS, 2.9.1, 4.2 Digits, 2.9.1, 4.2 DrawFunc, 3.2 DrawParm, 3.11, 3.11.2 DrawPol, 3.12 DrwCtour, 3.8 degree, 2.24.4 delcols, 2.42.15 delrows, 2.42.15 deltalist, 2.37.37 denom, 2.8.4, 2.28.4 densityplot, 3.9 derive, 2.17.5, 2.50.1 deriver, 2.17.5, 2.50.1 deSolve, 2.53.1 desolve, 2.53.1 det, 2.31.15, 2.43.4 det_minor, 2.43.5 dfc, 2.8.7 dfc2f, 2.8.8 diag, 2.41.4 diff, 2.17.5, 2.50.1 dim, 2.42.32 display, 3.1.1 divergence, 2.50.4 divide, 2.25.6 divis, 2.25.1 divisors, 2.6.9 divpc, 2.33.1 dnewton_solverdnewton_solver, 4.5.1 dot, 2.38.7 dotP, 2.38.7 dotprod, 2.38.7 droit, 2.51.5 dsolve, 2.53.1 e, 2.1 e2r, 2.24.2 egcd, 2.25.11 egv, 2.46.3 egvl, 2.46.2 eigenvals, 2.46.1 eigenvalues, 2.46.2 eigenvectors, 2.46.3 eigenvects, 2.46.3 eigVc, 2.46.3 eigVl, 2.46.2 epsilon, 2.54.1 epsilon2zero, 2.54.1 equal, 2.51.1 equal2diff, 2.51.2 equal2list, 2.51.3 erf, 2.9.5 erfc, 2.9.6 euler, 2.6.25 eval, 2.12.1 evala, 2.12.2 evalb, 2.2.5 evalc, 2.11.4 evalf, 2.8.1, 2.9.1, 2.54.6, 4.2 evalm, 2.42.1 even, 2.6.13 exact, 2.8.1, 2.54.7 exp, 2.16.2 exp, 2.20.2, 2.21.23 exp2list, 2.2.4 exp2pow, 2.23.8 exp2trig, 2.21.12 expand, 2.12.5 expexpand, 2.23.2 expln, 2.21.23 expr, 2.4.11 ezgcd, 2.25.9 FALSE, 2.2.1 Factor, 2.32.4 f2nd, 2.8.5, 2.28.5 factor, 2.12.9, 2.24.13, 2.31.14, 2.31.19 factor_xn, 2.24.9 factorial, 2.6.1, 2.7.1 factoriser, 2.24.13, 2.31.14 factors, 2.24.15 false, 2.2.1 falsepos_solverfalsepos_solver, 4.4.3 fcoeff, 2.30.2 fdistrib, 2.12.5 feuille, 2.15.3, 2.34.2 fft, 2.22.3 fieldplot, 3.14 filled, 3.1.1 float2rational, 2.8.1, 2.54.7 floor, 2.16.2 fMax, 2.17.3 fMin, 2.17.3 fourier_an, 2.22.1 fourier_bn, 2.22.1 fourier_cn, 2.22.1 fPart, 2.16.2 frac, 2.16.2 fracmod, 2.31.12 frames, 3.17.1, 3.17.2 froot, 2.30.1 fsolve, 4.4, 4.5 fullparfrac, 2.21.23 funcplot, 3.2 function_diff, 2.17.1 fxnd, 2.8.5, 2.28.5 Gamma, 2.9.7 Gcd, 2.6.3, 2.25.8, 2.32.3 GF, 2.31.18 Graph, 3.2 gauche, 2.51.4 gauss, 2.49.3 gaussjord, 2.52.3 gbasis, 2.27.1 gcd, 2.6.2, 2.25.7, 2.31.13 gcdex, 2.25.11 genpoly, 2.27.3 getDenom, 2.8.4, 2.28.3 getNum, 2.8.3, 2.28.1 grad, 2.50.1 gramschmidt, 2.49.4 graphe_suite, 3.13 greduce, 2.27.2 green, 3.1.1 groupermu, 2.10.16 hadamard, 2.42.8 halftan, 2.21.16 halftan_hyp2exp, 2.21.17 hamdist, 2.3.2 has, 2.54.5 hasard, 2.7.4 head, 2.4.2, 2.37.4 hermite, 2.26.2 hessenberg, 2.46.11 hessian, 2.50.3 heugcd, 2.25.9 hilbert, 2.41.6 hold, 2.12.3 horner, 2.24.16 hybrid_solverhybrid_solver, 4.5.2 hybridj_solverhybridj_solver, 4.5.5 hybrids_solverhybrids_solver, 4.5.3 hybridsj_solverhybridsj_solver, 4.5.6 hyp2exp, 2.23.1 Int, 2.18.1 Inverse, 2.32.6 i, 2.1 iabcuv, 2.6.21 ibasis, 2.43.10 ibpdv, 2.18.4 ibpu, 2.18.4 ichinrem, 2.6.22 ichrem, 2.6.22 id, 2.16.2 identity, 2.41.1 idivis, 2.6.9 idn, 2.41.1 iegcd, 2.6.20 ifactor, 2.6.6 ifactors, 2.6.7 ifft, 2.22.4 igcd, 2.6.2 igcdex, 2.6.20 ihermite, 2.46.12 ilaplace, 2.53.2 im, 2.11.3 imag, 2.11.3 image, 2.43.11 implicitplot, 3.10 indets, 2.54.2 inequationplot, 3.6 infinity, 2.1 inString, 2.4.7 int, 2.18.1 intDiv, 2.6.10 | integer, 2.22.1 integrate, 2.18.1 interactive_odeplot, 3.16 interactive_plotode, 3.16 interp, 2.24.26 intersect, 2.36.3 interval2center, 2.34.3 inv, 2.31.11, 2.31.16, 2.43.2 inverse, 2.31.16 iPart, 2.16.2 iquo, 2.6.10 iquorem, 2.6.12 irem, 2.6.11 is_cycle, 2.10.7 is_permu, 2.10.6 is_prime, 2.6.16 is_pseudoprime, 2.6.15 ismith, 2.46.13 isom, 2.47.1 ithprime, 2.6.19 JordanBlock, 2.41.5 jacobi_symbol, 2.6.27 jordan, 2.46.5 ker, 2.43.12 kernel, 2.43.12 LineHorz, 3.5.2 LineTan, 3.5.4 LineVert, 3.5.3 LU, 2.48.5 l1norm, 2.38.1 l2norm, 2.38.1, 2.45.1 lagrange, 2.24.26 laguerre, 2.26.3 laplace, 2.53.2 laplacian, 2.50.2 lcm, 2.6.5, 2.25.10 lcoeff, 2.24.6 ldegree, 2.24.5 left, 2.34.2, 2.51.4 legendre, 2.26.1 legendre_symbol, 2.6.26 length, 2.37.13 lgcd, 2.6.4 lhs, 2.51.4 limit, 2.19.1, 2.19.2 limite, 2.19.2 lin, 2.23.4 line, 3.5.1 linsolve, 2.52.6 list2mat, 2.37.38 lll, 2.48.7 ln, 2.16.2 ln, 2.20.2, 2.21.23 lname, 2.54.2 lncollect, 2.23.5 lnexpand, 2.23.3 log, 2.16.2 log, 2.20.2 log10, 2.16.2 logb, 2.16.2 lu, 2.48.4 lvar, 2.54.3 magenta, 3.1.1 makelist, 2.37.35 makemat, 2.42.24 makesuite, 2.37.11 makevector, 2.37.12 map, 2.37.32 maple_ifactors, 2.6.8 mat2list, 2.37.39, 2.37.39 matrix, 2.42.25 matrix, 2.21.23 max, 2.16.2 maxnorm, 2.38.1, 2.45.2 mean, 2.39, 2.42.31 median, 2.39, 2.42.31 member, 2.37.23 mid, 2.4.2, 2.37.3, 2.37.3 min, 2.16.2 minus, 2.36.4 mkisom, 2.47.2 mksa, 5.1.3 mod, 2.6.11, 2.32 modgcd, 2.25.9 mods, 2.6.11 mRow, 2.42.18 mRowAdd, 2.42.19 mul, 2.37.31 mult_c_conjugate, 2.11.9 mult_conjugate, 2.12.7 Nullspace, 2.43.13 nCr, 2.7.2 ncols, 2.42.34 nDeriv, 4.3.2 newList, 2.37.34 newMat, 2.41.2 newton, 4.3.1 newton_solvernewton_solver, 4.4.4 newtonj_solvernewtonj_solver, 4.5.4 nextprime, 2.6.17 nInt, 4.3.3 nop, 2.35.6 nops, 2.37.13 norm, 2.38.1, 2.45.1 normal, 2.12.13, 2.31.1, 2.31.2, 2.31.3, 2.31.4, 2.31.9 normalize, 2.11.7, 2.38.2 not, 2.2.3 nPr, 2.7.3 nrows, 2.42.33 nSolve, 4.4 nstep, 3.2 nullspace, 2.43.12 numer, 2.8.3, 2.28.2 odd, 2.6.14 odeplot, 3.15 odesolve, 4.3.4, 4.3.5 of, 2.37.32 op, 2.15.3, 2.34.2, 2.37.11 or, 2.2.3 ord, 2.4.4 order_size, 2.33.2, 2.33.3 Psi, 2.9.9 p1oc2, 2.10.10 p1op2, 2.10.8 pa2b2, 2.6.24 pade, 2.33.5 paramplot, 3.11, 3.11.2 parfrac, 2.21.23 pari, 2.8.10 part, 2.12.19 partfrac, 2.28.9 partfrac, 2.21.23 pcar, 2.46.6 pcar_hessenberg, 2.46.7 pcoef, 2.24.20 pcoeff, 2.24.20 perm, 2.7.3 perminv, 2.10.13 permu2cycles, 2.10.2 permu2mat, 2.10.5, 2.48.4 permuorder, 2.10.15 peval, 2.24.8 phi, 2.6.25 pi, 2.1 pivot, 2.52.5 plot, 3.3 plot3d, 3.4 plotarea, 3.7 plotcontour, 3.8 plotdensity, 3.9 plotfield, 3.14 plotfunc, 2.17.4, 3.2 plotimplicit, 3.10 plotinequation, 3.6 plotode, 3.15 plotparam, 3.11, 3.11.2 plotpolar, 3.12 plotseq, 2.13.2, 3.13 pmin, 2.46.8 point_milieu, 3.7 polarplot, 3.12 poly2symb, 2.24.1 polyEval, 2.24.8 polynom, 2.21.23, 2.24.22 potential, 2.50.6 pow2exp, 2.23.7 powermod, 2.31.10 powexpand, 2.23.6 powmod, 2.31.10 prepend, 2.37.17 preval, 2.12.18 prevprime, 2.6.18 primpart, 2.24.11 product, 2.37.31, 2.42.6, 2.42.8 proot, 4.6 propFrac, 2.8.2 propfrac, 2.8.2, 2.28.8 psrgcd, 2.25.9 ptayl, 2.24.17 purge, 2.22.1 QR, 2.48.3 Quo, 2.25.3, 2.32.1 q2a, 2.49.1 qr, 2.48.2 quadrique, 2.49.7 quadrique_reduite, 2.49.8 quantile, 2.39, 2.42.31 quartiles, 2.39, 2.42.31 quo, 2.25.2, 2.31.5 quorem, 2.25.6, 2.31.7 quote, 2.4.1, 2.12.3 Rem, 2.25.5, 2.32.2 Rref, 2.32.7 r2e, 2.24.1 rand, 2.7.4 randMat, 2.41.3 randmatrix, 2.41.3 randPoly, 2.24.23 randperm, 2.10.1 randpoly, 2.24.23 randvector, 2.37.36 rank, 2.43.6 ranm, 2.24.25, 2.41.3 rat_jordan, 2.46.4 rationalroot, 2.29.3 ratnormal, 2.12.15 rdiv, 2.9.3 re, 2.11.2 real, 2.11.2 realroot, 2.29.2 rectangle_droit, 3.7 rectangle_gauche, 3.7 red, 3.1.1 ref, 2.52.2 rem, 2.25.4, 2.31.6 remain, 2.6.11 remove, 2.37.22 reorder, 2.24.24 residue, 2.33.4 resoudre, 2.12.9, 2.50.1, 3.5.6 resultant, 2.25.19 reverse_rsolve, 2.52.7 revlist, 2.37.7 rhs, 2.51.5 right, 2.34.2, 2.51.5 romberg, 4.3.3 root, 2.9.4 rootof, 2.24.18 roots, 2.24.19 rotate, 2.37.8 round, 2.16.2 row, 2.42.14 rowAdd, 2.42.17 rowDim, 2.42.33 rowdim, 2.42.33 rowNorm, 2.45.3 rownorm, 2.45.3 rowSwap, 2.42.20 rowspace, 2.43.15 rref, 2.31.17, 2.52.3 SortA, 2.37.19 SortD, 2.37.20 scalar_product, 2.38.7 scalarProduct, 2.38.7 sec, 2.21.1 secant_solversecant_solver, 4.4.5 select, 2.37.21 semi_augment, 2.42.22 seq, 2.35.5 seq[], 2.35.1 seqplot, 3.13 series, 2.33.3 set[], 2.36.1 shift, 2.37.9 sign, 2.16.2 signature, 2.10.12 simp2, 2.8.6, 2.28.6 simplex_reduce, 2.44 simplify, 2.12.14, 2.21.5 simult, 2.52.4 sin, 2.16.2, 2.21.1 sin, 2.20.2, 2.21.23 sincos, 2.21.12 sincos, 2.21.23 sinh, 2.16.2 size, 2.37.13 sizes, 2.37.14 smod, 2.6.11 solve, 2.12.9, 2.50.1, 2.51.6, 3.5.6 sommet, 2.15.3, 2.34.2 sort, 2.37.18 spline, 2.24.27 split, 2.12.8 sq, 2.16.2 sqrfree, 2.24.14 sqrt, 2.16.2 stddev, 2.39, 2.42.31 stddevp, 2.39 steffenson_solversteffenson_solver, 4.4.6 string, 2.21.23 sturm, 2.25.15 sturmab, 2.25.16 sturmseq, 2.25.17 subMat, 2.42.16 subs, 2.12.17 subsop, 2.37.10, 2.42.13 subst, 2.12.16 sum, 2.18.2, 2.37.29, 2.42.4 sum_riemann, 2.18.3 suppress, 2.37.5 svd, 2.48.6 sylvester, 2.25.18 symb2poly, 2.24.2 syst2mat, 2.52.1 TRUE, 2.2.1 table, 2.40 tablefunc, 2.13.1, 2.17.4 tableseq, 2.13.2 tail, 2.4.2, 2.37.6 tan, 2.16.2, 2.21.1 tan, 2.21.23 tan2cossin2, 2.21.15 tan2sincos, 2.21.13 tan2sincos2, 2.21.14 tangent, 3.5.5 tanh, 2.16.2 taylor, 2.33.2 tCollect, 2.21.4 tchebyshev1, 2.26.4 tchebyshev2, 2.26.5 tcoeff, 2.24.7 tcollect, 2.21.4 tExpand, 2.20.1 texpand, 2.20.1 tlin, 2.21.3 trace, 2.43.3 tran, 2.43.1 transpose, 2.43.1 trapeze, 3.7 trig, 2.20.2 trig2exp, 2.21.19 trigcos, 2.21.21 trigexpand, 2.21.2 trigsin, 2.21.20 trigtan, 2.21.22 trn, 2.43.7 true, 2.2.1 trunc, 2.16.2 truncate, 2.24.21 tsimplify, 2.23.9 ufactor, 5.1.5 unapply, 2.15.2 unfactored, 3.10 union, 2.36.2 unitV, 2.11.7, 2.38.2 unquote, 2.12.4 user_operator, 2.14.3 usimplify, 5.1.6 valuation, 2.24.5 vandermonde, 2.41.7 variance, 2.39, 2.42.31 vpotential, 2.50.7 white, 3.1.1 xor, 2.2.3 xstep, 3.2 yellow, 3.1.1 ystep, 3.2 zeros, 2.12.11 zeta, 2.9.10 zip, 2.37.33 zstep, 3.2

# Chapter 2 The CAS functions

## 2.1 Symbolic constants : `e pi infinity i`

`e` is the number exp(1);
`pi` is the number π.
`infinity` is unsigned ∞.
`+infinity` is +∞.
`-infinity` is −∞.
`i` is the complex number i.

## 2.2 Booleans

- The values of a boolean : `true false`
- Tests : `==, !=, >, >=, <, =<`
- Boolean operators : `or xor and not`
- Transform a boolean expression as a list : `exp2list`
- Evaluate booleans : `evalb`

## 2.3 Operators bit to bit

- Operators `bitor, bitxor, bitand`
- Hamming distance bit to bit : `hamdist`

## 2.4 Strings

- Character and string : `"`
- First character, middle and end of a string : `head mid tail`
- Concatenation of a sequence of words : `cumSum`
- ASCII code of a character : `ord`
- ASCII code of a string : `asc`
- String defined by the ASCII codes of its characters : `char`
- Find a character in a string : `inString`
- Concat objects into a string : `cat`
- Add an object to a string : `+`
- Transform an integer into a string : `cat +`
- Transform a string into a number : `expr`

## 2.5 Write an integer in a b basis: `convert`

`convert` or `convertir` can do different kind of conversions depending on the option given as the second argument.

To convert an integer `n` into the list of its coefficients in a basis `b`, the option is `base`. The arguments of `convert` or `convertir` are an integer `n`, `base` and `b` the value of the basis.
`convert` or `convertir` returns the list of coefficients in a `b` basis of the integer `n` Input :

`convert(123,base,8)`

Output :

`[3,7,1]`

To check the answer, input `expr("0173")` or `horner(revlist([3,7,1]),8)` or `convert([3,7,1],base,8)` and output is `123`
Input :

`convert(142,base,12)`

Output :

`[10,11]`

To convert the list of coefficients in a basis `b` of an integer `n`, the option is also `base`. `convert` or `convertir` returns the integer `n`.
Input :

`convert([3,7,1],base,8)`

Or

`horner(revlist([3,7,1]),8)`

Output :

`123`

Input :

`convert([10,11],base,12)`

Or

`horner(revlist([10,11]),12)`

Output :

`142`

## 2.6 Integers (and Gaussian Integers)

For all functions in this section, you can use Gaussian integers (numbers of the form a+ib, where a and b in ℤ) in the place of integers.

- The factorial : `factorial`
- GCD : `gcd igcd`
- GCD : `Gcd`
- GCD of a list of integers : `lgcd`
- The least common multiple : `lcm`
- Decomposition into prime factors : `ifactor`
- List of prime factors : `ifactors`
- Matrix of factors : `maple_ifactors`
- The divisors of a number : `idivis divisors`
- The integer Euclidean quotient : `iquo intDiv`
- The integer Euclidean remainder : `irem remain smod mods mod %`
- Euclidean quotient and euclidean remainder of two integers : `iquorem`
- Test of evenness : `even`
- Test of oddness : `odd`
- Test of pseudo-primality : `is_pseudoprime`
- Test of primality : `is_prime isprime isPrime`
- The smallest pseudo-prime greater than `n` : `nextprime`
- The greatest pseudo-prime less than `n` : `prevprime`
- The `n`-th prime number : `ithprime`
- Bézout’s Identity : `iegcd igcdex`
- Solving au+bv=c in ℤ: `iabcuv`
- Chinese remainders : `ichinrem, ichrem`
- Chinese remainders for lists of integers : `chrem`
- Solving a2+b2=p in ℤ : `pa2b2`
- The Euler indicatrix : `euler phi`
- Legendre symbol : `legendre_symbol`
- Jacobi symbol : `jacobi_symbol`

## 2.7 Combinatory analysis

- Factorial : `factorial !`
- Binomial coefficients : `binomial comb nCr`
- Arrangements : `perm nPr`
- Random integers : `rand`

## 2.8 Rationals

- Transform a floating point number into a rational : `exact
  float2rational`
- Integer and fractional part : `propfrac propFrac`
- Numerator of a fraction after simplification : `numer`
  `getNum`
- Denominator of a fraction after simplification : `denom getDenom`
- Numerator and denominator of a fraction : `f2nd fxnd`
- Simplification of a pair of integers : `simp2`
- Continued fraction representation of a real : `dfc`
- Transform a continued fraction representation into a real : `dfc2f`
- The n-th Bernoulli number : `bernoulli`
- Access to PARI/GP commands: `pari`

## 2.9 Real numbers

- Eval a real at a given precision : `evalf` and `Digits`, `DIGITS`)
- Usual infixed functions on reals : `+,-,*,/,^`
- Usual prefixed functions on reals : `rdiv`
- n-th root : `root`
- Error function : `erf`
- Complementary error function: `erfc`
- The Γ function : `Gamma`
- The β function : `Beta`
- Derivatives of the DiGamma fonction : `Psi`
- The ζ function : `Zeta`
- Airy functions : `Airy_Ai` and `Airy_Bi`

## 2.10 Permutations

A permutation p of size n is a bijection from [0..n−1] on [0..n−1] and is represented by the list : [p(0),p(1),p(2)...p(n−1)].
For example, the permutation p represented by [1,3,2,0] is the application from [0,1,2,3] on [0,1,2,3] defined by :

p(0)=1, p(1)=3, p(2)=2, p(3)=0

A cycle c of size p is represented by the list [a0,...,ap−1] (0≤ ak≤ n−1) it is the permutation such that

c(ai)=ai+1 for (i=0..p−2), c(ap−1)=a0, c(k)=k otherwise

A cycle c is represented by a list and a cycle decomposition is represented by a list of lists.
For example, the cycle c represented by the list [3,2,1] is the permutation c defined by c(3)=2, c(2)=1, c(1)=3, c(0)=0 (i.e. the permutation represented by the list [0,3,1,2]).

- Random permutation : `randperm`
- Decomposition as a product of disjoint cycles :
  `permu2cycles`
- Product of disjoint cycles to permutation: `cycles2permu`
- Transform a cycle into permutation : `cycle2perm`
- Transform a permutation into a matrix : `permu2mat`
- Checking for a permutation : `is_permu`
- Checking for a cycle : `is_cycle`
- Product of two permutations : `p1op2`
- Composition of a cycle and a permutation : `c1op2`
- Composition of a permutation and a cycle : `p1oc2`
- Product of two cycles : `c1oc2`
- Signature of a permutation : `signature`
- Inverse of a permutation : `perminv`
- Inverse of a cycle : `cycleinv`
- Order of a permutation : `permuorder`
- Group generated by two permutations : `groupermu`

## 2.11 Complex numbers

Note that complex numbers are also used to represent a point in the plan or a 1-d function graph.

- Usual complex functions : `+,-,*,/,^`
- Real part of a complex number : `re real`
- Imaginary part of a complex number : `im imag`
- Write a complex as `re(z)+i*im(z)` : `evalc`
- Modulus of a complex number : `abs`
- Argument of a complex number : `arg`
- The normalized complex number : `normalize unitV`
- Conjuguate of a complex number : `conj`
- Multiplication by the complex conjugate :
  `mult_c_conjugate`
- Barycenter of complex numbers : `barycentre`

## 2.12 Algebraic expressions

- Evaluate an expression : `eval`
- Evaluate algebraic expressions : `evala`
- Prevent evaluation : `quote hold ’`
- Force evaluation : `unquote`
- Distributivity : `expand fdistrib`
- Canonical form : `canonical_form`
- Multiplication by the conjugate quantity :
  `mult_conjugate`
- Separation of variables : `split`
- Factorisation : `factor`
- Complex factorisation : `cFactor`
- Zeros of an expression : `zeros`
- Complex zeros of an expression : `cZeros`
- Normal form : `normal`
- Simplify : `simplify`
- Normal form for rational fractions : `ratnormal`
- Substitue a variable by a value : `subst`
- Substitue a variable by a value (Maple and Mupad compatibility) : `subs`
- Evaluate a primitive at boundaries: `preval`
- Sub-expression of an expression : `part`

## 2.13 Values of un

- Array of values of a sequence : `tablefunc`
- Table of values and graph of a recurrent sequence : `tableseq` and `plotseq`

## 2.14 Operators or infixed functions

An operator is an infixed function.

- Usual operators :`+, -, *, /, ^`
- `Xcas` operators
- Define an operator: `user_operator`

## 2.15 Functions and expressions with symbolic variables

- Difference between function and expression
- Transform an expression into a fonction : `unapply`
- Top and leaves of an expression : `sommet feuille op`

## 2.16 Functions

- Context-dependant functions.
  - Operators `+` and `-`
  - Operator `*`
  - Operator `/`
- Usual functions
- Defining algebraic functions
  - Defining a function from ℝp to ℝ
  - Defining a function from ℝp to ℝq
  - Defining families of function from ℝp−1 to ℝq using a function from ℝp to ℝq
- Composition of two functions: `@`
- Repeted function composition: `@@`
- Define a fonction with the history : `as_function_of`

## 2.17 Derivation and applications.

- Functional derivative : `function_diff`
- Length of an arc : `arcLen`
- Maximum and minimum of an expression: `fMax fMin`
- Table of values and graph : `tablefunc` and `plotfunc`
- Derivative and partial derivative
  - Derivative and first order partial derivative : `diff derive deriver`
  - Derivative and n-th order partial derivative : `diff derive deriver`

## 2.18 Integration

- Antiderivative and definite integral : `integrate int Int`
- Discrete summation: `sum`
- Riemann sum : `sum_riemann`
- Integration by parts : `ibpdv` et `ibpu`
  - `ibpdv`
  - `ibpu`
- Change of variables : `subst`

## 2.19 Limits

- Limites : `limit`
- Integral and limit

## 2.20 Rewriting transcendental and trigonometric expressions

- Expand a transcendental and trigonometric expression : `texpand tExpand`
- Combine terms of same type : `combine`

## 2.21 Trigonometry

- Trigonometric functions
- Expand a trigonometric expression : `trigexpand`
- Linearize a trigonometric expression : `tlin`
- Put together sine and cosine of the same angle : `tcollect tCollect`
- Simplify : `simplify`
- Transform arccos into arcsin : `acos2asin`
- Transform arccos into arctan : `acos2atan`
- Transform arcsin into arccos : `asin2acos`
- Transform arcsin into arctan : `asin2atan`
- Transform arctan into arcsin : `atan2asin`
- Transform arctan into arccos : `atan2acos`
- Transform complex exponentials into sin and cos : `sincos exp2trig`
- Transform tan(x) into sin(x)/cos(x) : `tan2sincos`
- Rewrite tan(x) with sin(2x) and cos(2x) : `tan2sincos2`
- Rewrite tan(x) with cos(2x) and sin(2x) : `tan2cossin2`
- Rewrite sin, cos, tan in terms of tan(x/2) : `halftan`
- Rewrite trigonometric functions as function of tan(x/2) and hyperbolic functions as function of exp(x):
  `halftan_hyp2exp`
- Transform inverse trigonometric functions into logarithms : `atrig2ln`
- Transform trigonometric functions into complex exponentials : `trig2exp`
- Simplify and express preferentially with sine : `trigsin`
- Simplify and express preferentially with cosine : `trigcos`
- Simplify and express preferentially with tangents : `trigtan`
- Rewrite an expression with different options : `convert convertir`

## 2.22 Fourier transformation

- Fourier coefficients : `fourier_an` and `fourier_bn` or `fourier_cn`
  - `fourier_an`
  - `fourier_bn`
  - `fourier_cn`
- Discrete Fourier Transform
  - The properties of the Discrete Fourier Transform
  - Applications
- Fast Fourier Transform : `fft`
- Inverse Fast Fourier Transform : `ifft`
- An exercice with `fft`

## 2.23 Exponentials and Logarithms

- Rewrite hyperbolic functions as exponentials : `hyp2exp`
- Expand exponentials : `expexpand`
- Expand logarithms : `lnexpand`
- Linearize exponentials : `lin`
- Collect logarithms : `lncollect`
- Expand powers : `powexpand`
- Rewrite a power as an exponential : `pow2exp`
- Rewrite exp(n*ln(x)) as a power : `exp2pow`
- Simplify complex exponentials : `tsimplify`

## 2.24 Polynomials

A polynomial of one variable is represented either by a symbolic expression or by the list of it’s coefficients by decreasing powers order (dense representation). In the latter case, to avoid confusion with other kinds of list

- use `poly1[...]` as delimiters in inputs
- check for in `Xcas` output.

Note that polynomials represented as lists of coefficients are always written in decreassing powers order even if `increasing power` is checked in `cas` configuration.

A polynomial of several variables is represented

- by a symbolic expression
- or by a dense recursive 1-d representation like above
- or by a sum of monomials with non-zero coefficients (distributed sparse representation).
  A monomial with several variables is represented by a coefficent and a list of integer (interpreted as powers of a variable list). The delimiters for monomials are `%%%{` and `%%%}`, for example 3x2y is represented by `%%%{3,[2,1]%%%}` with respect to the variable list `[x,y]`).

- Convert to a symbolic polynomial : `r2e poly2symb`
- Convert from a symbolic polynomial : `e2r symb2poly`
- Coefficients of a polynomial: `coeff coeffs`
- Polynomial degree : `degree`
- Polynomial valuation : `valuation ldegree`
- Leading coefficient of a polynomial : `lcoeff`
- Trailing coefficient degree of a polynomial : `tcoeff`
- Evaluation of a polynomial : `peval polyEval`
- Factorize xn in a polynomial : `factor_xn`
- GCD of the coefficients of a polynomial : `content`
- Primitive part of a polynomial : `primpart`
- Factorization : `collect`
- Factorization : `factor factoriser`
- Square-free factorization : `sqrfree`
- List of factors : `factors`
- Evaluate a polynomial : `horner`
- Rewrite in terms of the powers of (x-a) : `ptayl`
- Compute with the exact root of a polynomial : `rootof`
- Exact roots of a polynomial : `roots`
- Coefficients of a polynomial defined by its roots : `pcoeff pcoef`
- Truncate of order n : `truncate`
- Convert a series expansion into a polynomial : `convert convertir`
- Random polynomial : `randpoly randPoly`
- Change the order of variables : `reorder`
- Random list : `ranm`
- Lagrange’s polynomial : `lagrange interp`
- Natural splines: `spline`
  - Definition
  - Theorem
  - Interpolation with spline functions

## 2.25 Arithmetic and polynomials

Polynomials are represented by expressions or by list of coefficients by decreasing power order. In the first case, for instructions requiring a main variable (like extended gcd computations), the variable used by default is x if not specified. For modular coefficients in ℤ/nℤ, use `% n` for each coefficient of the list or apply it to the expression defining the polynomial.

- The divisors of a polynomial : `divis`
- Euclidean quotient : `quo`
- Euclidean quotient : `Quo`
- Euclidean remainder : `rem`
- Euclidien remainder: `Rem`
- Quotient and remainder : `quorem divide`
- GCD of two polynomials with Euclide algorithm: `gcd`
- GCD of two polynomials with Euclide algorithm : `Gcd`
- Choosing the GCD algorithm of two polynomials : `ezgcd heugcd modgcd psrgcd`
- LCM of two polynomials : `lcm`
- Bézout’s Identity : `egcd gcdex`
- Solving au+bv=c over polynomials: `abcuv`
- Chinese remainders : `chinrem`
- Cyclotomic polynomial : `cyclotomic`
- Sturm sequences and number of sign changes of P on ]a; b] : `sturm`
- Number of zeros in [a,b[ : `sturmab`
- Sturm sequences : `sturmseq`
- Sylvester matrix of two polynomials : `sylvester`
- Resultant of two polynomials : `resultant`

## 2.26 Orthogonal polynomials

- Legendre polynomials: `legendre`
- Hermite polynomial : `hermite`
- Laguerre polynomials: `laguerre`
- Tchebychev polynomials of first kind: `tchebyshev1`
- Tchebychev polynomial of second kind: `tchebyshev2`

## 2.27 Gröbner basis and Gröbner reduction

- Gröbner basis : `gbasis`
- Gröbner reduction : `greduce`
- Build a polynomial from it’s evaluation : `genpoly`

## 2.28 Rational fractions

- Numerator : `getNum`
- Numerator after simplification : `numer`
- Denominator : `getDenom`
- Denominator after simplification : `denom`
- Numerator and denominator : `f2nd fxnd`
- Simplify : `simp2`
- Common denominator : `comDenom`
- Integer and fractional part : `propfrac`
- Partial fraction expansion : `partfrac`

## 2.29 Exact roots of a polynomial

- Exact bounds for complex roots of a polynomial :
  `complexroot`
- Exact bounds for real roots of a polynomial : `realroot`
- Exact values of rational roots of a polynomial :
  `rationalroot`
- Exact values of the complex rational roots of a polynomial : `crationalroot`

## 2.30 Exact roots and poles

- Roots and poles of a rational function : `froot`
- Rational function given by roots and poles : `fcoeff`

## 2.31 Computing in ℤ/pℤ or in ℤ/pℤ[x]

The way to compute over ℤ/pℤ or over ℤ/pℤ[x] depends on the syntax mode :

- In `Xcas` mode, an object n over ℤ/pℤ is written n % p. Some examples of input for
  - an integer `n` in ℤ/13ℤ
    `n:=12%13`.
  - a vector `V` in ℤ/13ℤ
    `V:=[1,2,3]%13` or `V:=[1%13,2%13,3%13]`.
  - a matrix `A` in ℤ/13ℤ
    `A:=[[1,2,3],[2,3,4]]%13` or
    `A:=[[1%13,2%13,3%13],[[2%13,3%13,4%13]]`.
  - a polynomial `A` in ℤ/13ℤ[x] in symbolic representation
    `A:=(2*x```^```2+3*x-1)%13` or
    `A:=2%13*x```^```2+3%13*x-1%13`.
  - a polynomial `A` in ℤ/13ℤ[x] in list representation
    `A:=poly1[1,2,3]%13` or `A:=poly1[1%13,2%13,3%13]`.
  To recover an object `o` with integer coefficients instead of modular coefficients, input `o % 0`. For example, input `o:=4%7` and `o%0`,then output is `-3`.
- In `Maple` mode, integers modulo p are represented like usual integers instead of using specific modular integers. To avoid confusion with normal commands, modular commands are written with a capital letter (inert form) and followed by the mod command (see also the next section).

Remark

- For some commands in ℤ/pℤ or in ℤ/pℤ[x], `p` must be a prime integer.
- The representation is the symetric representation :
  `11%13` returns `-2%13`.

- Expand and reduce : `normal`
- Addition in ℤ/pℤ or in ℤ/pℤ[x] : `+`
- Substraction in ℤ/pℤ or in ℤ/pℤ[x] : `-`
- Multiplication in ℤ/pℤ or in ℤ/pℤ[x] : `*`
- Euclidian quotient : `quo`
- Euclidian remainder : `rem`
- Euclidian quotient and euclidian remainder : `quorem`
- Division in ℤ/pℤ or in ℤ/pℤ[x] : `/`
- Power in ℤ/pℤ and in ℤ/pℤ[x] : `^`
- Compute an mod p : `powmod powermod`
- Inverse in ℤ/pℤ : `inv inverse` or `/`
- Rebuild a fraction from it’s value modulo p : `fracmod`
- GCD in ℤ/pℤ[x] : `gcd`
- Factorization over ℤ/pℤ[x] : `factor factoriser`
- Determinant of a matrix in ℤ/pℤ : `det`
- Inverse of a matrix with coefficients in ℤ/pℤ : `inv inverse`
- Row reduction to echelon form in ℤ/pℤ : `rref`
- Construction of a Galois field : `GF`
- Factorize a polynomial with coefficients in a Galois field : `factor`

## 2.32 Compute in ℤ/pℤ[x] using Maple syntax

- Euclidean quotient : `Quo`
- Euclidien remainder: `Rem`
- GCD in ℤ/pℤ[x] : `Gcd`
- Factorization in ℤ/pℤ[x] : `Factor`
- Determinant of a matrix with coefficients in ℤ/pℤ : `Det`
- Inverse of a matrix in ℤ/pℤ : `Inverse`
- Row reduction to echelon form in ℤ/pℤ : `Rref`

## 2.33 Taylor and asymptotic expansions

- Division by increasing power order : `divpc`
- Taylor expansion : `taylor`
- Series expansion : `series`
- Résidu d’une expression en un point : `residue`
- Padé expansion: `pade`

## 2.34 Intervals

- Definition of an interval : `a1..a2`
- Boundaries of an interval : `left right`
- Center of an interval : `interval2center`
- Intervals defined by their center : `center2interval`

## 2.35 Sequences

- Definition : `seq[] ()`
- Concat two sequences : `,`
- Get an element of a sequence : `[]`
- Sub-sequence of a sequence : `[]`
- Make a sequence or a list : `seq $`
- Transform a sequence into a list : `[] nop`
- The `+` operator applied on sequences

## 2.36 Sets

- Definition : `set[]`
- Union of two sets or of two lists : `union`
- Intersection of two sets or of two lists : `intersect`
- Difference of two sets or of two lists : `minus`

## 2.37 Lists and vectors

- Definition
- Get an element or a sub-list of a list : `at []`
  - Get an element
  - Extract a sub-list
- Extract a sub-list : `mid`
- Get the first element of a list : `head`
- Remove an element in a list : `suppress`
- Remove the first element : `tail`
- Reverse order in a list : `revlist`
- Reverse a list starting from its n-th element : `rotate`
- Permuted list from its n-th element : `shift`
- Modify an element in a list : `subsop`
- Transform a list into a sequence : `op makesuite`
- Transform a sequence into a list : `makevector []`
- Length of a list : `size nops length`
- Sizes of a list of lists : `sizes`
- Concatenate two lists or a list and an element : `concat augment`
- Append an element at the end of a list : `append`
- Prepend an element at the begining of a list : `prepend`
- Sort : `sort`
- Sort a list by increasing order : `SortA`
- Sort a list by decreasing order : `SortD`
- Select the elements of a list : `select`
- Remove elements of a list : `remove`
- Test if a value is in a list : `member`
- Test if a value is in a list : `contains`
- Sum of list (or matrix) elements transformed by a function : `count`
- Number of elements equal to a given value : `count_eq`
- Number of elements smaller than a given value : `count_inf`
- Number of elements greater than a given value : `count_sup`
- Sum of elements of a list : `sum add`
- Cumulated sum of the elements of a list : `cumSum`
- Product : `product mul`
  - Product of values of an expression : `product`
  - Product of elements of a list : `product`
- Apply a function of one variable to the elements of a list : `map apply of`
- Apply a bivariate function to the elements of two lists : `zip`
- Make a list with zeros : `newList`
- Make a list with a function : `makelist`
- Make a random vector or list : `randvector`
- List of differences of consecutive terms : `deltalist`
- Make a matrix with a list : `list2mat`
- Make a list with a matrix : `mat2list`

## 2.38 Functions for vectors

- Norms of a vector : `maxnorm l1norm l2norm norm`
- Normalize a vector : `normalize unitV`
- Term by term sum of two lists : `+ .+`
- Term by term difference of two lists : `- .-`
- Term by term product of two lists : `.*`
- Term by term quotient of two lists : `./`
- Scalar product : `scalar_product * dotprod dot dotP scalar_Product`
- Cross product : `cross crossP crossproduct`

## 2.39 Statistic functions : `mean,variance,stddev, stddevp,median,quantile,quartiles,boxwhisker`

The functions described here may be used if the statistic serie is contained in a list. See also section 2.42.31 for matrices and chapter ?? for weighted lists.

- `mean` computes the arithmetic mean of a list
  Input :
  `mean([3,4,2])`
  Output :
  `3`
  Input :
  `mean([1,0,1])`
  Output
  `2/3`
- `stddev` computes the standard deviation of a population, if the argument is the population
  Input :
  `stddev([3,4,2])`
  Output :
  `sqrt(2/3)`
- `stddevp` computes an unbiaised estimate of the standard deviation of the population, if the argument is a sample. The following relation holds:
  `stddevp(l)```^```2=size(l)*stddev(l)```^```2/(size(l)-1)`.
  Input :
  `stddevp([3,4,2])`
  Output :
  `1`
- `variance` computes the variance of a list, that is the square of `stddevp`
  Input :
  `variance([3,4,2])`
  Output :
  `2/3`
- `median` computes the median of a list.
  Input :
  `median([0,1,3,4,2,5,6])`
  Output :
  `3.0`
- `quantile` computes the deciles of a list given as first argument, where the decile is the second argument.
  Input :
  `quantile([0,1,3,4,2,5,6],0.25)`
  Output the first quartile :
  `[1.0]`
  Input :
  `quantile([0,1,3,4,2,5,6],0.5)`
  Output the median :
  `[3.0]`
  Input :
  `quantile([0,1,3,4,2,5,6],0.75)`
  Output the third quartile :
  `[4.0]`
- `quartiles` computes the minimum, the first quartile, the median, the third quartile and the maximum of a list.
  Input :
  `quartiles([0,1,3,4,2,5,6])`
  Output :
  `[[0.0],[1.0],[3.0],[4.0],[6.0]]`
- `boxwhisker` draws the whisker box of a statistic serie stored in a list.
  Input :
  `boxwhisker([0,1,3,4,2,5,6])`
  Output
  `the graph of the whisker box of this statistic list`

Example
Define the list `A` by:

`A:=[0,1,2,3,4,5,6,7,8,9,10,11]`

Outputs :

1. `11/2` for `mean(A)`
2. `sqrt(143/12)` for `stddev(A)`
3. `0` for `min(A)`
4. `[1.0]` for `quantile(A,0.1)`
5. `[2.0]` for `quantile(A,0.25)`
6. `[5.0]` for `median(A)` or for `quantile(A,0.5)`
7. `[8.0]` for `quantile(A,0.75)`
8. `[9.0]` for `quantile(A,0.9)`
9. `11` for `max(A)`
10. `[[0.0],[2.0],[5.0],[8.0],[11.0]]` for `quartiles(A)`

## 2.40 Table with string as index : `table`

A table is an associative container (or map), it is used to store informations associated to indexes which are much more general than integers, like strings or sequences. It may be used for example to store a table of phone numbers indexed by names.
In `Xcas`, the indexes in a table may be any kind of `Xcas` objects. Access is done by a binary search algorithm, where the sorting function first sorts by `type` then uses an order for each type (e.g. < for numeric types, lexicographic order for strings, etc.)
`table` takes as argument a list or a sequence of equalities `index_name=element_value`.
`table` returns this table.
Input :

`T:=table(3=-10,"a"=10,"b"=20,"c"=30,"d"=40)`

Input :

`T["b"]`

Output :

`20`

Input :

`T[3]`

Output :

`-10`

Remark
If you assign `T[n]:= ...` where `T` is a variable name and `n` an integer

- if the variable name was assigned to a list or a sequence, then the n-th element of `T` is modified,
- if the variable name was not assigned, a table `T` is created with one entry (corresponding to the index n). Note that after the assignation `T` is not a list, despite the fact that n was an integer.

## 2.41 Usual matrix

A matrix is represented by a list of lists, all having the same size. In the `Xcas` answers, the matrix delimiters are [] (bold brackets). For example, [1,2,3] is the matrix [[1,2,3]] with only one row, unlike [1,2,3] (normal brackets) which is the list [1,2,3].
In this document, the input notation ([[1,2,3]]) will be used for input and output.

- Identity matrix : `idn identity`
- Zero matrix : `newMat matrix`
- Random matrix : `ranm randMat randmatrix`
- Diagonal of a matrix or matrix of a diagonal : `BlockDiagonal diag`
- Jordan bloc : `JordanBlock`
- Hilbert matrix : `hilbert`
- Vandermonde matrix : `vandermonde`

## 2.42 Arithmetic and matrix

- Evaluate a matrix : `evalm`
- Addition and substraction of two matrices : `+ - .+ .-`
- Multiplication of two matrices : `* &*`
- Addition of elements of a column of a matrix : `sum`
- Cumulated sum of elements of each column of a matrix : `cumSum`
- Multiplication of elements of each column of a matrix : `product`
- Power of a matrix : ^ &^
- Hadamard product : `hadamard product`
- Hadamard product (infixed version): `.*`
- Hadamard division (infixed version): `./`
- Hadamard power (infixed version): `.^`
- Extracting element(s) of a matrix : `[] at`
- Modify an element or a row of a matrix : `subsop`
- Extract rows or columns of a matrix (Maple compatibility) : `row col`
- Remove rows or columns of a matrix : `delrows delcols`
- Extract a sub-matrix of a matrix (TI compatibility) : `subMat`
- Add a row to another row : `rowAdd`
- Multiply a row by an expression : `mRow`
- Add k times a row to an another row : `mRowAdd`
- Exchange two rows : `rowSwap`
- Make a matrix with a list of matrix : `blockmatrix`
- Make a matrix from two matrices : `semi_augment`
- Make a matrix from two matrices : `augment concat`
- Build a matrix with a function : `makemat`
- Define a matrix : `matrix`
- Append a column to a matrix : `border`
- Count the elements of a matrix verifying a property : `count`
- Count the elements equal to a given value : `count_eq`
- Count the elements smaller than a given value : `count_inf`
- Count the elements greater than a given value : `count_sup`
- Statistics functions acting on column matrices : `mean`, `stddev`, `variance`, `median`, `quantile`, `quartiles`, `boxwhisker`
- Dimension of a matrix : `dim`
- Number of rows : `rowdim rowDim nrows`
- Number of columns : `coldim colDim ncols`

## 2.43 Linear algebra

- Transpose of a matrix : `tran transpose`
- Inverse of a matrix : `inv /`
- Trace of a matrix : `trace`
- Determinant of a matrix : `det`
- Determinant of a sparse matrix : `det_minor`
- Rank of a matrix : `rank`
- Transconjugate of a matrix : `trn`
- Equivalent matrix : `changebase`
- Basis of a linear subspace : `basis`
- Basis of the intersection of two subspaces : `ibasis`
- Image of a linear application : `image`
- Kernel of a linear application : `kernel nullspace ker`
- Kernel of a linear application : `Nullspace`
- Subspace generated by the columns of a matrix : `colspace`
- Subspace generated by the rows of a matrix : `rowspace`

## 2.44 Linear Programmation

Linear programming problems are maximization problem of a linear functional under linear equality or inequality constraints. The most simple case can be solved directly by the so-called simplex algorithm. Most cases requires to solve an auxiliary linear programming problem to find an initial vertex for the simplex algorithm.

- Simplex algorithm: `simplex_reduce`

## 2.45 Different matrix norm

- l2 matrix norm : `nomm l2norm`
- l∞ matrix norm : `maxnorm`
- Matrix row norm : `rownorm rowNorm`
- Matrix column norm : `colnorm colNorm`

## 2.46 Matrix reduction

- Eigenvalues : `eigenvals`
- Eigenvalues : `egvl eigenvalues eigVl`
- Eigenvectors : `egv eigenvectors eigenvects
  eigVc`
- Rational Jordan matrix : `rat_jordan`
- Jordan normal form : `jordan`
- Characteristic polynomial : `charpoly`
- Characteristic polynomial using Hessenberg algorithm :
  `pcar_hessenberg`
- Minimal polynomial : `pmin`
- Adjoint matrix : `adjoint_matrix`
- Companion matrix of a polynomial : `companion`
- Hessenberg matrix reduction : `hessenberg`
- Hermite normal form : `ihermite`
- Smith normal form : `ismith`

## 2.47 Isometries

- Recognize an isometry : `isom`
- Find the matrix of an isometry : `mkisom`

## 2.48 Matrix factorizations

Note that most matrix factorization algorithms are implemented numerically, only a few of them will work symbolically.

- Cholesky decomposition : `cholesky`
- QR decomposition : `qr`
- QR decomposition (for TI compatibility) : `QR`
- LU decomposition : `lu`
- LU decomposition (for TI compatibility) : `LU`
- Singular value decomposition : `svd`
- Short basis of a lattice : `lll`

## 2.49 Quadratic forms

- Matrix of a quadratic form : `q2a`
- Transform a matrix into a quadratic form : `a2q`
- Reduction of a quadratic form : `gauss`
- Gramschmidt orthonormalization : `gramschmidt`
- Graph of a conic : `conique`
- Conic reduction : `conique_reduite`
- Graph of a quadric : `quadrique`
- Quadric reduction : `quadrique_reduite`

## 2.50 Multivariate calculus

- Gradient : `derive deriver diff grad`
- Laplacian : `laplacian`
- Hessian matrix : `hessian`
- Divergence : `divergence`
- Rotationnal : `curl`
- Potential : `potential`
- Conservative flux field : `vpotential`

## 2.51 Equations

- Define an equation : `equal`
- Transform an equation into a difference : `equal2diff`
- Transform an equation into a list : `equal2list`
- The left member of an equation : `left gauche lhs`
- The right member of an equation : `right droit rhs`
- Solving equation(s): `solve`
- Equation solving in ℂ : `cSolve`

## 2.52 Linear systems

In this paragraph, we call "augmented matrix" of the system A · X=B (or matrix "representing" the system A · X=B), the matrix obtained by gluing the column vector B or −B to the right of the matrix A, as with `border(A,tran(B))`.

- Matrix of a system : `syst2mat`
- Gauss reduction of a matrix : `ref`
- Gauss-Jordan reduction: `rref gaussjord`
- Solving A*X=B : `simult`
- Step by step Gauss-Jordan reduction of a matrix : `pivot`
- Linear system solving: `linsolve`
- Finding linear recurrences : `reverse_rsolve`

## 2.53 Differential equations

This section is limited to symbolic (or exact) solutions of differential equations. For numeric solutions of differential equations, see `odesolve`. For graphic representation of solutions of differential equations, see `plotfield`, `plotode` and `interactive_plotode`.

- Solving differential equations : `desolve deSolve
  dsolve`
- Laplace transform and inverse Laplace transform : `laplace ilaplace`

## 2.54 Other functions

- Replace small values by 0: `epsilon2zero`
- List of variables : `lname indets`
- List of variables and of expressions : `lvar`
- List of variables of an algebraic expressions: `algvar`
- Test if a variable is in an expression : `has`
- Numeric evaluation : `evalf`
- Rational approximation : `float2rational exact`

# Chapter 3 Graphs

Most graph instructions take expressions as arguments. A few exceptions (mostly maple-compatibility instructions) also accept functions. Some optional arguments, like `color, thickness`, can be used as optional attributes in all graphic instructions. They are described below.

## 3.1 Graph and geometric objects attributes

There are two kinds of attributes: global attributes of a graphic scene and individual attributes.

- Individual attributes
- Global attributes

## 3.2 Graph of a function : `plotfunc funcplot DrawFunc Graph`

- 2-d graph
- 3-d graph
- 3-d graph with rainbow colors
- 4-d graph.

## 3.3 2d graph for Maple compatibility : `plot`

`plot(f(x),x)` draws the graph of y=f(x). The second argument may specify the range of values `x=xmin..xmax`. One can also plot a function instead of an expression using the syntax `plot(f,xmin..xmax)`. `plot` accepts an optional argument to specify the step used in x for the discretisation with `xstep=` or the number of points of the discretization with `nstep=`.
Input :

`plot(x```^```2-2,x)`

Output :

`the graph of y=x```^```2-2`

Input :

`plot(x```^```2-2,xstep=1)`

or

`plot(x```^```2-2,x,xstep=1)`

Output :

`a polygonal line which is a bad representation of y=x```^```2-2`

Input!

`plot(x```^```2-2,x=-2..3,nstep=30)`

## 3.4 3d surfaces for Maple compatibility `plot3d`

`plot3d` takes three arguments : a function of two variables or an expression of two variables or a list of three functions of two variables or a list of three expressions of two variables and the names of these two variables with an optional range (for expressions) or the ranges (for functions).
`plot3d(f(x,y),x,y)` (resp `plot3d([f(u,v),g(u,v),h(u,v)],u,v)`) draws the surface z=f(x,y) (resp x=f(u,v),y=g(u,v),z=h(u,v)). The syntax `plot3d(f(x,y),x=x0..x1,y=y0..y1)` or `plot3d(f,x0..x1,y0..y1)` specifies which part of surface will be computed (otherwise default values are taken from the graph configuration).
Input :

`plot3d(x*y,x,y)`

Output :

`The surface` `z=x*y`

Input :

`plot3d([v*cos(u),v*sin(u),v],u,v)`

Output :

`The cone` `x=v*``cos``(u),y=v*``sin``(u),z=v`

Input :

`plot3d([v*cos(u),v*sin(u),v],u=0..pi,v=0..3)`

Output :

`A portion of the cone` `x=v*``cos``(u),y=v*``sin``(u),z=v`

## 3.5 Graph of a line and tangent to a graph

- Draw a line : `line`
- Draw an 2D horizontal line : `LineHorz`
- Draw a 2D vertical line : `LineVert`
- Tangent to a 2D graph : `LineTan`
- Tangent to a 2D graph : `tangent`
- Intersection of a 2D graph with the axis

## 3.6 Graph of inequations with 2 variables : `plotinequation inequationplot`

`plotinequation([f1(x,y)<a1,...fk(x,y)<ak],[x=x1..x2,y=y1..y2])` draws the points of the plane whose coordinates satisfy the inequations of 2 variables :

⎧ ⎪ ⎨ ⎪ ⎩ |
f1(x,y) | < | a1
| ... |
fk(x,y) | < | ak
| , x1≤ x ≤ x2, y1 ≤ y ≤ y2

Input :

`plotinequation(x```^```2-y```^```2<3, [x=-2..2,y=-2..2],xstep=0.1,ystep=0.1)`

Output :

`the filled portion enclosing the origin and limited by the hyperbola x```^```2-y```^```2=3`

Input :

`plotinequation([x+y>3,x```^```2<y], [x-2..2,y=-1..10],xstep=0.2,ystep=0.2)`

Output :

`the filled portion of the plane defined by -2<x<2,y<10,x+y>3,y>x```^```2`

Note that if the ranges for x and y are not specified, `Xcas` takes the default values of `X-,X+,Y-,Y+` defined in the general graphic configuration (`Cfg``▸``Graphic configuration`).

## 3.7 Graph of the area below a curve : `plotarea areaplot`

- With two arguments, `plotarea` shades the area below a curve.
  `plotarea(f(x),x=a..b)` draws the area below the curve y=f(x) for a<x<b, i.e. the portion of the plane defined by the inequations a<x<b and 0<y<f(x) or 0>y>f(x) according to the sign of f(x) .
  Input :
  `plotarea(sin(x),x=0..2*pi)`
  Output :
  `the portion of plane locates in the two archs of sin(x)`
- With four arguments, `plotarea` represents a numeric approximation of the area below a curve, according to a quadrature method from the following list:
  `trapezoid,rectangle_left,rectangle_right,middle_point`.
  For example `plotarea(f(x),x=a..b,n,trapezoid)` draws the area of n trapezes : the third argument is an integer n, and the fourth argument is the name of the numeric method of integration when [a,b] is cut into n equal parts.
  Input :
  `plotarea((x```^```2,x=0..1,5,trapezoid)`
  If you want to display the graph of the curve in contrast (e.g. in bold red), input :
  `plotarea(x```^```2,x=0..1,5,trapezoid); plot(x```^```2,x=0..1,display=red+line_width_3)`
  Output :
  `the 5 trapezes used in the trapezoid method to approach the integral`
  Input :
  `plotarea((x```^```2,x=0..1,5,middle_point)`
  Or with the graph of the curve in bold red, input :
  `plotarea(x```^```2,x=0..1,5,middle_point); plot(x```^```2,x=0..1,display=red+line_width_3)`
  Output :
  `the 5 rectangles used in the middle_point method to approach the integral`

## 3.8 Contour lines: `plotcontour contourplot
DrwCtour`

`plotcontour(f(x,y),[x,y])` (or `DrwCtour(f(x,y),[x,y])` or
`contourplot(f(x,y),[x,y])`) draws the contour lines of the surface defined by z=f(x,y) for z=−10, z=−8, .., z=0, z=2, .., z=10. You may specify the desired contour lines by a list of values of z given as third argument.
Input :

`plotcontour(x```^```2+y```^```2,[x=-3..3,y=-3..3],[1,2,3], display=[green,red,black]+[filled$3])`

Output :

`the graph of the three ellipses x```^```2-y```^```2=n for n=1,2,3; the zones between these ellipses are filled with the color green,red or black`

Input :

`plotcontour(x```^```2-y```^```2,[x,y])`

Output :

`the graph of 11 hyperbolas x```^```2-y```^```2=n for n=-10,-8,..10`

If you want to draw the surface in 3-d representation, input `plotfunc(f(x,y),[x,y])`, see 3.2.2):

`plotfunc( x```^```2-y```^```2,[x,y])`

Output :

`A 3D representation of z=x```^```2+y```^```2`

## 3.9 2-d graph of a 2-d function with colors : `plotdensity densityplot`

`plotdensity(f(x,y),[x,y])` or `densityplot(f(x,y),[x,y])` draws the graph of z=f(x,y) in the plane where the values of z are represented by the rainbow colors. The optional argument `z=zmin..zmax` specifies the range of z corresponding to the full rainbow, if it is not specified, it is deduced from the minimum and maximum value of f on the discretisation. The discretisation may be specified by optional `xstep=...` and `ystep=...` or `nstep=...` arguments.
Input :

`plotdensity(x```^```2-y```^```2,[x=-2..2,y=-2..2], xstep=0.1,ystep=0.1)`

Output :

`A 2D graph where each hyperbola defined by x```^```2-y```^```2=z has a color from the rainbow`

Remark : A rectangle representing the scale of colors is displayed below the graph.

## 3.10 Implicit graph: `plotimplicit implicitplot`

`plotimplicit` or `implicitplot` draws curves or surfaces defined by an implicit expression or equation. If the option `unfactored` is given as last argument, the original expression is taken unmodified. Otherwise, the expression is normalized, then replaced by the factorization of the numerator of it’s normalization.

Each factor of the expression corresponds to a component of the implicit curve or surface. For each factor, Xcas tests if it is of total degree less or equal to 2, in that case `conic` or `quadric` is called. Otherwise the numeric implicit solver is called.

Optional step and ranges arguments may be passed to the numeric implicit solver, note that they are dismissed for each component that is a conic or a quadric.

- 2D implicit curve
- 3D implicit surface

## 3.11 Parametric curves and surfaces : `plotparam paramplot DrawParm`

- 2D parametric curve
- 3D parametric surface : `plotparam paramplot DrawParm`

## 3.12 Curve defined in polar coordinates : `plotpolar polarplot DrawPol courbe_polaire`

Let Et be an expression depending of the variable t.
`plotpolar(``E``t``,t)` draws the polar representation of the curve defined by ρ=Et for θ=t, that is in cartesian coordinates the curve (Et cos(t),Et sin(t)). The range of the parameter may be specified by replacing the second argument by `t=tmin..tmax`. The discretisation parameter may be specified by an optional `tstep=...` argument.
Input

`plotpolar(t,t)`

Output :

`The spiral` `ρ``=t is plotted`

Input

`plotpolar(t,t,tstep=1)`

or :

`plotpolar(t,t=0..10,tstep=1)`

Output :

`A polygon line approaching the spiral` `ρ``=t is plotted`

## 3.13 Graph of a recurrent sequence : `plotseq seqplot graphe_suite`

Let f(x) be an expression depending of the variable x (resp. f(t) an expression depending of the variable t).
`plotseq(``f(x)``,a,n)` (resp. `plotseq(``f(t)``,t=a,n)`) draws the line y=x, the graph of y=f(x) (resp y=f(t)) and the n first terms of the recurrent sequence defined by : u0=a, un=f(un−1). The a value may be replaced by a list of 3 elements, [a,x−,x+] where x−..x+ will be passed as x range for the graph computation.
Input :

`plotseq(sqrt(1+x),x=[3,0,5],5)`

Output :

`the graph of y=sqrt(1+x), of y=x and of the 5 first terms of the sequence u_0=3 and u_n=sqrt(1+u_(n-1))`

## 3.14 Tangent field : `plotfield fieldplot`

- Let f(t,y) be an expression depending of two variables t and y, then :
  `plotfield(f(t,y),[t,y])`
  draws the tangent field of the differential equation y′=f(t,y) where y is a real variable and where t is the abscissa,
- Let V be a vector of two expressions depending of 2 variables x,y but independant of the time t, then
  `plotfield(V,[x,y])`
  draws the vector field V,
- The range of values of t,y or of x,y can be specified with
  `t=tmin..tmax`, `x=xmin..xmax`, `y=ymin..ymax`
  in place of the variable name.
- The discretisation may be specified with optional arguments `xstep=...`, `ystep=...`.

Input :

`plotfield(4*sin(t*y),[t=0..2,y=-3..7])`

Output :

`Segments with slope 4*sin(t*y), representing tangents, are plotting in different points`

With two variables x,y, input :

`plotfield(5*[-y,x],[x=-1..1,y=-1..1])`

## 3.15 Plotting a solution of a differential equation : `plotode odeplot`

Let f(t,y) be an expression depending of two variables t and y.

- `plotode(``f(t,y)``,[t,y],[t0,y0])` draws the solution of the differential equation y′=f(t,y) crossing through the point `(t0,y0)` (i.e. such that y(t0)=y0)
- By default, t goes in both directions. The range of value of t may be specified by the optional argument `t=tmin..tmax`.
- We can also represent, in the space or in the plane, the solution of a differential equation y′=f(t,y) where y=(X,Y) is a vector of size 2. Just replace y by the variable names X,Y and the initial value y0 by the two initial values of the variables at time t0.

Input :

`plotode(sin(t*y),[t,y],[0,1])`

Output :

The graph of the solution of y’=sin(t,y) crossing through the point (0,1)

Input :

`S:=odeplot([h-0.3*h*p, 0.3*h*p-p], [t,h,p],[0,0.3,0.7])`

Output, the graph in the space of the solution of :

[h,p]′=[h−0.3 h*p, 0.3 h*p−p] [h,p](0)=[0.3,0.7]

To have a 2-d graph (in the plane), use the option `plane`

`S:=odeplot([h-0.3*h*p, 0.3*h*p-p], [t,h,p],[0,0.3,0.7],plane)`

To compute the values of the solution, see the section ??.

## 3.16 Interactive plotting of solutions of a differential equation : `interactive_plotode interactive_odeplot`

Let f(t,y) be an expression depending of two varaiables t and y.
`interactive_plotode(f(t,y),[t,y])` draws the tangent field of the differential equation y′=f(t,y) in a new window. In this window, one can click on a point to get the plot of the solution of y′=f(t,y) crossing through this point.
You can further click to display several solutions. To stop press the `Esc` key.
Input :

`interactive_plotode(sin(t*y),[t,y])`

Output :

`The tangent field is plotted with the solutions of y’=sin(t,y) crossing through the points defined by mouse clicks`

## 3.17 Animated graphs (2D, 3D or "4D")

`Xcas` can display animated 2D, 3D or "4D" graphs. This is done first by computing a sequence of graphic objects, then after completion, by displaying the sequence in a loop.

- To stop or start again the animation, click on the button ▸ ∣ (at the left of `Menu`).
- The display time of each graphic objet is specified in `animate` of the graph configuration (`cfg` button). Put a small time, to have a fast animation.
- If `animate` is `0`, the animation is frozen, you can move in the sequence of objects one by one by clicking on the mouse in the graphic scene.

- Animation of a 2D graph : `animate`
- Animation of a 3D graph : `animate3d`
- Animation of a sequence of graphic objects : `animation`

# Chapter 4 Numerical computations

Real numbers may have an exact representation (e.g. rationals, symbolic expressions involving square roots or constants like π, ...) or approximate representation, which means that the real is represented by a rational (with a denominator that is a power of the basis of the representation) close to the real. Inside `Xcas`, the standard scientific notation is used for approximate representation, that is a mantissa (with a point as decimal separator) optionnally followed by the letter `e` and an integer exponent.

Note that the real number 10−4 is an exact number but 1e−4 is an approximate representation of this number.

## 4.1 Floating point representation.

In this section, we explain how real numbers are represented.

- Digits
- Representation by hardware floats
- Examples of representations of normalized floats
- Difference between the representation of (3.1-3) and of 0.1

## 4.2 Approx. evaluation : `evalf approx` and `Digits`

`evalf` or `approx` evaluates to a numeric approximation (if possible).
Input :

`evalf(sqrt(2))`

Output, if in the `cas` configuration (`Cfg` menu) `Digits=7` (that is hardware floats are used, and 7 digits are displayed) :

`1.414214`

You can change the number of digits in a commandline by assigning the variable `DIGITS` or `Digits`. Input :

`DIGITS:=20`
`evalf(sqrt(2))`

Output :

`1.4142135623730950488`

Input :

`evalf(10```^```-5)`

Output :

`1e-05`

Input :

`evalf(10```^```15)`

Output :

`1e+15`

Input :

`evalf(sqrt(2))*10```^```-5`

Output :

`1.41421356237e-05`

## 4.3 Numerical algorithms

- Approximate solution of an equation : `newton`
- Approximate computation of the derivative number : `nDeriv`
- Approximate computation of integrals : `romberg nInt`
- Approximate solution of y’=f(t,y) : `odesolve`
- Approximate solution of the system v’=f(t,v) : `odesolve`

## 4.4 Solve equations with `fsolve nSolve`

`fsolve` or `nSolve` solves numeric equations (unlike `solve` or `proot`, it is not limited to polynomial equations) of the form:

f(x)=0, x ∈ ]a,b[

`fsolve` or de `nSolve` accepts a last optional argument, the name of an iterative algorithm to be used by the GSL solver. The different methods are explained in the following section.

- `fsolve` or `nSolve` with the option `bisection_solver`
- `fsolve` or `nSolve` with the option `brent_solver`
- `fsolve` or `nSolve` with the option `falsepos_solver`
- `fsolve` or `nSolve` with the option `newton_solver`
- `fsolve` or `nSolve` with the option `secant_solver`
- `fsolve` or `nSolve` with the option `steffenson_solver`

## 4.5 Solve systems with `fsolve`

`Xcas` provides six methods (inherited from the GSL) to solve numeric systems of equations of the form f(x)=0:

- Three methods use the jacobian matrix f′(x) and their names are terminated with `j_solver`.
- The three other methods use approximation for f′(x) and use only f.

All methods use an iteration of Newton kind

xn+1=xn−f′(xn)−1*f(xn)

The four methods `hybrid*_solver` use also a method of gradient descent when the Newton iteration would make a too large step. The length of the step is computed without scaling for `hybrid_solver` and `hybridj_solver` or with scaling (computed from f′(xn)) for `hybrids_solver` and `hybridsj_solver`.

- `fsolve` with the option `dnewton_solver`
- `fsolve` with the option `hybrid_solver`
- `fsolve` with the option `hybrids_solver`
- `fsolve` with the option `newtonj_solver`
- `fsolve` with the option `hybridj_solver`
- `fsolve` with the option `hybridsj_solver`

## 4.6 Numeric roots of a polynomial : `proot`

`proot` takes as argument a squarefree polynomial, either in symbolic form or as a list of polynomial coefficients (written by decreasing order).
`proot` returns a list of the numeric roots of this polynomial.
To find the numeric roots of P(x)=x3+1, input :

`proot([1,0,0,1])`

or :

`proot(x```^```3+1)`

Output :

`[0.5+0.866025403784*i,0.5-0.866025403784*i,-1.0]`

To find the numeric roots of x2−3, input :

`proot([1,0,-3])`

or :

`proot(x```^```2-3)`

Output :

`[1.73205080757,-1.73205080757]`

## 4.7 Numeric factorization of a matrix : `cholesky qr lu svd`

Matrix numeric factorizations of

- Cholesky,
- QR,
- LU,
- svd,

are described in section 2.48.

# Chapter 5 Unit objects and physical constants

The `Phys` menu contains:

- the physical constants (`Constant` sub-menu),
- the unit conversion functions (`Unit_convert` sub-menu),
- the unit prefix (`Unit_prefix` sub-menu)
- the unit objects organized by subject

## 5.1 Unit objects

- Notation of unit objects
- Computing with units
- Convert units into MKSA units : `mksa`
- Convert units : `convert`
- Factorize an unit : `ufactor`
- Simplify an unit : `usimplify`
- Unit prefixes

## 5.2 Constants

- Notation of physical constants
- Constants Library

> This document was translated from LATEX by HEVEA.