circle[{a_,b_},r_][t_]:={a,b}+r*{Cos[t],Sin[t]}

circle3d[{a_,b_},r_][t_]:={a,b,0}+r*{Cos[t],Sin[t],0}

ellisse[{a_,b_},{rx_,ry_}][t_]:={a,b}+{rx*Cos[t],ry*Sin[t]}

otto[t_]:={Sin[t],Sin[t]*Cos[t]}

otto3d[t_]:={Sin[t],Sin[t]*Cos[t],0}

trifoglio[t_ ]:={Cos[3t]Cos[t],Cos[3t]Sin[t]}

tangent[gamma_][t_]:=Simplify[
D[gamma[t],t]/(D[gamma[t],t].D[gamma[t],t])^(1/2)]
binormal[gamma_][t_]:=Simplify[Cross[D[gamma[t],t],D[gamma[t],{t,2}]]/(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].Cross[D[gamma[t],t],D[gamma[t],{t,2}]])^(1/2)]
normal[gamma_][t_]:=Simplify[Cross[binormal[gamma][t],tangent[gamma][t]]]
curvatura[gamma_][t_]:= Simplify[(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].Cross[D[gamma[t],t],D[gamma[t],{t,2}]])^(1/2)/(D[gamma[t],t].D[gamma[t],t])^(3/2)]
torsione[gamma_][t_]:=Simplify[(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].D[gamma[t],{t,3}])/(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].Cross[D[gamma[t],t],D[gamma[t],{t,2}]])]

ParametricPlot[otto[t],{t,0,2Pi},ImageSize->200]

ParametricPlot3D[otto3d[t],{t,0,2Pi},ImageSize->200]

ParametricPlot3D[{Cos[3t]Cos[t],Cos[3t]Sin[t],0},{t,0,2Pi},ImageSize->200]

ParametricPlot[trifoglio[t],{t,0,2Pi},ImageSize->200]

circle3d[{a_,b_},r_][t_]:={a,b,0}+r*{Cos[t],Sin[t],0}

elica[a_,b_][t_]:={a*Cos[t],a*Sin[t],b*t}

trifoglioprb[t_ ]:={Cos[3t]Cos[t],Cos[3t]Sin[t],Cos[3t]^2}

GraphicsRow[{ParametricPlot3D[circle3d[{0,0},1][t],{t,0,2Pi}],ParametricPlot3D[elica[1,.3][t],{t,0,2Pi}],ParametricPlot3D[trifoglioprb[t],{t,0,2Pi}]}]

GraphicsRow[{Plot[curvatura[circle3d[{0,0},1]][t]//Evaluate,{t,0,2Pi}],Plot[curvatura[elica[1,.3]][t]//Evaluate,{t,0,2Pi}],Plot[curvatura[trifoglioprb][t]//Evaluate,{t,0,2Pi}]}]

GraphicsRow[{Plot[torsione[circle3d[{0,0},1]][t]//Evaluate,{t,0,2Pi}],Plot[torsione[elica[1,.3]][t]//Evaluate,{t,0,2Pi}],Plot[torsione[trifoglioprb][t]//Evaluate,{t,0,2Pi}]}]

GraphicsRow[{ParametricPlot3D[circle3d[{0,0},1][t],{t,0,2Pi},Axes->None],Plot[curvatura[circle3d[{0,0},1]][t]//Evaluate,{t,0,2Pi},PlotLabel->"Curvatura"],Plot[torsione[circle3d[{0,0},1]][t]//Evaluate,{t,0,2Pi},PlotLabel->"Torsione"]}]

Manipulate[GraphicsRow[{Show[{ParametricPlot3D[circle3d[{0,0},1][t],{t,0,2Pi},Axes->None],Graphics3D[Point[circle3d[{0,0},1][k]]]}],Plot[curvatura[circle3d[{0,0},1]][t]//Evaluate,{t,0,2Pi},PlotLabel->"Curvatura",Epilog->Point[{k,curvatura[circle3d[{0,0},1]][t]/.t->k}]],Plot[torsione[circle3d[{0,0},1]][t]//Evaluate,{t,0,2Pi},PlotLabel->"Torsione",Epilog->Point[{k,torsione[circle3d[{0,0},1]][t]/.t->k}]]}],{k,0.001,2Pi}]

grafct[gamma_]:=Manipulate[GraphicsRow[{Show[{ParametricPlot3D[gamma[t],{t,0,2Pi},Axes->None],Graphics3D[Point[gamma[k]]]}],Plot[curvatura[gamma][t]//Evaluate,{t,0,2Pi},PlotLabel->"Curvatura",Epilog->Point[{k,curvatura[gamma][t]/.t->k}]],Plot[torsione[gamma][t]//Evaluate,{t,0,2Pi},PlotLabel->"Torsione",Epilog->Point[{k,torsione[gamma][t]/.t->k}]]}],{k,0.001,2Pi}]

grafct[trifoglioprb]

trifoglioprb[0]

torsione[elica[1,b]][t]

punti=Table[{t,Sin[t]},{t,0,6.,.1}]

ListPlot[punti]

fit[x_]:=Fit[punti,{1,x,x^2},x]

fit[x]

Plot[fit[x]//Evaluate,{x,0,2Pi}]

Show[{ListPlot[punti],Plot[fit[x]//Evaluate,{x,0,2Pi}]}]

Show[{ListPlot[punti],Plot[Fit[punti,{1,x^2,x^4},x]//Evaluate,{x,0,2Pi}]}]

rt[a_]:={{Cos[a],-Sin[a]},{Sin[a],Cos[a]}}

tangent[gamma_][t_]:=Simplify[
D[gamma[t],t]/(D[gamma[t],t].D[gamma[t],t])^(1/2)]

?circle

circle[{0,0},1][t]

D[circle[{0,0},1][t],t]

?curvatura

curvatura[circle3d[{0,0},1]][t]

Plot[curvatura[circle3d[{0,0},1]][t]//Evaluate,{t,0,2Pi}]

GraphicsRow[{Plot[curvatura[otto3d][t]//Evaluate,{t,0,2Pi}],ParametricPlot3D[otto3d[t],{t,0,2Pi}]},ImageSize->600]

Plot[curvatura[otto3d][t]//Evaluate,{t,0,2Pi}]

D[trifoglio[t],t]

tangent[circle[{0,0},1]][t]

tangent[trifoglio][t]

D[otto[t],t]

tangent[otto][t]

binormal[gamma_][t_]:=Simplify[Cross[D[gamma[t],t],D[gamma[t],{t,2}]]/(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].Cross[D[gamma[t],t],D[gamma[t],{t,2}]])^(1/2)]

normal[gamma_][t_]:=Simplify[Cross[binormal[gamma][t],tangent[gamma][t]]]

curvatura[gamma_][t_]:= Simplify[(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].Cross[D[gamma[t],t],D[gamma[t],{t,2}]])^(1/2)/(D[gamma[t],t].D[gamma[t],t])^(3/2)]

torsione[gamma_][t_]:=Simplify[(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].D[gamma[t],{t,3}])/(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].Cross[D[gamma[t],t],D[gamma[t],{t,2}]])]

tangent[elica[1,0.2]][t]

{-0.9805806756909201` Sin[t],0.9805806756909201` Cos[t],0.19611613513818402`}

torsione[trifoglioprb][t]

Plot[torsione[trifoglioprb][t]//Evaluate,{t,0,2Pi}]

binormal[gamma_][t_]:=Simplify[Cross[D[gamma[t],t],D[gamma[t],{t,2}]]/(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].Cross[D[gamma[t],t],D[gamma[t],{t,2}]])^(1/2)]

normal[gamma_][t_]:=Simplify[Cross[binormal[gamma][t],tangent[gamma][t]]]

curvatura[gamma_][t_]:= Simplify[(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].Cross[D[gamma[t],t],D[gamma[t],{t,2}]])^(1/2)/(D[gamma[t],t].D[gamma[t],t])^(3/2)]

torsione[gamma_][t_]:=Simplify[(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].D[gamma[t],{t,3}])/(Cross[D[gamma[t],t],D[gamma[t],{t,2}]].Cross[D[gamma[t],t],D[gamma[t],{t,2}]])]

Manipulate[Show[
ParametricPlot3D[trifoglioprb[t],{t,0,2Pi}],
Graphics3D[{PointSize[0.03],Red,Point[trifoglioprb[k]]}],
Graphics3D[{Thick,Green,Line[{trifoglioprb[k],trifoglioprb[k]+tangent[trifoglioprb][k]/5}//Evaluate]}],
Graphics3D[{Thick,Blue,Line[{trifoglioprb[k],trifoglioprb[k]+normal[trifoglioprb][k]/5}//Evaluate]}],
Graphics3D[{Thick,Red,Line[{trifoglioprb[k],trifoglioprb[k]+binormal[trifoglioprb][k]/5}//Evaluate]}]
],{k,0.1,2Pi}]

Manipulate[ParametricPlot[rt[k].ellisse[{0,0},{2,1}][t],{t,0,2Pi},PlotRange->{{-3,3},{-3,3}}],{k,0,2Pi}]

ParametricPlot[
Table[
rt[k].ellisse[{0,0},{2,1}][t],{k,0,2Pi,0.2Pi}
],
{t,0,2Pi},PlotRange->{{-3,3},{-3,3}}]

Manipulate[ParametricPlot[
Table[
rt[k].ellisse[{0,0},{2,1}][t],{k,0,2Pi,h*Pi}
],
{t,0,2Pi},PlotRange->{{-3,3},{-3,3}}],{h,0.1,2}]

Table[k^2,{k,1,10}]

circle[{0,2.1},3][t]

{circle[{0,0},1][t],circle[{0.2,0.5},1][t]}

ParametricPlot[{circle[{0,0},1][t],circle[{0.2,0.5},1][t]},{t,0,2Pi}]

Manipulate[ParametricPlot[ellisse[{h,k},{2,1}][t],{t,0,2Pi},PlotRange->{{-3,3},{-3,3}}],{h,-3,3},{k,-3,3}]

ParametricPlot[otto[t],{t,0,2Pi}]

trifoglio[t_ ]:={Cos[3t]Cos[t],Cos[3t]Sin[t]}

ParametricPlot[trifoglio[t],{t,0,2Pi}]

elica[a_,b_][t_]:={a*Cos[t],a*Sin[t],b*t}

ParametricPlot3D[elica[1,0.1][t],{t,0,8Pi}]

inscurve[n_,a_,gamma_][t_]:=Insert[gamma[t],a,n]

otto[t]

inscurve[3,t,otto][t]

inscurve[2,t^2,otto][t]

inscurve[3,0,otto][t]

tangent[gamma_][t_]:=Simplify[D[gamma[tt],tt]/(D[gamma[tt],tt].D[gamma[tt],tt])^(1/2)] /. tt->t

binormal[gamma_][t_]:=Simplify[Cross[D[gamma[tt],tt],D[gamma[tt],{tt,2}]]/(Cross[D[gamma[tt],tt],D[gamma[tt],{tt,2}]].Cross[D[gamma[tt],tt],D[gamma[tt],{tt,2}]])^(1/2)] /. tt->t

ParametricPlot[otto[t],{t,0,2Pi}]

ParametricPlot3D[inscurve[3,0,otto][t],{t,0,2Pi}]

ParametricPlot3D[inscurve[1,0,otto][t],{t,0,2Pi}]

ParametricPlot3D[inscurve[3,t/4,otto][t],{t,0,2Pi}]

ottocos[t_]:=inscurve[3,Cos[t],otto][t]

ottocos[t]

ottosin[t_]:=inscurve[3,Sin[t],otto][t]

ottosin[t]

ParametricPlot3D[ottosin[t],{t,0,2Pi}]

ParametricPlot3D[ottocos[t],{t,0,2Pi}]

Show[GraphicsRow[{ParametricPlot3D[ottosin[t],{t,0,2Pi}],ParametricPlot3D[ottocos[t],{t,0,2Pi}]}]]

curvatura[ottosin][t]

curvatura[ottosin][0.2]

Plot[curvatura[ottosin][t],{t,0,2Pi}]

torsione[ottosin][t]

curvatura[ottocos][t]

torsione[ottocos][t]

Plot[curvatura[ottocos][t],{t,0,2Pi}]

Plot[torsione[ottocos][t],{t,0,2Pi}]

Plot[curvatura[ottosin][t],{t,0,2Pi}]

tangent[circle[{0,0},1]][t]

inscurve[3,2,circle[{0,0},1]][t]

curvatura[inscurve[3,2,circle[{0,0},1]]][t]

torsione[inscurve[3,2,circle[{0,0},1]]][t]

curva1[t_]:={3t-t^3,3t^2,3t+t^3}

curvatura[curva1][t]

torsione[curva1][t]

tangent[curva1][t]//PowerExpand

caratt[gamma_][t_]:={tangent[gamma][t],normal[gamma][t],binormal[gamma][t],curvatura[gamma][t],torsione[gamma][t]}

caratt[elica[1,1/2]][t]//PowerExpand//Factor

{{-((2 Sin[t])/(Sqrt[5])),((2 Cos[t])/(Sqrt[5])),(1/(Sqrt[5]))},{-Cos[t],-Sin[t],0},{((Sin[t])/(Sqrt[5])),-((Cos[t])/(Sqrt[5])),(2/(Sqrt[5]))},(4/5),(2/5)}

elicoide[a_,b_][u_,v_]:={a*v*Cos[u],b*v*Sin[u],u}

elicoide[1,1/2][u,v]

elica[1,1/2][u]

g1=ParametricPlot3D[Evaluate[elicoide[1,1/2][u,v]],{u,-Pi/2,2Pi},{v,0,1}]

g2=ParametricPlot3D[Style[elica[1,1/2][t],{RGBColor[1,0,0],AbsoluteThickness[2]}],{t,-Pi/2,2Pi}]

trifoglio[t_ ]:={Cos[3t]Cos[t],Cos[3t]Sin[t]}

ParametricPlot[trifoglio[t],{t,0,Pi}]

rt90[vec_]:={vec[[2]],-vec[[1]]}

ParametricPlot[trifoglio[t],{t,0,Pi},Epilog->{Point[Table[trifoglio[k],{k,0,Pi,Pi/10}]],Line[Table[{trifoglio[k],trifoglio[k]+tangent[trifoglio][k]/8},{k,0,Pi,Pi/10}]],Line[Table[{trifoglio[k],trifoglio[k]+tangent[trifoglio][k]/8},{k,0,Pi,Pi/10}]]}]

trifoglio[0]

tangent[trifoglio][0]

ParametricPlot[trifoglio[t],{t,0,Pi},Epilog->{Point[trifoglio[1]],Line[{trifoglio[1],trifoglio[1]+tangent[trifoglio][1]/5}]}]

Manipulate[ParametricPlot[trifoglio[t],{t,0,Pi},Epilog->{Point[trifoglio[k]],Line[{trifoglio[k],trifoglio[k]+tangent[trifoglio][k]/5}]}],{k,0,Pi}]

trifoglioprb[t_ ]:={Cos[3t]Cos[t],Cos[3t]Sin[t],Cos[3t]^2}

ParametricPlot3D[{Cos[3t]Cos[t],Cos[3t]Sin[t],Cos[3t]^2},{t,0,Pi}]

Show[
ParametricPlot3D[{Cos[t],Sin[t],Cos[3t]},{t,0,2Pi}],
Graphics3D[{PointSize[0.03],Red,Point[{Cos[1],Sin[1],Cos[3]}]}]
]

Manipulate[Show[
ParametricPlot3D[{Cos[t],Sin[t],Cos[3t]},{t,0,2Pi}],
Graphics3D[{PointSize[0.03],Red,Point[{Cos[k],Sin[k],Cos[3k]}]}]
],{k,0,2Pi}]

Manipulate[Show[
ParametricPlot3D[trifoglioprb[t],{t,0,2Pi}],
Graphics3D[{PointSize[0.03],Red,Point[trifoglioprb[k]]}],
Graphics3D[{Thick,Green,Line[{trifoglioprb[k],trifoglioprb[k]+tangent[trifoglioprb][k]/5}]}],
Graphics3D[{Thick,Blue,Line[{trifoglioprb[k],trifoglioprb[k]+normal[trifoglioprb][k]/5}]}],
Graphics3D[{Thick,Red,Line[{trifoglioprb[k],trifoglioprb[k]+binormal[trifoglioprb][k]/5}]}]
],{k,0,2Pi}]

ParametricPlot3D[Style[elica[1,1/2][t],{RGBColor[1,0,0],AbsoluteThickness[2]}],{t,-Pi/2,2Pi},Epilog->Point[{0,0,0}]]

normal[elica[1,1/2]][t]

elica[1,1/2][t]

elica[1,1/2][t]+1/2*normal[elica[1,1/2]][t]

elica[1,1/2][k]+s*normal[elica[1,1/2]][k]

g3=Show[ParametricPlot3D[Style[elica[1,1/2][t],{RGBColor[1,0,0],AbsoluteThickness[2]}],{t,-Pi/2,2Pi},DisplayFunction->Identity],Table[ParametricPlot3D[elica[1,1/2][k]+s*normal[elica[1,1/2]][k],{s,0,1},DisplayFunction->Identity],{k,-Pi/2,2Pi,Pi/16}],DisplayFunction->$DisplayFunction]

Show[GraphicsRow[{Show[g1,g2,DisplayFunction->Identity],g2,g3}]]

tubo[gamma_][r_][t_,teta_]:=gamma[t]+r(-Cos[teta]*normal[gamma][t]+Sin[teta]*binormal[gamma][t])

ParametricPlot3D[tubo[elica[1,1/4]][1/2][t,teta],{t,0,6Pi},{teta,-Pi/2,3Pi/2}]

ParametricPlot3D[tubo[inscurve[3,0,circle[{0,0},1]]][1/4][t,teta],{t,-Pi/2,2Pi},{teta,-Pi/2,Pi/2}]

seashell[gamma_][r_][t_,teta_]:=gamma[t]+r*t*(-Cos[teta]*normal[gamma][t]+Sin[teta]*binormal[gamma][t])

ParametricPlot3D[seashell[elica[1,0.6]][0.1][t,teta],{t,Pi/4,5Pi},{teta,0,2Pi},PlotPoints->{48,20}]

toro[a_,b_,c_][u_,v_]:={(a+b*Cos[v])Cos[u],(a+b*Cos[v])Sin[u],c*Sin[v]}

Manipulate[ParametricPlot3D[toro[3,8,8][u,v],{u,0,k*Pi},{v,0,2Pi}],{k,0.1,1}]