?Plot

(*  grafico della funzione f[x]=x^2      *)

Plot[x^2,{x,-1,1}]

Options[Plot]

Plot[Sin[x],{x,0,2Pi}]

GraphicsRow[{Plot[x^2,{x,-1,1}],Plot[Sin[x],{x,0,2Pi}]},ImageSize->550]

Plot[x^2,{x,-1,1},AspectRatio->2]

Plot[x^2,{x,-1,1},AspectRatio->Automatic]

GraphicsRow[{Plot[Sin[x],{x,0,2Pi}],Plot[Sin[x],{x,0,2Pi},AspectRatio->Automatic]},ImageSize->550]

Plot[Sin[x],{x,0,2Pi},AspectRatio->Automatic]

GraphicsRow[{Plot[x^2,{x,-1,1},AspectRatio->2],Plot[Sin[x],{x,0,2Pi}]},ImageSize->550]

Plot[x^2,{x,-1,1},ImageSize->400]

Options[Plot]

AspectRatio->(1/GoldenRatio)

GoldenRatio

N[GoldenRatio,30]

(Sqrt[5]+1)/2

N[%,30]

TrueQ[GoldenRatio==(Sqrt[5]+1)/2]

N[1/GoldenRatio,30]

TrueQ[1/GoldenRatio==GoldenRatio-1]

Plot[x^2,{x,-1,1},ImageSize->300]

Plot[x^2,{x,-1,1},ImageSize->300,
AspectRatio->Automatic]

Plot[x^2,{x,-1,1},ImageSize->300,
AspectRatio->1]

Plot[Sin[x],{x,-Pi,Pi},ImageSize->300]

Plot[Sin[x],{x,-Pi,Pi},ImageSize->300,AspectRatio->Automatic]

Plot[{Sin[x],x},{x,-Pi,Pi},ImageSize->300]

Manipulate[Plot[{Sin[x],k*x},{x,-Pi,Pi},ImageSize->300],{k,-10,10}]

Manipulate[Plot[{Sin[x],k*x},{x,-Pi,Pi},ImageSize->300,PlotRange->{{-Pi,Pi},{-1,1}}],{k,-10,10}]

Manipulate[Plot[{Sin[x],x+x0},{x,-Pi,Pi},ImageSize->300,PlotRange->{{-Pi,Pi},{-1,1}}],{x0,-Pi,Pi}]

f[x_]:=x^3

D[f[x],x]

D[f[x],{x,2}]

f'[x]

Graphics[Point[{0,0}],Axes->True]

Graphics[{Red,PointSize[0.02],Point[{{0,0},{0,1}}],Blue,Line[{{0,0},{0,1}}]},Axes->True]

segmento=Graphics[{Red,PointSize[0.02],Point[{{0,0},{0,1}}],Blue,Thickness[0.01],Line[{{0,0},{0,1}}]},Axes->True]

Manipulate[Show[{Plot[{Sin[x],x+x0},{x,-Pi,Pi},ImageSize->300,PlotRange->{{-Pi,Pi},{-1,1}}],segmento}],{x0,-Pi,Pi}]

Manipulate[Plot[{Sin[x],x+x0},{x,-Pi,Pi},ImageSize->300,PlotRange->{{-Pi,Pi},{-1,1}},Epilog->{Red,PointSize[0.02],Point[{{0,0},{0,1}}],Blue,Thickness[0.01],Line[{{0,0},{0,1}}]}],{x0,-Pi,Pi}]

f[x]

Manipulate[Plot[{Sin[x],x+x0},{x,-Pi,Pi},ImageSize->300,PlotRange->{{-Pi,Pi},{-2,2}},Epilog->{Red,PointSize[0.02],Point[{{0,0},{-Pi/2,-1},{Pi/2,1}}]}],{x0,-Pi,Pi}]

f[x_]:=Sin[x]

f'[x]

Solve[Cos[x]==0,x]

Solve[x^3-3x^2+2x-1==0,x]

NSolve[x^3-3x^2+2x-1==0,x]

Plot[{Sin[x],x},{x,-Pi,Pi},ImageSize->300,AspectRatio->Automatic]

Plot[Sin[x],{x,-Pi,Pi},ImageSize->300,Epilog->{Line[{{-1,-1},{1,1}}]}]

(* comando Plot, opzione Epilog *)

Plot[Sin[x],{x,-Pi,Pi},ImageSize->300,Epilog->{Line[{{-2,-2},{2,2}}]}]

Plot[Sin[x],{x,-Pi,Pi},ImageSize->300,
Epilog->{
Line[{{-2,-2},{2,2}}],
{Red,PointSize[0.02],Point[{{-Pi,0},{0,0},{Pi,0}}]},
{Blue,PointSize[0.02],Point[{{-Pi/2,-1},{Pi/2,1}}]}
}]

?Solve

Solve[Sin[x]==0,x,Reals]

Solve[Sin[x]==0&&-Pi<=x<=Pi,x,Reals]

Solve[
And[
Sin[x]==0,
-Pi<=x<=Pi
],
x,Reals]

x->0

FullForm[x->0]

sol=Solve[Sin[x]==0&&-Pi<=x<=Pi,x,Reals]

sol=Solve[Cos[x]==0&&-Pi<=x<=Pi,x,Reals]

sol=Solve[x^3+x^2==0&&-Pi<=x<=Pi,x,Reals]

(* /. vuol dire "sostituisci a sinistra le assegnazioni a destra " *)

x/.sol

x/.Solve[And[Sin[x]==0,-Pi<=x<=Pi],x,Reals]

Map[{#,Sin[#]}&,
x/.Solve[And[Sin[x]==0,-Pi<=x<=Pi],x,Reals]
]

#^2&

Solve[Sin[x]==0,x]

Solve[{Sin[x]==0,-Pi<=x<=Pi},x]

x/.{x->2}

x*y+1/.{x->1,y->2}

x/.{{x->2},{x->3}}

x/.Solve[And[Sin[x]==0,-Pi<=x<=Pi],x]

Table[{x->k},{k,1,5,1/2}]

ls10=Table[k,{k,1,10}]

Map[#^2&,ls10]

Map[Sqrt[#]&,ls10]

Map[N[Sqrt[#]]&,ls10]

Map[N[Sqrt[#],30]&,ls10]

TableForm[Map[N[Sqrt[#],30]&,ls10]]

x/.Solve[And[Sin[x]==0,-Pi<=x<=Pi],x]

Map[{#,Sin[#]}&,
x/.Solve[And[Sin[x]==0,-Pi<=x<=Pi],x]
]

Module[{zeri= Map[{#,Sin[#]}&,
x/.Solve[And[Sin[x]==0,-Pi<=x<=Pi],x,Reals]
]},
Plot[Sin[x],{x,-Pi,Pi},ImageSize->300,
Epilog->{
Line[{{-2,-2},{2,2}}],
{Red,PointSize[0.02],Point[zeri]},
{Blue,PointSize[0.02],Point[{{-Pi/2,-1},{Pi/2,1}}]}
}]]

Module[{zeri= Map[{#,Sin[#]}&,
x/.Solve[And[Sin[x]==0,-Pi<=x<=Pi],x,Reals]
],critici=Map[{#,Sin[#]}&,
x/.Solve[{Cos[x]==0,-Pi<=x<=Pi},x,Reals]
]},
Plot[Sin[x],{x,-Pi,Pi},ImageSize->300,
Epilog->{
Line[{{-2,-2},{2,2}}],
{Red,PointSize[0.02],Point[zeri]},
{Blue,PointSize[0.02],Point[critici]}
}]]

Module[{zeri= Map[{#,Sin[2#]}&,
x/.Solve[And[Sin[2x]==0,-Pi<=x<=Pi],x,Reals]
],critici=Map[{#,Sin[2#]}&,
x/.Solve[{2Cos[2x]==0,-Pi<=x<=Pi},x,Reals]
]},
Plot[Sin[2x],{x,-Pi,Pi},ImageSize->300,
Epilog->{
Line[{{-2,-2},{2,2}}],
{Red,PointSize[0.02],Point[zeri]},
{Blue,PointSize[0.02],Point[critici]}
}]]

f0[x_]:=Sin[x]

f1[x_]:=x^3-x

f2[x_]:=x^4+3x^3-2x^2+1

Module[{f=f1,zeri,critici},
zeri= Map[{#,f[#]}&,
x/.Solve[{f[x]==0,-Pi<=x<=Pi},x,Reals]
];
critici=Map[{#,f[#]}&,
x/.Solve[{D[f[x],x]==0,-Pi<=x<=Pi},x,Reals]
];
Plot[f[x],{x,-1.3,1.3},ImageSize->300,
Epilog->{
Line[{{-2,-2},{2,2}}],
{Red,PointSize[0.02],Point[zeri[[-1]]]},
{Blue,PointSize[0.02],Point[critici[[-1]]]}
}]]

Module[{f=f1,zeri,critici},
zeri= Map[{#,f[#]}&,
x/.Solve[And[f[x]==0,-Pi<=x<=Pi],x,Reals]
];
critici=Map[{#,f[#]}&,
x/.Solve[{D[f[x],x]==0,-Pi<=x<=Pi},x,Reals]
];
Plot[f[x],{x,-1.3,1.3},ImageSize->300,
Epilog->{
Line[{{-2,-2},{2,2}}],
{Red,PointSize[0.02],Point[zeri[[-1]]]},
{Blue,PointSize[0.02],Point[critici[[-1]]]}
}]]

Map[{#,f2[#]}&,
x/.Solve[And[f2[x]==0,-4<=x≤2],x,Reals]
]

N[%284]

Map[Simplify[ToRadicals[#]]&,%284]

f2[x_]:=x^4+3x^3-2x^2+1

Module[{f=f2,zeri,critici},
zeri= Map[{#,f[#]}&,
x/.Solve[And[f[x]==0,-4<=x≤2],x,Reals]
];
critici=Map[{#,f[#]}&,
x/.Solve[{D[f[x],x]==0,-4<=x≤2},x,Reals]
];
Plot[f[x],{x,-4,2},ImageSize->300,
Epilog->{
{Red,PointSize[0.02],Point[zeri]},
{Blue,PointSize[0.02],Point[critici]}
}]]

Module[{f=f2,zeri,critici},
zeri= Map[{#,f[#]}&,
x/.Solve[And[f[x]==0,-Pi<=x<=Pi],x,Reals]
];
critici=Map[{#,f[#]}&,
x/.Solve[{D[f[x],x]==0,-Pi<=x<=Pi},x,Reals]
];
Plot[f[x],{x,-1,1},ImageSize->300,
Epilog->{
{Red,PointSize[0.02],Point[zeri]},
{Blue,PointSize[0.02],Point[critici]}
}]]

Plot[x^2,{x,-1,1},ImageSize->400,AspectRatio->Automatic,PlotRange->{{-1,1},{0,1/2}}]

Plot[x^2,{x,-1,1},ImageSize->200,AspectRatio->Automatic,PlotRange->{{-1,1},{0,2}}]

Plot[Sin[x],{x,0,2Pi}]

Plot[Sin[x],{x,0,2Pi},AspectRatio->Automatic]

Plot[Sin[x]/x,{x,-20Pi,20Pi}]

Plot[Sin[x]/x,{x,-20Pi,20Pi},PlotRange->All]

Plot[Sin[1/x],{x,-20Pi,20Pi},PlotRange->All]

Manipulate[Plot[Sin[1/x],{x,-k,k},PlotRange->All],{k,0.001,2}]

Plot[Sin[1/x],{x,-.2,.2},PlotRange->All,PlotPoints->200]

Plot[Sin[1/x],{x,-2Pi,2Pi},PlotRange->All,Epilog->{
{Red,PointSize[0.03],Point[{2,0}]},{Red,PointSize[0.03],Point[{-2,0}]}
}]

29.4/21

N[297/210]

N[Sqrt[2]]

Plot[x^3,{x,-2,2},ImageSize->400,AspectRatio->Automatic]

Plot[x^3-x,{x,-2,2},ImageSize->400,AspectRatio->Automatic,PlotRange->{{-2,2},{-1.5,1.5}}]

Plot[Sin[x],{x,0,2Pi},Epilog->{PointSize[0.02],Point[{0,0}],Point[{Pi,0}],Point[{2Pi,0}]}]

f[x_]:=x^3-x

f[1]

D[f[x],x]

Solve[D[f[x],x]==0,x]

{x,f[x]}  /. Solve[D[f[x],x]==0,x]

Plot[x^3-x,{x,-2,2},ImageSize->400,AspectRatio->Automatic,PlotRange->{{-2,2},{-1.5,1.5}},Epilog->{Point[%12]}]

Plot[x^3-x,{x,-2,2},ImageSize->400,AspectRatio->Automatic,PlotRange->{{-2,2},{-1.5,1.5}},Epilog->{
Point[{x,f[x]}  /. Solve[D[f[x],x]==0,x]]
}]

f[x_]:=2x^3-3x+1

g[x_]:=x^3-2x+1

Plot[f[x],{x,-2,2},ImageSize->400,AspectRatio->Automatic,Epilog->{
Point[{x,f[x]}  /. Solve[D[f[x],x]==0,x]]
}]

Plot[f[x],{x,-2,2},ImageSize->400,AspectRatio->Automatic,Epilog->{
Point[{x,f[x]}  /. Solve[D[f[x],x]==0,x]]
}]

graficomax[fun_]:=Plot[fun[x],{x,-2,2},ImageSize->100,AspectRatio->Automatic,Epilog->{
Point[{x,fun[x]}  /. Solve[D[fun[x],x]==0,x]]
}]

graficomax[f]

graficomax[g]

GraphicsRow[{graficomax[f],graficomax[g]},Spacings->50]

Show[{graficomax[f],graficomax[g]}]

f[x_]:=2x^3-3x+1

g[x_]:=x^3-2x+1

Manipulate[Plot[f[x],{x,-2,2},ImageSize->100,AspectRatio->Automatic,Epilog->{
Point[{x0,f[x0]}]
}],{x0,-2,2}]

Manipulate[Plot[f[x],{x,-2,2},ImageSize->200,AspectRatio->Automatic,PlotRange->{{-3,3},{-3,3}},Epilog->{
Point[{x0,f[x0]}]
}],{x0,-1,1}]

Manipulate[Plot[f[x],{x,-2,2},ImageSize->200,AspectRatio->Automatic,PlotRange->{{-3,3},{-3,3}},Epilog->{
Point[{x0,f[x0]}],
Line[{{x0-.5,f[x0]-.5D[f[x],x]/.x->x0},{x0+.5,f[x0]+.5D[f[x],x]/.x->x0}}]
}],{x0,-1.5,1.5}]

graftang[fun_,d_]:=Manipulate[Plot[fun[x],{x,-2,2},ImageSize->200,AspectRatio->Automatic,Epilog->{
Point[{x0,fun[x0]}],
Line[{{x0-d,fun[x0]-d*D[fun[x],x]/.x->x0},{x0+d,fun[x0]+d*D[fun[x],x]/.x->x0}}]
}],{x0,-2,2}]

g[x]

graftang[g,0.3]

graftang[Sin,0.6]

graftang[fun_,d_,xm_]:=Manipulate[Plot[fun[x],{x,-xm,xm},PlotRange->{{-xm,xm},{-xm,xm}},ImageSize->200,AspectRatio->Automatic,Epilog->{
Point[{x0,fun[x0]}],
Line[{{x0-d,fun[x0]-d*D[fun[x],x]/.x->x0},{x0+d,fun[x0]+d*D[fun[x],x]/.x->x0}}]
}],{x0,-xm,xm}]

graftang[Sin,0.6,Pi]

graftang[Sin,0.6,2Pi]