Clear[g,x1,y1,x2,y2,λ1,λ2];modifierRange={1,10};modifierMapping=<|"Gravity"->g,"Mass1"->Subscript[m,1],"Mass2"->Subscript[m,2],"Length1"->Subscript[l,1],"Length2"->Subscript[l,2]|>;parameterManipulate=Manipulate[Module[{params,ics,aeqns,soldp,v1x,v1y,v2x,v2y,tValues,v1xValues,v1yValues,v2xValues,v2yValues,combinedData,fourierTransform},(*Definetimevalues*)tValues=Range[0,15,0.1];(*Initializeparameters*)params=<|g->9.81,Subscript[m,1]->1,Subscript[m,2]->1,Subscript[l,1]->1,Subscript[l,2]->1|>;(*Updatetheselectedparameter*)modifier=modifierMapping[Modifier];params[modifier]=i;params=Normal[params];(*Definealgebraicanddifferentialequations*)aeqns={x1[t]^2+y1[t]^2==Subscript[l,1]^2,(x2[t]-x1[t])^2+(y2[t]-y1[t])^2==Subscript[l,2]^2};deqns={x1''[t]==-λ1[t]x1[t]-gSubscript[m,1],y1''[t]==-λ1[t]y1[t],x2''[t]==-λ2[t](x2[t]-x1[t]),y2''[t]==-λ2[t](y2[t]-y1[t])-gSubscript[m,2]};(*Defineinitialconditions*)ics={x1[0]==1+0.1i,y1[0]==0,x1'[0]==0,y1'[0]==0,x2[0]==1,y2[0]==-1,x2'[0]==0,y2'[0]==0};(*Solvethesystemofequations*)soldp=Quiet[First[NDSolve[{deqns,aeqns,ics}/.params,{x1,y1,x2,y2,λ1,λ2},{t,0,15},Method->{"IndexReduction"->{"Pantelides","ConstraintMethod"->"Projection"}}]]];(*Computevelocities*)v1x[t_]:=Evaluate[D[x1[t],t]/.soldp];v1y[t_]:=Evaluate[D[y1[t],t]/.soldp];v2x[t_]:=Evaluate[D[x2[t],t]/.soldp];v2y[t_]:=Evaluate[D[y2[t],t]/.soldp];v1xValues=v1x/@tValues;v1yValues=v1y/@tValues;v2xValues=v2x/@tValues;v2yValues=v2y/@tValues;(*CombinedataandcomputeFourierTransform*)combinedData=Flatten[{v1xValues,v1yValues,v2xValues,v2yValues}];fourierTransform=Fourier[combinedData];(*Generateplots*)Row[{Column[{ListLinePlot[Transpose[{tValues,v1xValues}],PlotLabel->"v1x Values",AxesLabel->{"Time","v1x"},ImageSize->Medium],ListLinePlot[Transpose[{tValues,v1yValues}],PlotLabel->"v1y Values",AxesLabel->{"Time","v1y"},ImageSize->Medium]}],Column[{ListLinePlot[Transpose[{tValues,v2xValues}],PlotLabel->"v2x Values",AxesLabel->{"Time","v2x"},ImageSize->Medium],ListLinePlot[Transpose[{tValues,v2yValues}],PlotLabel->"v2y Values",AxesLabel->{"Time","v2y"},ImageSize->Medium]}],Column[{Histogram[combinedData,20,"Probability",PlotLabel->"Histogram of Combined Velocity Data",ImageSize->Medium],ListLinePlot[Abs[fourierTransform],PlotLabel->"Fourier Transform Magnitudes",ImageSize->Medium]}]}]],{i,modifierRange[[1]],modifierRange[[2]],1},{Modifier,Keys[modifierMapping]},SaveDefinitions->True];manipulateToGif[parameterManipulate,"parameter_manipulate"]