Quadrilatero articolato

Off[Set::write];

Off[FindRoot::lstol];

Off[FindRoot::cvmit];

Dimensioni iniziali

a0 = 1;
b0 = 3.3;
c0 = 2;
d0 = 4;
p0=0;
ϵ0=0;

Definizione aste

AB[a_,α_]:=a{Cos[α+45Degree],Sin[α+45 Degree]};

BC[b_,β_]:=b{Cos[β],Sin[β]};

CD[c_,γ_]:=-c{Cos[γ],Sin[γ]};

DA[d_]:={-d,0};

Punto generico della biella

BP[p_,ϵ_,β_]:=p{Cos[ϵ+β],Sin[ϵ+β]};

Soluzione analitica (serve per iniziare procedura numerica FindRoot)

analitica[a_,b_,c_,d_]=Solve[AB[a,α]+BC[b,β]+CD[c,γ]+DA[d]==0,{β,γ}];

ββ[α_]=β/.analitica[a0,b0,c0,d0]/.C[1]->0;

γγ[α_]=γ/.analitica[a0,b0,c0,d0]/.C[2]->0;

regola=FindRoot[AB[a0,5Degree]+BC[b0,β]+CD[c0,γ]+DA[d0]==0,{{β,N[ββ[5Degree][[2]]]},{γ,N[γγ[5 Degree][[2]]]}}];

Manipulate[(
Off[Set::write];

(* soluzione numerica *)
soluzione=Table[{{αa,β},{αa,γ}} /. With[{regola=regola},(regola=FindRoot[AB[a,αa]+BC[b,β]+CD[c,γ]+DA[d]==0,{{β,(β/.regola)},{γ,(γ/.regola)}}])],{αa,0,360Degree,5 Degree}];

soluzionebeta=Transpose[soluzione][[1]];
soluzionegamma=Transpose[soluzione][[2]];

(* funzioni interpolanti *)
beta=Interpolation[soluzionebeta,InterpolationOrder->1];
gamma=Interpolation[soluzionegamma,InterpolationOrder->1];

(*derivate prime e seconde *)

BPp[p_,ϵ_,β_]=D[BP[p,ϵ,β],β];
ABp[a_,α_]=D[AB[a,α],α];
BP2p[p_,ϵ_,β_]=D[BPp[p,ϵ,β],β];
AB2p[a_,α_]=D[ABp[a,α],α];

αf=α+0.00001;
Show[{
Graphics[{Thick,

Green, Opacity[0.4],
Polygon[{AB[a,α],AB[a,α]+BP[p,ϵ,beta[α]],AB[a,α]+BC[b,beta[α]]}],

Black,Opacity[1],
Line[{{0,0},AB[a,α],AB[a,α]+BC[b,beta[α]],AB[a,α]+BC[b,beta[α]]+CD[c,gamma[α]]}],

PointSize[0.021],

Red,
Point[{AB[a,α]+BP[p,ϵ,beta[α]]}],

Blue,
Point[{AB[a,α],AB[a,α]+BC[b,beta[α]]}],

Black,
Point[{{0,0},AB[a,α]+BC[b,beta[α]]+CD[c,gamma[α]]}],

Red,Opacity[vel],
Arrow[{AB[a,α]+BP[p,ϵ,beta[α]],
AB[a,α]+BP[p,ϵ,beta[α]]+ABp[a,α]+BPp[p,ϵ,beta[α]]*beta'[α]}],

Orange,Opacity[accel],
Arrow[{AB[a,α]+BP[p,ϵ,beta[α]],
AB[a,α]+BP[p,ϵ,beta[α]]+AB2p[a,α]+BP2p[p,ϵ,beta[α]]*(beta'[α])^2+ BPp[p,ϵ,beta[α]]*beta''[α]}]

}],
ParametricPlot[AB[a,θ]+BP[p,ϵ,beta[θ]],{θ,0,αf},PlotStyle->Thick]
},
PlotRange->0.1{{-30,70},{-40,60}},
ImageSize->700
]),
{{a,a0},0.1,4,Appearance->"Labeled"},
{{b,b0},1,5,Appearance->"Labeled"},
{{c,c0},1,6,Appearance->"Labeled"},
{{d,d0},1,6,Appearance->"Labeled"},
Delimiter,
{{ϵ,20 Degree},-180Degree,180Degree},
{{p,3},-8,8},
Delimiter,
{{vel,0},{0,1}},
{{accel,0},{0,1}},
Delimiter,
{{α,0Degree},0Degree,360 Degree,Appearance->"Open",RefreshRate->1},
ControlPlacement->Right,
SaveDefinitions->True
]