Section : dxcas
Avant :
Style de programmation
Après : Exercices
Exercice 7.10
Les lignes de commande suivantes affichent
un losange :
vrai ou faux et pourquoi ?
-
losange(1,i,pi/3)
losange((1,0),(0,1),pi/3)
-
losange(point(1,0),point(0,1),pi/3)
parallelogramme(0,1,1+i)
-
parallelogramme(0,1,1/2+i*sqrt(3)/2)
-
quadrilatere(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2)
-
polygone(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2)
polygonplot(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2)
polygonplot([0,1,3/2,1/2],[0,0,sqrt(3)/2,sqrt(3)/2])
polygone_ouvert(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2)
-
polygone_ouvert(0,1,3/2+i*sqrt(3)/2,1/2+i*sqrt(3)/2,0)
Exercice 7.11
Les lignes de commande suivantes affichent
le cercle unité :
vrai ou faux et pourquoi ?
-
cercle(0,1)
arc(-1,1,2*pi)
-
arc(-1,1,pi), arc(-1,1,-pi)
plot(sqrt(1-x^2))
-
plot(sqrt(1-x^2)), plot(-sqrt(1-x^2))
-
plotimplicit(x^2+y^2-1,x,y)
plotparam(cos(t),sin(t))
-
plotparam(cos(t)+i*sin(t))
-
plotparam(cos(t)+i*sin(t),t)
-
plotparam(exp(i*t))
plotparam(cos(t)+i*sin(t),t,0,pi)
-
plotparam(cos(t)+i*sin(t),t,0,2*pi)
-
plotpolar(1,t)
-
plotpolar(1,t,-pi,pi)
-
plotpolar(1,t,0,2*pi)
Exercice 7.12
Les commandes suivantes retournent la liste
![$ [1,2,3,4,5]$](img81.gif)
:
vrai ou faux et pourquoi ?
-
[1,2,3,4,5]
op([1,2,3,4,5])
-
nop(1,2,3,4,5)
seq(i,i=1..5)
seq(j=1..5)
seq(j,j=1..5)
seq(j,j,1..5)
-
seq(j,j,1,5)
-
seq(j,j,1,5,1)
-
[seq(j,j=1..5)]
-
nop(seq(j,j=1..5))
[k$k=1..5]
-
[k$(k=1..5)]
[k+1$(k=0..4)]
-
[(k+1)$(k=0..4)]
-
cumSum([1$5])
sort(5,2,3,1,4)
-
sort([5,2,3,1,4])
makelist(k,1,5)
-
makelist(x->x,1,5)
Exercice 7.13
Les commandes suivantes retournent la liste
![$ [1.0,0.5,0.25,0.125,0.0625]$](img82.gif)
:
vrai ou faux et pourquoi ?
-
0.5^[0,1,2,3,4]
2^(-[0,1,2,3,4])
-
2.0^(-[0,1,2,3,4])
-
2^-evalf([0,1,2,3,4])
-
evalf(2^(-[0,1,2,3,4]))
seq(2^(-n),n=0..4)
-
evalf([seq(2^(-n),n=0..4)])
1/evalf(2^n$(n=0..4))
evalf(2^n$(n=0..4))^(-1)
-
[evalf(2^n$(n=0..4))]^(-1)
-
evalf(nop(2^n$(n=0..4))^(-1))
-
a:=[]:; (a:=append(a,0.5^k))$(k=0..4):; a
makelist(k->2^(-k),0,4)
-
f:=x->2.0^(-x):; makelist(f,0,4)
Exercice 7.14
Soit
l la liste
![$ [1,0,2,0,3]$](img83.gif)
. Les lignes de commande
suivantes retournent l'entier

: vrai ou faux et pourquoi ?
-
l*10^[4,3,2,1,0]
l*10^[0,1,2,3,4]
-
revlist(l)*10^[0,1,2,3,4]
-
l*seq(10^n,n,4,0,-1)
-
expr(char(sum(l,48)))
-
l*nop(seq(10^n,n=(4..0)))
-
l*10^nop(j$(j=4..0))
l*10^(j$(j=4..0))
l*10^(j$(j=4..0))
-
l*nop(10^j)$(j=4..0))
Exercice 7.15
Soit
n l'entier

.
Les lignes de commande suivantes retournent la
liste d'entiers
![$ [1,0,2,0,3]$](img83.gif)
:
vrai ou faux et pourquoi ?
(floor(n/10^k)-floor(n/10^(k+1))*10)$(k=4..0)
-
[(floor(n/10^k)-floor(n/10^(k+1))*10)$(k=4..0)]
seq(iquo(n,10^k)-10*iquo(n,10^(k+1)),k=4..0)
-
nop(seq(iquo(n,10^k)-10*iquo(n,10^(k+1)),k=4..0))
-
revlist(convert(n,base,10))
-
sum(asc(string(n)),-48)
string(n)
mid(string(n),k,1)$(k=0..4)
[mid(string(n),k,1)$(k=0..4)]
-
[expr(mid(string(n),k,1))$(k=0..4)]
Exercice 7.16
Le polynôme

a été affecté
par la commande
P:=X^4+2*X^2+3.
Les lignes de commande suivantes affichent
le polynôme réciproque
3*X^4+2*X^2+1 :
vrai ou faux et pourquoi ?
-
poly2symb(revlist(symb2poly(P)))
X^4*subst(P,X,1/X)
-
normal(X^4*subst(P,X,1/X))
normal(subst(P,X,1/X))
-
normal(subst(P/X^4,X,1/X))
-
normal(X^degree(P)*subst(P,X,1/X))
-
getNum(subst(P,X,1/X))
f:=unapply(P,X):; part(f(1/X),1)
-
f:=unapply(P,X):; part(normal(f(1/X)),1)
Section : dxcas
Avant : Style de programmation
Après : Exercices
R. De Graeve, B. Parisse, B. Ycart 2006