MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

FW: Re: Ball Rolling down on Cosh[t] Path

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36766] FW: [mg36738] Re: Ball Rolling down on Cosh[t] Path
  • From: Blimbaum Jerry DLPC <BlimbaumJE at ncsc.navy.mil>
  • Date: Tue, 24 Sep 2002 01:34:17 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I'd like to add a JLink animation of the rolling ball based on Selwyn's
solution:

 UseFrontEndForRendering = False;

createWindow[] := Module[{frame},
    frame = JavaNew["com.wolfram.jlink.MathFrame", "Doppler Animation"];
    drawArea = JavaNew["com.wolfram.jlink.MathCanvas"];
    drawArea@setUsesFE[UseFrontEndForRendering];
    drawArea@setSize[800, 600];
JavaBlock[frame@setLayout[JavaNew["java.awt.BorderLayout"]];
      frame@add[drawArea, ReturnAsJavaObject[BorderLayout`CENTER]];
      frame@pack[];
      frame@setSize[800, 600];
      frame@setLocation[200, 200];
      JavaShow[frame]];
frame
]

  drawRoll[t_] := 
    Show[curve, 
      Graphics[{RGBColor[1, 0, 0], Disk[{xx[t], Cosh[xx[t]]}, 0.05]}], 
      PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}}, AspectRatio -> Automatic, 
      Axes -> None, DisplayFunction -> Identity];

 times = Range[0, 5, .05];

  LoadJavaClass["java.lang.Thread"];

  AnimationPlot[t_List] := JavaBlock[Block[{frm},
frm = createWindow[];
Map[(obj = drawRoll[#];
            			  drawArea@setMathCommand["obj"];
drawArea@repaintNow[];
Thread@sleep[5];) &, t
]
]]

AnimationPlot[times]

jerry blimbaum   panama city, fl


-----Original Message-----
From: Selwyn Hollis [mailto:slhollis at earthlink.net]
To: mathgroup at smc.vnet.net
Subject: [mg36766] [mg36738] Re: Ball Rolling down on Cosh[t] Path


Matthias,

The simplest way to get the equation of motion is to set up the 
Lagrangian. Let's assume a 1 kg mass. Then the kinetic energy is

    KE = Simplify[(1/2)*(x'[t]^2 + D[Cosh[x[t]],t]^2)]

and the potential energy is

    PE = 9.8*Cosh[x[t]]

The Lagrangian is

    L = KE - PE

and the equation of motion is

    diffeq =
    Simplify[ D[D[L, x'[t]], t] ] == Simplify[ D[L, x[t]] ]

Now solve and animate ...

    xx[t_] = x[t]/. First[
       NDSolve[{diffeq, x[0] == -1, x'[0] == 0}, x[t], {t, 0, 5}]]

    curve = Plot[Cosh[x], {x, -1, 1}]

    Do[
       Show[curve,
            Graphics[Disk[{xx[t], Cosh[xx[t]]}, 0.025]],
            PlotRange -> {{-1.2, 1.2}, {0.9, 1.65}},
            AspectRatio -> Automatic, Axes->None],
      {t, 0, 5, 0.1}]

----
Selwyn Hollis



Matthias.Bode at oppenheim.de wrote:
> Dear Colleagues,
> 
> I intend to make an animation in which 
> 
> ball A rolls down on an inclined plane from the left whilst
> 
> ball B - starting from the same height - rolls down Cosh[t]'s path from
the
> right.
> 
> x-axis is time t, y-axis is height h.
> 
> Ball A is fine; ball B - which should arrive at h=0 before A - is beyond
my
> means.
> 
> Thank you for your consideration,
> 
> Matthias Bode
> Sal. Oppenheim jr. & Cie. KGaA
> Koenigsberger Strasse 29
> D-60487 Frankfurt am Main
> GERMANY
> Tel.: +49(0)69 71 34 53 80
> Mobile: +49(0)172 6 74 95 77
> Fax: +49(0)69 71 34 95 380
> E-mail: matthias.bode at oppenheim.de
> Internet: http://www.oppenheim.de
> 
> 




  • Prev by Date: Re: Exporting Cells to PDF
  • Next by Date: Re: List operation, LabeledListPlot, Goto Statement
  • Previous by thread: Re: Re: Ball Rolling down on Cosh[t] Path
  • Next by thread: Exporting Cells to PDF