Skip to main content

motion of rattle-back

Project description

RattleBack: motion of rattle-back

RattleBack(abch, ABCD, init, t, sigma=0, g=981, **kw):
abch,ABCD = tuples of four real numbers, where
  a,b,c = radii of ellipsoid (cm)
  h = OG (O = center of ellipsoid, G = center of mass) (cm)
  A,B,C = moments of inertia along a,b,c axis (cm^2)
  D = product of intertia in a-b plane (cm^2)
init = initial condition of integration (shape (6,))
t = evaluation time (1d array) (sec)
sigma = friction coefficient (cm^2/sec)
g = gravity acceleration (cm/sec^2)
kw = keyword arguments passed to scipy.integrate.odeint
return y = output of odeint (shape(len(t),6)), where
  y[:,0:3] = euler angles alpha,beta,gamma
  y[:,3:6] = angular velocities omega_i (i=1,2,3)
all variables are measured in CGS units and radians
A,B,C,D,sigma corresponds to those of
  Kane & Levinson DIVIDED BY MASS of rattleback
-------------------------------------------------------------
reference: T. R. Kane and D. A. Levinson
  "Realistic Mathematical Modeling of the Rattleback"
   International Journal of Non-Linear Mechanics 17 (1982) 175

example code:

import numpy as np
import matplotlib.pyplot as plt
from scipy.constants import degree
from RattleBack import RattleBack

abch = (20,3,2,1)
ABCD = (2,16,17,-0.2)
sigma = 1
init = [0.5*degree, 0.5*degree, 0,0,0,-5]
t = np.linspace(0,10,500)

y = RattleBack(abch, ABCD, init, t, sigma)
alpha,beta,gamma = y.T[:3] # Euler angles
delta = np.arccos(np.cos(alpha)*np.cos(beta)) # tilt angle

plt.figure(figsize=(5,5.5))

plt.subplot(211)
plt.plot(t, gamma/degree)
plt.ylabel(r'$\gamma$  / deg')

plt.subplot(212)
plt.plot(t, delta/degree)
plt.ylabel(r'$\delta$  / deg')
plt.xlabel(r'$t$ = time  / sec')
plt.tight_layout()
plt.show()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

RattleBack-0.0.2.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

RattleBack-0.0.2-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page