(*^ ::[ frontEndVersion = "Microsoft Windows Mathematica Notebook Front End Version 2.2"; microsoftWindowsStandardFontEncoding; fontset = title, "Times New Roman", 24, L0, center, nohscroll, bold; fontset = subtitle, "Times New Roman", 18, L0, center, nohscroll, bold; fontset = subsubtitle, "Times New Roman", 14, L0, center, nohscroll, italic; fontset = section, "Times New Roman", 18, L0, nohscroll, bold, grayBox; fontset = subsection, "Times New Roman", 14, L0, nohscroll, bold, blackBox; fontset = subsubsection, "Times New Roman", 13, L0, nohscroll, B65535; fontset = text, "Times New Roman", 12, L0, nohscroll, cellOutline; fontset = smalltext, "Times New Roman", 10, L0, nohscroll; fontset = input, "Courier New", 12, L-5, nowordwrap, bold; fontset = output, "Courier New", 12, L-5, nowordwrap; fontset = message, "Courier New", 12, L-5, nowordwrap, R65535; fontset = print, "Courier New", 12, L-5, nowordwrap; fontset = info, "Courier New", 12, L-5, nowordwrap, B65535; fontset = postscript, "Courier New", 12, L0, nowordwrap; fontset = name, "Arial", 10, L0, nohscroll, italic; fontset = header, "Times New Roman", 12, L0; fontset = footer, "Times New Roman", 12, L0, center; fontset = help, "Times New Roman", 10, L0, nohscroll; fontset = clipboard, "Times New Roman", 12, L0, nohscroll; fontset = completions, "Times New Roman", 12, L0, nohscroll; fontset = graphics, "Courier New", 10, L0, nowordwrap, nohscroll; fontset = special1, "Times New Roman", 12, L0, nohscroll; fontset = special2, "Times New Roman", 12, L0, nohscroll; fontset = special3, "Times New Roman", 12, L0, nohscroll; fontset = special4, "Times New Roman", 12, L0, nohscroll; fontset = special5, "Times New Roman", 12, L0, nohscroll; fontset = leftheader, "Times New Roman", 12, L2; fontset = leftfooter, "Times New Roman", 12, L2; fontset = reserved1, "Courier New", 10, L0, nowordwrap, nohscroll;] :[font = title; inactive; preserveAspect; startGroup; nohscroll; center; ] MathLive Professional :[font = subsubtitle; inactive; preserveAspect; nohscroll; center; ] Simple Harmonic Motion Example Original by W.Shaw1995 Last Update: 20/4/96 :[font = section; inactive; preserveAspect; startGroup; nohscroll; ] Introductory Notes :[font = subsubsection; inactive; preserveAspect; nohscroll; backColorRed = 65535; backColorGreen = 65535; backColorBlue = 65535; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 65535; plain; fontName = "Times New Roman"; fontSize = 13; ] This notebook demonstrates the idea of simple harmonic motion using a ball and spring model. :[font = subsubsection; inactive; preserveAspect; endGroup; nohscroll; backColorRed = 65535; backColorGreen = 65535; backColorBlue = 65535; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 65535; plain; fontName = "Times New Roman"; fontSize = 13; ] The initialisation cells create the model and show the animation. :[font = section; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Create the graphics :[font = input; initialization; preserveAspect; nowordwrap; ] *) Needs["Graphics`Colors`"] General::spell1 //Off; Needs["Graphics`Shapes`"]; Needs["MathLive`MathLive`"]; (* Ignore the error message - MathLive does not shadow the Shapes definition of wireframe*) (* :[font = input; initialization; preserveAspect; nowordwrap; ] *) LaunchLive[]; ResetLive[]; (* :[font = input; initialization; preserveAspect; nowordwrap; ] *) gSpring = Graphics3D[ { Thickness[0.03] , Line[ Table[ {0.2*Sin[u],0.2*Cos[u], 1-1.05 u/(20*Pi)} , {u, 0, 20 Pi, Pi/8}] ] }]; (* :[font = input; initialization; preserveAspect; nowordwrap; ] *) radius = 0.4; (* 16,10 refer to the no. of polygons used to approximate the sphere - see ?Sphere *) gBall = Graphics3D[ Sphere[radius,16,10] ]; (* :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) gAnchor = Graphics3D[ Cuboid[{-.5,-.5,0}] ]; (* :[font = section; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Create the objects in MathLive :[font = input; initialization; preserveAspect; nowordwrap; ] *) (* Remove any existing objects and reset the model range *) Live[ Destroy[ Model3D["Default`"] ]]; Live[ Change[ Model3D["Default`"] , BoundingBox -> Off ]]; (* :[font = input; initialization; preserveAspect; nowordwrap; ] *) Live[ Create[ Object3D["Spring"], gSpring] ]; Live[ Change[ Object3D["Spring"] , MouseMovement -> False , PointOfRotation -> {0,0,0} , RenderMode -> SmoothShaded , Color -> LightBlue ] ]; (* :[font = input; initialization; preserveAspect; nowordwrap; ] *) Live[ Create[ Object3D["Ball"], gBall] ]; Live[ Change[ Object3D["Ball"] , MouseMovement -> False , RenderMode -> FlatShaded , PointOfRotation -> {0,0,0} , Location -> {0,0,- radius} , Color -> Blue ]]; (* :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) Live[ Create[ Object3D["Anchor"], gAnchor] ]; Live[ Change[ Object3D["Anchor"] , MouseMovement -> False , RenderMode -> FlatShaded , Diffuse -> 0.7 , Color -> Orange , Location -> {0,0,1}] ]; (* :[font = section; inactive; initialization; preserveAspect; startGroup; Cclosed; nohscroll; ] Animate :[font = input; initialization; preserveAspect; nowordwrap; ] *) amplitude = 0.5; anim = Table[ { Change[ Object3D["Spring"] , Scale -> {1,1,1- amplitude Sin[t]} , Location -> {0,0,amplitude Sin[t]} ] , Change[ Object3D["Ball"] , Location -> {0,0,amplitude Sin[t] - radius} ] } , {t, 0, 4*Pi, Pi/10}]; (* :[font = input; initialization; preserveAspect; endGroup; nowordwrap; ] *) Live[ anim ]; (* :[font = section; inactive; preserveAspect; startGroup; nohscroll; ] For further information, advice or suggestions please contact- :[font = text; inactive; preserveAspect; endGroup; endGroup; nohscroll; cellOutline; backColorRed = 65535; backColorGreen = 65535; backColorBlue = 65535; fontColorRed = 0; fontColorGreen = 0; fontColorBlue = 0; plain; fontName = "Times"; fontSize = 12; ] Email: support@milohedge.com Post: Milo Hedge Ltd, The Oxford Centre for Innovation, Mill Street, Oxford, OX2 0JX WWW: http://www.milohedge.com/mathlive/ ^*)