{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Appendix1 - packages that have some differential equations...

This preview shows pages 1–2. Sign up to view the full content.

H * packages that have some differential equations to solve and define some utility functions * L Needs @ "DifferentialEquations`NDSolveProblems`" D ; Needs @ "DifferentialEquations`NDSolveUtilities`" D ; Needs @ "DifferentialEquations`InterpolatingFunctionAnatomy`" D ; Needs @ "GUIKit`" D ; ClearAll @ "Global` * " D ; Off @ General:: spell D ; Off @ General:: spell1 D ; Print @ "Kinematics" D ; m = 2; L = 1; g = 9.81; k = 2000; alpha = 8 0,0,theta'' @ t D< ; Print @ "angular acceleration of RB: alpha = ",alpha D ; xC = H L 2 L * Cos @ theta @ t DD ; yC = H L 2 L * Sin @ theta @ t DD ; rC = 8 xC,yC,0 < ; Print @ "position vector of C: rC = ",rC D ; xA = L * Cos @ theta @ t DD ; yA = L * Sin @ theta @ t DD ; rA = 8 xA,yA,0 < ; Print @ "position vector of A: rA = ",rA D ; Print @ "Forces" D ; G = 8 0, - mg,0 < ; Print @ "gravitational force at C: G = ", G D ; delta = LSin @ theta @ t DD - LSin @ Pi 6 D ; Fe = 8 0, - kdelta,0 < ; Print @ "elastic force at A: Fe = ", Fe D IC = m * L^2 12; Print @ "mass moment of inertia wrt C: ICz = ",IC D ; IO = IC + m * H L 2 L ^2; Print @ "mass moment of inertia wrt O: IOz = ICz + m * H L 2 L ^2 = ", Simplify @ IO DD ; Print @ "Summ of the moments in O at t -> t1:" D eqI = Simplify @ IO * alpha - Cross @ rC,G 3 DD ; solutionI = Solve @ eqI 0,theta'' @ t 1 DD ; Print @ "moment equation: IO alpha = sum M wrt O = rC x G" D ; Print @ "Solution: theta'' @ t D = ",theta'' @ t D .Simplify @ solutionI DD ; H *------------------* L t0 = 0; soldif = NDSolve @8 eqI 0, theta @ 0 D == N @ Pi D 3, theta' @ 0 D == 0 < ,theta, 8 t,t0,Infinity < , Method fi 8 EventLocator, "Event" fi H theta @ t D - Pi 6 L<D ; t1 = InterpolatingFunctionDomain @ First @ theta . soldif 1, - 1 DD ; theta1 = H Evaluate @ theta @ t D . soldif D . t fi t1 1 DD ; omega1 = H Evaluate @ D @ theta @ t D .soldif,t

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}