Re: Re: Re: Non-Linear pendulum

• To: mathgroup at smc.vnet.net
• Subject: [mg105036] Re: [mg105011] Re: Re: [mg104874] Non-Linear pendulum
• From: "David Park" <djmpark at comcast.net>
• Date: Wed, 18 Nov 2009 07:01:05 -0500 (EST)
• References: <18584294.1258455287758.JavaMail.root@n11>

```Alexei,

Sometimes one is deriving a function by various Solve routines, or by
substitutions and perhaps in multiple steps. If it is a major object of the
analysis, then I would prefer to actually SEE the function that results and
not have it depend on a chain of previous definitions. And I usually like to
have explicit items in graphics statements and not a chain of evaluations.
It makes it easier to understand what is happening and debug if there are
problems.

But it is really a matter of style and preference.

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

From: Alexei Boulbitch [mailto:Alexei.Boulbitch at iee.lu]

Dear David,

construction:

\[Theta][t_] = \[Theta][t] /. s

Previously I met constructions like \[Theta][t_] with SetDelayed, rather
than with Set. Could you please
comment a bit on the use of such a construct with Set?

Thank you in advance and best regards, Alexei

pendulum = {Line[{{0, 0}, {0, -1}}], Circle[{0, -1.3}, 0.3]};
l = 20;
g = 9.81;
Clear[\[Theta]];
s = First@
NDSolve[{\[Theta]''[t] == -g/l Sin[\[Theta][t]], \[Theta][0] ==
Pi/2, \[Theta]'[0] == 0}, \[Theta], {t, 0, 30}]
\[Theta][t_] = \[Theta][t] /. S

Animate[
Graphics[Rotate[pendulum, \[Theta][t], {0, 0}],
PlotRange -> {{-2, 2}, {-2, .5}}],
{t, 0, 30},
AnimationRunning -> False]

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/ <http://home.comcast.net/%7Edjmpark/>

From: Allamarein [mailto:matteo.diplomacy at gmail.com]

I'm getting to know Mathematica. I want to compile a code to see the
non-linear pendulum behavior.

pendulum= {Line[{{0, 0}, {0, -1}}], Circle[{0, -1.3}, 0.3]};
l = 20;
g = 9.81;
s = NDSolve[
{ \[Theta]''[t] == -g /l Sin[\[Theta][t]],
\[Theta][0] == Pi/2,
\[Theta]'[0] == 0}, \[Theta],
{t, 0, 30}];
Animate[
Graphics[Rotate[pendulum, \[Theta[]t], {0, 0}],
PlotRange -> {{-2, 2}, {0, -2}}],
{t, 0, 30}, AnimationRunning -> False]

This code doesn't work. I realized my error is in Rotate argument. If
I change this line with:

Graphics[Rotate[pendulum, Sin[t], {0, 0}]

code runs, but it's not the result (obviously).
How can I correct my code, to see the pendulum oscillates with \[Theta]
[t] law?

--
Alexei Boulbitch, Dr., habil.
Senior Scientist

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg

Phone: +352 2454 2566
Fax:   +352 2454 3566

Website: www.iee.lu

This e-mail may contain trade secrets or privileged, undisclosed or
otherwise confidential information. If you are not the intended recipient
and have received this e-mail in error, you are hereby notified that any
review, copying or distribution of it is strictly prohibited. Please inform
us immediately and destroy the original transmittal from your system. Thank