Professional Documents
Culture Documents
10
Prima
Sqrt[x ^ 2]
x2
100 !
93 326 215 443 944 152 681 699 238 856 266 700 490 715 968 264 381 621 468 592 963 895 217 599
993 229 915 608 941 463 976 156 518 286 253 697 920 827 223 758 251 185 210 916 864 000 000
000 000 000 000 000 000
N[%]
9.33262 10157
Gamma[4]
6
- 1 2 !
Gamma1 2
Sqrt[2]
2
N[%, 500]
1.4142135623730950488016887242096980785696718753769480731766797379907324784621
07038850387534327641572735013846230912297024924836055850737212644121497099935
83141322266592750559275579995050115278206057147010955997160597027453459686201
47285174186408891986095523292304843087143214508397626036279952514079896872533
96546331808829640620615258352395054745750287759961729835575220337531857011354
37460340849884716038689997069900481503054402779031645424782306849293691862158
05784631115966687130130156185689872372
2 PrimaStud.nb
Integrate[Sin[x], {x, 0, }]
2
A questo punto stato spiegato luso dei quattro tipi di parentesi { }, ( ), [ ], [[ ]], e dei tre tipi di
uguale =, :=, ==,
x + 10 x + 1 x - 3 (x + 7)
(1 + x) (10 + x)
(- 3 + x) (7 + x)
x + 1 x + 2 x + 3 (x + 4)
(1 + x) (2 + x)
(3 + x) (4 + x)
Expand[%]
2 3x x2
+ +
(3 + x) (4 + x) (3 + x) (4 + x) (3 + x) (4 + x)
Together[%]
2 + 3 x + x2
(3 + x) (4 + x)
Denominator[%]
(3 + x) (4 + x)
Expand[%]
12 + 7 x + x2
Apart[%]
2 6
1+ -
3+x 4+x
v = {1, 2, 3}
{1, 2, 3}
In[2]:= MatrixForm[%]
Out[2]//MatrixForm=
4 1 2
-1 6 3
2 1 8
In[3]:= Det[%]
Out[3]= 168
M.v
{12, 20, 28}
PrimaStud.nb 3
v[[3]]
3
M[[3]]
{2, 1, 8}
M[[2, 3]]
3
MatrixForm[%]
5 1 -2
2 4 -3
1 2 6
Det[%]
135
M.{x, y, z}
{5 x + y - 2 z, 2 x + 4 y - 3 z, x + 2 y + 6 z}
b = {1, 2, 3}
{1, 2, 3}
LinearSolve[M, b]
5 82 4
, ,
27 135 15
s=%
5 82 4
, ,
27 135 15
M.s
{1, 2, 3}
s.s
1729
3645
b.b
14
s.M
65 85 16
, ,-
27 27 27
M
{{5, 1, - 2}, {2, 4, - 3}, {1, 2, 6}}
4 PrimaStud.nb
M[[{1, 3}]]
{{5, 1, - 2}, {1, 2, 6}}
Solve[a x ^ 2 + b x + c 0, x]
-b - b2 - 4 a c -b + b2 - 4 a c
x , x
2a 2a
Solve[x ^ 3 + 2 x + 10 0, x]
1/3
- 45 + 2049 2
x - ,
32/3 3 - 45 + 2049
1/3
1/3
1 + 3 - 45 + 2049 1- 3
x - + ,
2 32/3 3 - 45 + 2049
1/3
1/3
1 - 3 - 45 + 2049 1+ 3
x - +
2 32/3 3 - 45 + 2049
1/3
N[%]
{{x - 1.84742}, {x 0.92371 - 2.13535 }, {x 0.92371 + 2.13535 }}
= {t, t ^ 2}
t, t2
PrimaStud.nb 5
lungh[, 0, 3]
1
6 37 + ArcSinh[6]
4
N[%]
9.74709
= {Cos[t], Sin[t], t / 4}
t
Cos[t], Sin[t],
4
lungh[, 0, 2 ]
17
2
6 PrimaStud.nb
ParametricPlot3D[, {t, 0, 2 }]
Plot[{Sin[x], Sin[2 x], Sin[3 x], Sin[4 x]}, {x, 0, 2 }, AspectRatio Automatic]
1.0
0.5
1 2 3 4 5 6
-0.5
-1.0
Seconda
Il comando Table[ ] per generare vettori, matrici e molto altro !
(* Tavola pitagorica *)
(* Matrice di Hilbert *)
Det[%]
1 / 46 206 893 947 914 691 316 295 628 839 036 278 726 983 680 000 000 000
N[%]
2.16418 10-53
8 PrimaStud.nb
In[4]:= f[x_] = x ^ 3 x ^ 2 - 1
x3
Out[4]=
- 1 + x2
Out[5]=
-2 -1 1 2
-1
-2
-3
Limit[f[x], x 1, Direction 1]
-
Limit[f[x] / x, x + ]
1
Limit[f[x] - x, x + ]
0
fp = D[f[x], x]
2 x4 3 x2
- +
- 1 + x2 2 - 1 + x2
Together[%]
- 3 x2 + x4
- 1 + x2 2
Solve[fp == 0, x]
{x 0}, {x 0}, x - 3 , x 3
PrimaStud.nb 9
f[x] /. %
3 3 3 3
0, 0, - ,
2 2
Reduce[fp 0, x]
- 3 x < - 1 || - 1 < x < 1 || 1 < x 3
fs = D[fp, x]
8 x5 14 x3 6x
- +
- 1 + x 2 3 - 1 + x 2 2 - 1 + x2
Together[%]
2 3 x + x3
- 1 + x2 3
Reduce[fs > 0, x]
- 1 < x < 0 || x > 1
Reduce[fs < 0, x]
x < - 1 || 0 < x < 1
In[7]:= T = Normal[%]
Out[7]= - x3 - x5 - x7
In[11]:= %%% %% + %
Out[11]= True
Sum1 k ^ 3, {k, 1, }
Zeta[3]
N[%]
1.08232
10 PrimaStud.nb
Plot3D[Abs[Zeta[x + I y]], {x, - 16, 16}, {y, - 16, 16}, PlotRange {0, 16}]
(* Grafico del modulo della funzione Zeta lungo la retta critica Re[z]12 *)
In[12]:= Plot[Abs[Zeta[0.5 + I y]], {y, - 125, 125}, PlotRange {- 1, 6}, PlotPoints 200]
6
3
Out[12]=
-1
Terza
Table[Series[Sin[x], {x, 0, n}], {n, 1, 11, 2}]
x3 x3 x5
x + O[x]2 , x - + O[x]4 , x - + + O[x]6 ,
6 6 120
x3 x5 x7 x3 x5 x7 x9
x- + - + O[x]8 , x - + - + + O[x]10 ,
6 120 5040 6 120 5040 362 880
x3 x5 x7 x9 x11
x- + - + - + O[x]12
6 120 5040 362 880 39 916 800
Normal[%]
x3 x3 x5 x3 x5 x7
x, x - , x- + , , x- + -
6 6 120
120 5040 6
x3 x5 x7 x9 x3 x5 x7 x9 x11
x- + - + , x- + - + -
6 120 5040 362 880 6 120 5040 362 880 39 916 800
T=%
x3 x3 x5 x3 x5 x7
x, x - , x- + , , x- + -
6 6 120
120 5040 6
x3 x5 x7 x9 x3 x5 x7 x9 x11
x- + - + , x- + - + -
6 120 5040 362 880 6 120 5040 362 880 39 916 800
PrimaStud.nb 11
-6 -4 -2 2 4 6
-2
-4
Integratex + 2 x ^ 3 + 2 x ^ 2 + 5 x, x
3 1+x 2 Log[x] 1
ArcTan + - Log5 + 2 x + x2
10 2 5 5
Apartx + 2 x ^ 3 + 2 x ^ 2 + 5 x
2 1-2x
+
5x 5 5 + 2 x + x2
Integratex + 2 x ^ 3 + 2 x ^ 2 + 5 x, {x, 1, 3}
1 324
- 3 + 4 3 ArcTan[2] + Log
40 25
N[%]
0.352712
Integratex + 2 x ^ 3 + 2 x ^ 2 + 5 x, {x, 1, }
3
( + Log[256])
40
N[%]
0.651508
0.5
2 4 6 8 10 12
-0.5
-1.0
12 PrimaStud.nb
fx = D[f, x]
1+2x
fy = D[f, y]
-2 - 2 y
MatrixForm[%]
2 0
0 -2
Show[{h, g}]
Quarta
Definizione e studio di una FUNZIONE di due variabili (dopo aver liberato il simbolo f ) .
In[15]:= f =.
In[22]:= Plot3D[{f[x, y], p, q}, {x, - 2, 2}, {y, - 2, 2}, PlotStyle {Red, Blue, Green}]
PrimaStud.nb 13
In[30]:= Animate[
Show[a, Plot[{Sin[x], taylor[n, x] // Evaluate}, {x, 0, 2 }]], {n, 1, 13, 2}]
In[37]:= Animate[Plot[{Sin[4 2 x - 2 t]}, {x, 0, 2}, PlotRange {- 1.2, 1.2}], {t, 1, 10}]
Quinta
In[48]:= sol = DSolve[{y ''[t] - y[t], y[0] 2, y '[0] 0}, y[t], t]
Out[48]= {{y[t] 2 Cos[t]}}
Out[53]=
10 20 30 40
-1
In[58]:= Animate[
Show[{a, Graphics[{Red, PointSize[0.02], Point[{r[t], 0}]}]}], {t, 0.01, 80}]
In[57]:= Animate[
Show[{a, Graphics[{Red, PointSize[0.02], Point[{s[t], 0}]}]}], {t, 0.01, 80}]
Sesta
In[59]:= fib[0] = 1
Out[59]= 1
In[60]:= fib[1] = 1
Out[60]= 1
PrimaStud.nb 15
In[74]:= N[%]
Out[74]= 0., 6.457488449094817 10835
In[75]:= a=1
Out[75]= 1
In[76]:= b=1
Out[76]= 1
In[83]:= fib[500]
Out[83]= 225 591 516 161 936 330 872 512 695 036 072 072 046 011 324 913 758 190 588 638 866 418 474
627 738 686 883 405 015 987 052 796 968 498 626
In[84]:= fibo[500]
Out[84]= 225 591 516 161 936 330 872 512 695 036 072 072 046 011 324 913 758 190 588 638 866 418 474
627 738 686 883 405 015 987 052 796 968 498 626
In[87]:= Fibonacci[501]
Out[87]= 225 591 516 161 936 330 872 512 695 036 072 072 046 011 324 913 758 190 588 638 866 418 474
627 738 686 883 405 015 987 052 796 968 498 626
Settima
sol = DSolvey '[t] 1 2 y[t], y[0] 1, y[t], t
y[t] t/2
Expand[%]
4 4 t
y[t]
3 + 4 t
f = y[t] /. %[[1]]
4 4 t
3 + 4 t
-4 -2 2 4
1.0
0.5
-1 1 2 3
-0.5
In[89]:= s=
NDSolvey '[x] x ^ 2 + y[x] ^ 2 - 1 x ^ 2 + y[x] ^ 2 + 1, y[0] 0.8, y, {x, - 3, 3}
1.5
1.0
Out[90]=
0.5
-3 -2 -1 1 2 3
In[91]:= s =.
In[92]:= s[k_] :=
NDSolvey '[x] x ^ 2 + y[x] ^ 2 - 1 x ^ 2 + y[x] ^ 2 + 1, y[0] k, y, {x, - 3, 3}
In[98]:= s[k_] := DSolve[{y ''[x] 2 y '[x] - 5 y[x], y[0] k, y '[0] 0}, y[x], x]
In[99]:= Tables- 12 10 + h, h, 0, 2, 2 10
In[101]:= ShowTableg- 12 10 + h, h, 0, 2, 2 10
-3 -2 -1 1 2
Out[101]=
-2
-4
-6
In[102]:= s := NDSolve[{y[x] y ''[x] - 4 y '[x] + 3 y[x] 0, y[0] 1, y '[0] 1}, y, {x, - 3, 3}]
3.0
2.5
2.0
Out[103]=
1.5
1.0
0.5
-3 -2 -1 1 2
PrimaStud.nb 19
Tappeto di Sierpinski
In[113]:= {a, b, c, d} = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
La scala di Cantor
In[123]:= sC[x_, 1] = Whichx < 1 3, 3 x 2, 1 3 < x < 2 3, 1 2, 2 3 < x, 3 x - 2 3 2 + 1 2;
In[127]:= Plot3D[g[x] g[y], {x, 0, 1}, {y, 0, 1}, PlotRange {0, 1},
PlotPoints 3 ^ 4, AspectRatio Automatic, ColorFunction Hue]
La Cicloide
In[129]:= a = ParametricPlot[{t - Sin[t], 1 - Cos[t]}, {t, - 2, 2 + 2}]
2.0
1.5
Out[129]= 1.0
0.5
2 4 6
Ottava
Suoni
In[131]:= Play[Sin[2 440 t], {t, 0, 1}]
In[133]:= Sound[{Play[Sin[2 440 t], {t, 0, 1}], Play[Sin[2 880 t], {t, 0, 1}]}]
Le sette note
In[141]:= settenote = {0, 2, 4, 5, 7, 9, 11}
Out[141]= {0, 2, 4, 5, 7, 9, 11}
In[143]:= Sound
TablePlaySin2 440 q ^ - 9 + h t // Evaluate, {t, 0, 0.5}, {h, settenote}