summaryrefslogtreecommitdiff
path: root/doc/exemples.tex
blob: a58cc2b0d238999fca814102d108c57cef5739fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
\chapter{Exemples d'utilisation}
\paragraph{}
Lorsque le programme principal se lance, nous obtenons un invite simple:
\begin{verbatim}
$ ./Polynom 
Polynomia v1.0


Performing initialisation...


Starting interface...

> 
\end{verbatim}

La flexibilité de l'interface est extrème, et nous permet, à la manière MAPLE, de taper sous une
forme naturelle nos polynomes. Voici un exemple d'utilisation "simple":

\begin{verbatim}
> A = x^4 + 2*x^3 - x + 6;

 .   x^4 + 2x^3 - x + 6 

> B = x^3 - 6*x^2 + x + 4;

 .   x^3 - 6x^2 + x + 4 

> A + B;

 .   x^4 + 3x^3 - 6x^2 + 10 

> A - B;

 .   x^4 + x^3 + 6x^2 - 2x + 2 

> A / B;

 .   x + 8 

> A % B;

 .   47x^2 - 13x - 26 

> A(2);

 .   36 
\end{verbatim}

Comme à la manière MAPLE, il est possible d'évaluer des polynomes en cours de route. Par exemple:

\begin{verbatim}
> P = A + 2*x - 3*B;

 .   x^4 - x^3 + 18x^2 - 2x - 6 
\end{verbatim}

Enfin, il y a des appels de fonctions prédéfinis, dont l'appel à la fonction d'évaluation d'un polynôme:

\begin{verbatim}
> P(3);

 .   204 
\end{verbatim}

Le parseur de ligne étant totalement flexible, il est possible de mélanger toutes les fonctionnalités ensembles:
\begin{verbatim}
> (2*P + B)(3);

 .   388 


> (R = 2*P^2 - 2*x)(36) * x^2 - 10;

 .   1389891136x^2 - 10 

> R;

 .   2x^8 - 4x^7 + 74x^6 - 80x^5 + 632x^4 - 120x^3 - 424x^2 + 46x + 72 

\end{verbatim}