MathGroup Archive 2002

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

Search the Archive

Re: Ball Rolling down on Cosh[t] Path


Having noticed your statement " ... BEYOND MY MEANS " I thing you aren't yet
familiar with Lagrangian formalism. It's quite easy to derive a general
equation of motion for a point mass, subjected to gravity and to moving on a
curve f = y(x) (i.e. f = Cosh[#]&).

1) I'll leave re-deriving equation to you, here is what I've got (just copy
paste it).:

\!\(getEq[
      f_] := \[IndentingNewLine]\(x''\)[
            t] + \(x'\)[t]\^2\ \(2\ \(f'\)[x[t]]\ \(f''\)[x[t]]\)\/\(1 +
\(f'\
\)[x[t]]\^2\) + \(g\ \(f'\)[x[t]]\)\/\(1 + \(f'\)[x[t]]\^2\) == 0 /. g ->
1\)

2) Next, you integrate it .:

getSol[f_, x0_] :=
  Module[{tStop},
    NDSolve[{getEq[f], x[0] == x0, x'[0] == 0}
        , x
        , {t, 0, 10}
        , MaxStepSize -> 1/100
        , StoppingTest :> If[x0 < 0, x > 0, x < 0]
        ] // First
    ]

3) Here follows animation code, specially for linear versus cosh case, apply
my initial conditions (below)

makeDuo[f_, g_, x0_, fpt_] :=
  Module[{
      solf = getSol[f, x0],
      solg = getSol[g, x0],
      tf, tg, maxT, minT
      },
    tf = solf[[1, 2, 1, 1, 2]];
    tg = solg[[1, 2, 1, 1, 2]];
    maxT = Max[{tf, tg}];
    minT = Min[{tf, tg}];
    Do[
      Plot[{f@x, g@x}
        , {x, 0, x0}
        , AspectRatio -> Automatic
        , Frame -> True
        , Axes -> False
        , Epilog -> {
            AbsolutePointSize[10],
            Hue[0], Point[{x[t], f@x[t]} /. solf],
            Hue[.6], Point[{x[t], g@x[t]} /. solg]
            }
        ]
      , {t, 0, minT, minT/fpt}
      ]
    ]

4) My initial conditions. In my opinion, you weren't true on this. Saying "
STARTING FROM THE SAME HEIGHT " is not enough - you should specify x as
well, thus specifing starting POINT and not just height y.

makeDuo[(Cosh[1.] - 1) # &, Cosh[#] - 1 &, 1, 23]


Feel free to modify the code, it should be easy.


bye,

Borut



<Matthias.Bode at oppenheim.de> wrote in message
news:ambv6f$r44$1 at smc.vnet.net...
| 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: Re: build-in commutativity
  • Next by Date: RE: How to display package contents?
  • Previous by thread: Re: Ball Rolling down on Cosh[t] Path
  • Next by thread: RE: Re: Ball Rolling down on Cosh[t] Path