# SolveLagrangian

 SolveLagrangian[linkage, {t, start, end}]function calculates the Lagrangian of the linkage, define the Lagrange's equations and numerically differentiateit. It returns the list of interpolation functions of the driving variables. SolveLagrangian[linkage, {lagrangian}, {t, start, end}]Lagrangian of the linkage can be passed as second argument of the function. The function generates Lagrange's equations based on the lagrangian.
• If linkage has \$LDTorques or \$LDForces records they are taken into account as the Lagrange's equation is derived.
• Lagrangian () is calculated from the kinetical energy () and potential energy (V) as
• = T - V
• The Lagrange' equations are calculated as :
• , where
• qi is the i-th generalized coordinate
• Qi is the i-th generalized force
• The following options of NDSolve can be given:
 AccuracyGoal Automatic AccuracyGoal is an option for various numerical operations which specifies how many effective digits of accuracy should be sought in the final result. Compiled Automatic Compiled is an option for various numerical and plotting functions which specifies whether the expressions they work with should automatically be compiled. DependentVariables Automatic DependentVariables is an option which specifies the list of all objects that should be considered as dependent variables in equations that have been supplied. EvaluationMonitor None EvaluationMonitor is an option for various numerical computation and plotting functions that gives an expression to evaluate whenever functions derived from the input are evaluated numerically. InterpolationOrder Automatic InterpolationOrder is an option for Interpolation, as well as ListLinePlot, ListPlot3D, ListContourPlot and related functions, that specifies what order of interpolation to use. MaxStepFraction 1 -- 10 MaxStepFraction is an option to functions like NDSolve that specifies the maximum fraction of the total range to cover in a single step. MaxSteps 10000 MaxSteps is an option to functions like NDSolve that specifies the maximum number of steps to take in generating a result. MaxStepSize Automatic MaxStepSize is an option to functions like NDSolve that specifies the maximum size of a single step used in generating a result. Method Automatic Method is an option for various algorithm-intensive functions that specifies what internal methods they should use. NormFunction Automatic NormFunction is an option for functions such as FindFit and NDSolve which gives a function to be minimized in generating results. PrecisionGoal Automatic PrecisionGoal is an option for various numerical operations which specifies how many effective digits of precision should be sought in the final result. SolveDelayed Automatic SolveDelayed is an option to NDSolve. SolveDelayed -> False causes the derivatives to be solved for symbolically at the beginning. SolveDelayed -> True causes the ODEs to be evaluated numerically and the derivatives solved for at each step. StartingStepSize Automatic StartingStepSize is an option to NDSolve and related functions that specifies the initial step size to use in trying to generate results. StepMonitor None StepMonitor is an option for iterative numerical computation functions that gives an expression to evaluate whenever a step is taken by the numerical method used. WorkingPrecision MachinePrecision WorkingPrecision is an option for various numerical operations which specifies how many digits of precision should be maintained in internal computations.
 Out[2]=
Define two spring damper torque on the two links
Display the mechanism
 Out[4]=
Set the driving velocities to 0. These values will be used as initial velocities at start time.
 Out[5]=
Set the driving variables to 15° and 45° respectively these value will be used as initial values at start time
 Out[6]=
Solve the Lagrangian's equation fro (0,10) interval
 Out[7]=
Plot the time function of the generalized coordinates
 Out[8]=