<Shift>+<Entrer> | Pour éxecuter l'instruction en cours. |
2^7+1 | → 129 |
FactorInteger[24] | → {{2, 4}, {3, 1}} |
Rang[10] | → {1,2,3,4,5,6,7,8,9,10} |
NestList[f, x, 3] | → {x,f[x],f[f[x]],f[f[f[x]]]} |
{a,b,c,d,e}[[3]] | → c |
{a,b,c,d,e}[[2;;4]] | → {b,c,d} |
s={}; AppendTo[s,x]; s | → {x} |
s={}; p=Append[s,x]; {s,p} | → {{},{x}} |
Join[{a,b},s,{u,v}] | → {a,b,x,u,v} |
SortBy[{3,5,11}, Mod[#, 5] &] | → {5,11,3} |
Table[x^x,{x,4}] | → {1,4,27,256} |
Table[f[x], {x, 2, 5}] | → {f[2],f[3],f[4],f[5]} |
Table[f[x], {x, 0, 30, 10}] | → {f[0],f[10],f[20],f[30]} |
Table[a[i,j],{i, 2},{j,2}] | → {{a[1, 1], a[1, 2]}, {a[2, 1], a[2, 2]}} |
; | Le point virgule est le séparateur d'instruction |
t:=Now ; t | → Object Date recalculé à chaque lecture de t |
x=1+2y | → 1+2y |
x=. ; x | → x |
s={f[1],g[2],f[3],g[5]} Cases[s,f[_]] s/.f[x_]=x^x |
→ {f[1], g[2], f[3], g[f[4]]} → {f[1], f[3]} → {1, g[2], 27, g[256]} |
Replace[f[3],f[x_]-> x^2] | → 9 |
Replace[f[3,2,1],f[x__]-> {x}] | → {3,2,1} |
Replace[f[],f[x___]-> {x}] | → {} |
RandomInteger[] | Retourne aléatoirement 0 ou 1 |
RandomInteger[5] | Nombre aléatoire de 0 à 5 |
RandomInteger[{3,5}] | Nombre aléatoire de 3 à 5 |
RandomInteger[5, 10] | → {2, 1, 1, 4, 2, 5, 5, 5, 0, 0} |
RandomInteger[1, {3,4}] | → {{1, 0, 0, 0}, {0, 1, 0, 0}, {1, 1, 0, 0}} |
r=f[x_]->x^2 | → f[x_]->x^2 |
q=f[x_]:>RandomInteger[5] | → f[x_]:>RandomInteger[5] |
f[x_,y_]:=x*y+3 ; f[a,b] Clear[f] |
→ f(3 + x y) |
g[x_,y_]/;x==2y :=x*y g[x_,x_] :=x g[x_,0] :=1 g[0,x_,0] :=2 g[x_,y_]/;x>y :=123 Definition[g] |
|
f = Function[{x,y},x^y-x y] f[a,2] |
→ 2 a + a^2 |
g = (#1^#2-#1 #2)& g[a,2] |
→ 2 a + a^2 |
s=Table[Prime[x],{x,20}] |
→ {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
67, 71} → {19, 29, 59} → {19, 29, 59} |
Clear[f] NestList[f[#, #] &, a, 3] |
→ {a, f[a, a], f[f[a, a], f[a, a]], f[f[f[a, a], f[a, a]], f[f[a, a], f[a, a]]]} |
Map[f,{a,b,c}] f/@{a,b,c} {#, #} & /@ {a, b, c, d} |
→ {f(a),f(b),f(c)} → {f(a),f(b),f(c)} → {{a,a},{b,b},{c,c},{d,d}} |
Apply[f,{x,y,z}] | → f[x,y,z] |
f@x | → f[x] |
f@{{a,b},{u,v},{x,y}} | f[{{a, b}, {u, v}, {x, y}}] |
f@@{{a,b},{u,v},{x,y}} | f[{a, b}, {u, v}, {x, y}] |
f@@@{{a,b},{u,v},{x,y}} | {f[a, b], f[u, v], f[x, y]} |