<<

Animating Spherical Using Jacobi's Elliptic Functions

A.C. Baroudy [email protected]

Abstract

Some years ago I have written a Maple document ( already on Maple's online home page) on the subject of animating a simple pendulum for large angles of oscillation. This gave me the chance to test Maple command JacobiSN(time, k). I was very much pleased to see Maple do a wonderful job in getting these Jacobi's elliptic functions without a glitch. Today I am back to these same functions for a similar purpose though much more sophisticated than the previous one. The idea is: 1- to get the differential equations of motion for the Spherical Pendulum (SP), 2- to solve them, 3- to use Maple for finding the inverse of these Elliptic Integrals i.e. finding the displacement z as function of time, 4- to get a set of coordinates [x, y, z] for the positions of the bob at different times for plotting, 5- finally to work out the necessary steps for the purpose of animation. It turns out that even with only 3 oscillations where each is defined with only 20 positions of the bob for a total of 60 points on the graph, the animation is so overwhelming that Maple reports: " the length of the output exceeds 1 million". Not withstanding this warning, Maple did a perfect job by getting the animation to my satisfaction. Note that with only 60 positions of the bob, the present article length is equal to 11000 KB! To be able to upload it, I have to save it without running the last command related to the animation. Doing so I reduced it to a mere 500 KB.

It was tiring to get through a jumble of formulas, calculations and programming so I wonder why I have to go through all this trouble to get this animation and yet one can get the same thing with much better animation from the internet. I think the reason is the challenge to be able to do things that others have done before and secondly the idea of creating something form nothing then to see it working as expected, gives (at least to me) a great deal of pleasure and satisfaction. This is beside the fact that, to my knowledge, no such animation for (SP) has been published on Maple online home page with detailed calculations & programming as I did.

Finding the differential equations of the SP motion with R being the radius of the sphere on which the pendulum bob is moving with no . , (1) . (1.1)

The acting on the bob are 1- the mg having the same direction as axis OZ, 2- the N of the spherical surface which is always normal to the sphere. The moment about OZ of these two forces being equal to zero, the bob C about OZ must be constant and equal to 2* area swept by the bob projection on x-y plane in unit time: = , where we consider moment of linear momentum per unit (= angular momentum per unit mass) at t = 0 with being the initial distance of the bob from OZ axis and its initial velocity.

From we get . (2)

A 3d equation is obtained from the fact that the system is conservative (no friction by hypothesis) with total energy ( kinetic + potential) constant: , here too we take both kinetic & potential energies per unit mass. Substituting values from (1.1) & (2) for: , & , into v : = , we get a relation between z, dz & dt: , (3) Which, once rearranged, gives the first between z & t: . (4)

obtained by eliminating dt between & , resulting in: . (5)

CONVERSION TO CANONICAL FORM

We see that the polynomial under the radical

dz is of degree 3. Let the 3 roots of this polynomial be z1 < z2 < z3 so that f(z) = becomes:

,

.

Let u = , so f(z) becomes:

= , and m = . The above equation becomes:

Putting , we get :

,

This last equation is in the canonical form that we are looking for where: , = ,

, .

The canonical form is : , (I)

. (II)

We solve for the inverse of this integral i.e. w = sn(pt) . Once we have w = sn (pt) we get z from: &

. (III)

See J.L. Synge & B. A. Griffith " Principles of Mechanics ", pages 337-340.

As for the period we can see that z must have the same period as . Now from (II) , (pt) has for period : where the complete EI of the 1st kind is: K = , so that (t) in (I) must have for period . This is similar to what we have with circular function such as

.

= time for one cycle .

The square of the Jacobian elliptic functions : have for period 2.K so has a real period = .

The period of EQW is the same as that of EQZ since they are the same. This period of EQW is that of the complete integral of the first kind: 1

that we multiply by .

Now why the period of EQZ is and not ? The reason is to be found in the nature of the relation between z & w: . This equation shows that z has the same period as while this latter has for period not . From the relation: , we get by squaring both sides: which shows that .

See M. R. Spiegel " Advanced Calculus ", pages: 338 & 339.

We simplify our problem by taking R = 1, m = 1, g = 1, = 1 where being parallel to x-y plane. We set the initial position of of the bob in z-x plane as : , , From which we get the two constants : C = angular momentum per unit mass of the bob, E = total energy per unit mass of the bob: ,

. We solve the 3d degree polynomial under the radical in EQZ to get the roots which are all real. We label them as z1 < z2 < z3. this polynomial must be positive for the radical to be real , hence z must be between z1 = & z2 = 0.324192354864376. See plot below.

From (EQZ) we get elliptic integral whose solution, say t(z), is a function of z which represents the time for the pendulum to move from lower limit(z = z1) to upper limit (z=z2) of integration which correspond to w = 0 & w =1 for (EQW). However we need its inverse i.e. coordinate z as F(t) in order to get the position of the bob at any given time. To get z = F(t) we use JacobiSN( time found by integration of the EI , modulus = k ) which gives sn (w) = sn(pt). From equation (III) we get the value of z which we use as upper limit of integration in ( ). We thus obtain the value of z that we just found . We finally get [x,y,z] coordinates corresponding to different values of z as a list made of different points such as: , , z ] , where each one corresponds to one position of the bob. > being the radius of the sphere on which the pendulum bob is rolling >

(1)

The torque ( total moment around OZ-axis) being = 0, the angular momentum C is constant and equal to 2* area swept by the bob on x-y plane in unit time = = moment of linear momentum per unit mass (= angular momentum per unit mass) at t = 0 where r being the distance of the bob from z-axis. From we get d4.

>

(2) (2)

Energy equation: total energy (kinetic + potential ) = E = constant : > (3) Substituting values of , & , into v : , we get: >

(4)

Writing Energy Equation anew: >

(5)

Collecting terms in dz & dt in the above gives a relation between z, dz & dt which is the differential equation EQZ that once integrated gives the time as function of z-coordinate: >

(6)

(7) (2)

and

>

(7)

We simplify our problem by taking R = 1, m = 1, g = 1, = 1 where being parallel to x-y plane. We set the initial position of of the bob in z-x plane as : , From which we get the two constants : C = angular momentum per unit mass of the bob, E = total energy per unit mass of the bob: ,

>

(8)

>

(9) (2)

(7)

>

(9)

We shall define : , and , for the purpose of integration. >

(10)

We solve f(z) = the 3d degree polynomial under the radical in Z to get the roots which are all real. We label them as z1 < z2 < z3. f(z) must be positive for the radical to be real , hence z must be between z1 = & z2 = 0.324192354864376. See plot below. >

(11) (2)

(7)

>

(9)

>

30 20 10

1 2 3 z

The range for the integration of Z is between z1 & z2 the two roots that make the radical in (eqz) positive. Here we define W = canonical form & both p & k that belong to it : >

(12)

Once (eqz) is integrated from z1 to z2 we get the time of a half period of oscillation.This time is

where i runs from 1 to n. Actually we shall use the canonical form (EQW) instead of (eqz) Then with sphere equation , we get the projection of the pendulum bob on x-y plane. From ( ) we get angle , by integration from z = z1 to z = , hence the coordinates of the bob at time [ x = (2)

(7)

>

(9)

>

cos , y = sin z = ]

The half - period of Z is 1.886452973 seconds. that is what we get using canonical form W defined above.

>

1.886452973

1.886452973 (13) > Our integral is in fact ,

, where we put T = pt. After integration we introduce a constant :

.

Now the inverse has the form: = sine of the amplitude of = the upper limit of integration = w, This means that JacobiSN = w = upper limit of integration. Since we start with hence .

We divide the half period into n , (2)

(7)

>

(9)

>

then , and to each value of z we get the corresponding coordinate r from .

By integrating (

x = , y = .

Note that ,

. Thus we get the same result with int(Z, z = z1..z2)= 1.886452973 or int(W,w = 0..1) = 1.886452973. For ..to.. loop to make 1- list L1 of different sets of coordinates corresponding to different positions of the bob at multiple

2- list 3- list NOTE MAKE (n) ALWAYS an even number so that we do not need to change &

>

(14) (2)

(7)

>

(9)

>

1.886452973

(14) > > Note that rad = angle that the plane, formed by this last position & z- axis, makes with x-y plane. > Getting list L2 of the bob position on the 2d half of the 1st period: Method #1: Different positions of the bob on the 2d half period are symmetrical with respect to the plane passing through upper position of the bob and the z-axis. To get these new positions we need to get first the angle that each position makes with this plane. This angle equals: .

Once we have angle we just apply a CCW rotation of the coordinates of the point taken from list L1. The following for.. to.. loop will get a list Lphase We next set a matrix for the CCW rotation of the object.

This matrix is :

,

Lphase below.

>

(15) > > Here we get list L2 coordinates of the 2d set of points corresponding to bob positions on the 2d half period (downswing) then we plot both lists L1 = positions of the bob on the upswing & L2 = positions of the bob on the downswing of the 1st period. (2)

(7)

>

(9)

>

(14)

>

Getting list L2 of the bob position on the 2d half of the 1st period: Method #2: The other way is to apply the first loop with the initial position as: , where : 2.361592889 radians . When we apply this for ..to..loop to get the new position at different t = ( ) with , we get the entries in the list that we already have but in reverse i.e. with we get 0.324192354864376 , with we get = the 2d entry to the last

...... , with we get = z1= the first entry in

So we start at t = 0 & z2 = 0.324192354864376, , ...... The next step is to find the new angle (2)

(7)

>

(9)

>

(14)

>

etc. This new is equal to = = 2*2.361592889 , in reverse to z2 and son on. using the for ..to.. loop:

. where we use if is odd , and if is even .

, so that , and the new coordinates for downswing of the bob are: , ]. Lx2. >

> R >

Use of Method #2 to get the same 2d list = L2 obtained above of the positions of the bob in the downswing oscillation = 2d half of the 1st period. >

We can see that L2 & LSTCOORD2 lists are identical. >

(16) (2)

(7)

>

(9)

>

(14)

>

>

(16) We need now to get the 2d oscillation starting from z2 =

Hence these new values are equal each to .

> (2)

(7)

>

(9)

>

(14)

>

>

(16)

>

Now for the 2d downswing: initial value of = with = 2.361592889 downswing are those in ( - ) = = , , then we have: = + , = . 2d downswing.

> (2)

(7)

>

(9)

>

(14)

>

>

(16)

>

>

. > (2)

(7)

>

(9)

>

(14)

>

>

(16)

>

>

>

in here are of the form: = ]), 6 > (2)

(7)

>

(9)

>

(14)

>

>

(16)

>

>

>

>

We can continue to get the next upswing by making : , in the for..to..loop used for upswing, and we get the next downswing by making: and so on...... (2)

(7)

>

(9)

>

(14)

>

>

(16)

>

>

>

>

This is the projection of the bob on the xy plane where numbers refer to the start of each half oscillation on the lower circle (z = z1) or the upper circle ( z = z2):

Getting the animation.

We need to put all 6 lists of coordinates in one list: ALLLST = L1 , L2, upswingLST2, downswingLST2, upswingLST3, downswingLST3. Then we define a proc () that takes one entry at a time from ALLLST and plot the point representing the bob position as a small sphere attached to the center by a string of length = 1 = radius of the sphere. In the same time we make the sphere visible by plotting : 1- a parallel circle ( color = blue) showing the upper limit of swing of the bob at z = z2, 2- a parallel circle( color = blue) showing the lower limit of swing of the bob at z = z1, 3- the equatorial circle, 4- a circle between z1 & z = 0, 5- a great circle representing the meridian at x = 0. To show the track followed by the bob we plot all points in advance with different colors where each color corresponds to a half period encompassing 21 positions each. We limit our total oscillations to only 3 oscillation for a total of 106 positions. With only 3 oscillation the memory is taxed too much that Maple reports that the length of the output exceeds 1 million!!! (2)

(7)

>

(9)

>

(14)

>

>

(16)

>

>

>

>

>

66 (17) >

> >

[Length of output exceeds limit of 1000000] (2)

(7)

>

(9)

>

(14)

>

>

(16)

>

>

>

>