Celestial mechanics
Celestial mechanics systems.
The package covers orbits under gravity and relativity, spin-orbit coupling, and charges in magnetic fields.
DipoleChargeElement(label, *, x=1.0, y=0.0, z=0.0, alpha=1.0, values=None)
Bases: Element
Charge in the magnetic dipole field of a planet.
The charge is at the position (x, y, z), and its velocities are x', y', and z'.
The parameter alpha is the product of the charge and the dipole moment, divided by the mass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the charge. |
required |
x
|
float
|
The initial first coordinate. |
1.0
|
y
|
float
|
The initial second coordinate. |
0.0
|
z
|
float
|
The initial third coordinate, along the dipole. |
0.0
|
alpha
|
float
|
The product of the charge and the dipole moment, divided by the mass. |
1.0
|
values
|
Mapping[str, object] | None
|
Further values by name, such as initial velocities named with a prime, or |
None
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import DipoleChargeElement
>>> DipoleChargeElement('charge', alpha=2.0).alpha
2.0
Source code in src/skcomplex/systems/physics/celestial_mechanics/_dipoles.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
DipoleLorentzInteraction(label, *, target)
Bases: LagrangianInteraction
Motion of a charge in the magnetic dipole field of a planet.
The motion is the Euler-Lagrange equations of |x'|² / 2 + alpha (x y' - y x') / r³, the kinetic energy and the
coupling of the velocity to the vector potential of a dipole along the z axis, with the value alpha of the
target. It is a proton trapped in the radiation belts, a cosmic ray deflected by the Earth, or an electron in a
magnetic bottle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the charge. |
required |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import DipoleLorentzInteraction
>>> DipoleLorentzInteraction('lorentz', target='charge').target
'charge'
Source code in src/skcomplex/systems/physics/celestial_mechanics/_dipoles.py
96 97 98 | |
DumbbellElement(label, *, u=1.0, theta=0.0, v=0.0, phi=0.0, psi=math.pi / 2, delta=0.5, epsilon=0.1, mu=0.9, values=None)
Bases: Element
Rigid dumbbell orbiting a primary.
The element holds the position of its centre of mass and the orientation of its arm.
The cylindrical coordinates (u, theta, v) place the centre of mass of the dumbbell relative to the primary, and
the spherical angles (phi, psi) give the direction of its arm, of length epsilon in units of the mean orbit
radius. The mass 1 - delta of the dumbbell sits at delta epsilon along the arm and the mass delta at
1 - delta against it. The five coordinates are those DumbbellMotionInteraction moves, and their velocities are
the derivatives u', theta', v', phi', and psi'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the dumbbell. |
required |
u
|
float
|
The initial distance from the axis through the primary. |
1.0
|
theta
|
float
|
The initial orbital angle. |
0.0
|
v
|
float
|
The initial height above the orbital plane. |
0.0
|
phi
|
float
|
The initial azimuth of the arm. |
0.0
|
psi
|
float
|
The initial polar angle of the arm, |
pi / 2
|
delta
|
Annotated[float, open(0, 1)]
|
The share of the second mass in the mass of the dumbbell, |
0.5
|
epsilon
|
Annotated[float, closed_open(0, oo)]
|
The length of the arm in units of the mean orbit radius. |
0.1
|
mu
|
Annotated[float, open(0, 1)]
|
The share of the primary in the mass of the three bodies. |
0.9
|
values
|
Mapping[str, object] | None
|
Further values by name, such as an initial velocity named with a prime, or |
None
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import DumbbellElement
>>> DumbbellElement('dumbbell').delta
0.5
Source code in src/skcomplex/systems/physics/celestial_mechanics/_spin_orbit.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
DumbbellMotionInteraction(label, *, target)
Bases: LagrangianInteraction
Motion of a rigid dumbbell around a primary.
The motion is the Euler-Lagrange equations of the Lagrangian of its orbit and its spin.
The Lagrangian is L = (u'² + u² theta'² + v'²) / 2 + I (psi'² + sin² psi phi'²) / 2 + (1 - delta) / rho12 + delta /
rho13, with the moment of inertia I = delta (1 - delta) epsilon² / mu of the arm and the distances rho12 and
rho13 of the two masses from the primary, all read from the target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the dumbbell. |
required |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import DumbbellMotionInteraction
>>> DumbbellMotionInteraction('motion', target='dumbbell').target
'dumbbell'
Source code in src/skcomplex/systems/physics/celestial_mechanics/_spin_orbit.py
164 165 166 | |
EinsteinOrbitInteraction(label, *, target, alpha=1.0, epsilon=0.05)
Bases: Interaction
Einstein's orbit equation u'' = alpha + epsilon u² - u of the inverse radius of a planet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the planet, whose value |
required |
alpha
|
Annotated[float, open(0, oo)]
|
The Newtonian inverse semi-latus rectum. |
1.0
|
epsilon
|
Annotated[float, closed_open(0, oo)]
|
The strength of the relativistic correction. |
0.05
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import EinsteinOrbitInteraction
>>> EinsteinOrbitInteraction('orbit', target='planet', epsilon=0.1).epsilon
0.1
Source code in src/skcomplex/systems/physics/celestial_mechanics/_spin_orbit.py
374 375 376 377 378 379 380 381 382 383 384 385 | |
GeodesicParticleElement(label, x=(0.0, 0.0, 0.0, 0.0), *, values=None)
Bases: Element
Test particle at the spacetime position x = (t, r, theta, phi) near a mass.
The mass is central, and the particle has its four-velocity.
The position is a vector in the Schwarzschild or Boyer-Lindquist coordinates of the space, and its derivative x'
is the four-velocity, the derivative of the position by the proper time of a massive particle or by the affine
parameter of a light ray. The particle is drawn in the equatorial plane, at (r cos phi, r sin phi).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the particle. |
required |
x
|
ArrayLike
|
The initial position |
(0.0, 0.0, 0.0, 0.0)
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the initial four-velocity |
None
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import GeodesicParticleElement
>>> GeodesicParticleElement('particle', x=[0.0, 10.0, 1.5708, 0.0]).x
[0.0, 10.0, 1.5708, 0.0]
Source code in src/skcomplex/systems/physics/celestial_mechanics/_geodesics.py
78 79 80 81 82 83 84 85 86 | |
KeplerBodyElement(label, *, x=10.0, y=0.0, px=0.0, py=10.0, G=1.0, mass=1000.0)
Bases: Element
Planet at (x, y) relative to a heavy star, with canonical momenta (px, py).
The planet is that of the Kepler problem.
The star of mass mass sits at the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the planet. |
required |
x
|
float
|
The initial first coordinate. |
10.0
|
y
|
float
|
The initial second coordinate. |
0.0
|
px
|
float
|
The initial first momentum per unit mass. |
0.0
|
py
|
float
|
The initial second momentum per unit mass. |
10.0
|
G
|
Annotated[float, open(0, oo)]
|
The gravitational constant. |
1.0
|
mass
|
Annotated[float, open(0, oo)]
|
The mass of the star. |
1000.0
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import KeplerBodyElement
>>> KeplerBodyElement('planet', mass=10.0).mass
10.0
Source code in src/skcomplex/systems/physics/celestial_mechanics/_orbits.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
KeplerianDumbbellSystem(u=1.0, vu=0.0, theta=0.0, omega=1.0, *, phi=0.0, spin=3.0, v=0.0, vv=0.0, psi=1.5707963267948966, vpsi=0.0, delta=0.5, epsilon=0.1, mu=0.9, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The Keplerian dumbbell.
Two masses on a rigid massless arm orbit a primary under gravity.
The centre of mass of the dumbbell at the cylindrical coordinates (u, theta, v) about the primary and the arm at
the spherical angles (phi, psi) move under the dimensionless Lagrangian L = (u'² + u² theta'² + v'²) / 2 + I
(psi'² + sin² psi phi'²) / 2 + (1 - delta) / rho12 + delta / rho13, with the moment of inertia I = delta (1 -
delta) epsilon² / mu of the arm. The distances of the two masses from the primary are rho12² = u² + v² + delta²
epsilon² + 2 delta epsilon P and rho13² = u² + v² + (1 - delta)² epsilon² - 2 (1 - delta) epsilon P, with P = u
sin psi cos(theta - phi) + v cos psi. Its Euler-Lagrange equations are the equations of motion of Dilão and
Murteira. The gravity gradient across the arm couples the spin to the orbit, the simplest spin-orbit coupling of a
rigid body. For epsilon = 0 the orbit is a Kepler orbit, of period 2π at u = 1. The energy and the angular
momentum about the normal to the orbital plane are conserved. By default the arm spins three times faster than it
orbits, in the orbital plane, and its spin and orbit exchange angular momentum. The system has the coordinates
dumbbell.u, dumbbell.theta, dumbbell.v, dumbbell.phi, and dumbbell.psi, their velocities named with a
prime, and the observables dumbbell.energy and dumbbell.angular_momentum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
float
|
The initial distance of the centre of mass from the axis through the primary. |
1.0
|
vu
|
float
|
The initial radial velocity. |
0.0
|
theta
|
float
|
The initial orbital angle. |
0.0
|
omega
|
float
|
The initial orbital angular velocity. |
1.0
|
phi
|
float
|
The initial azimuth of the arm. |
0.0
|
spin
|
float
|
The initial spin of the arm about the normal to the orbital plane. |
3.0
|
v
|
float
|
The initial height above the orbital plane. |
0.0
|
vv
|
float
|
The initial vertical velocity. |
0.0
|
psi
|
float
|
The initial polar angle of the arm, |
1.5707963267948966
|
vpsi
|
float
|
The initial rate of the polar angle of the arm. |
0.0
|
delta
|
float
|
The share of the second mass in the mass of the dumbbell, |
0.5
|
epsilon
|
float
|
The length of the arm in units of the mean orbit radius. |
0.1
|
mu
|
float
|
The share of the primary in the mass of the three bodies. |
0.9
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import KeplerianDumbbellSystem
>>> KeplerianDumbbellSystem(epsilon=0.2).prepare().system_.elements[0].epsilon
0.2
Source code in src/skcomplex/systems/physics/celestial_mechanics/_spin_orbit.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
KerrFrameDraggingSystem(radius=10.0, *, mass=1.0, spin=0.9, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A particle without angular momentum that falls into a spinning mass.
The mass drags the particle around it.
The particle follows a timelike geodesic of the Kerr spacetime KerrSpace in the equatorial plane, in units with G
= c = 1, with its proper time as the time of the system. It starts at rest in the radius at r₀, with zero angular
momentum L = g_tφ dt/dτ + g_φφ dφ/dτ = 0. A particle without angular momentum around a static mass falls straight
in, but the spin drags the frames around it: the particle turns with the angular velocity dφ/dt = -g_tφ / g_φφ = 2
M a / (r³ + a² r + 2 M a²) of the frames at its radius, faster as it falls. The system has the position particle.x
= (t, r, theta, phi) and the four-velocity particle.x'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
The initial radius |
10.0
|
mass
|
float
|
The mass |
1.0
|
spin
|
float
|
The spin parameter |
0.9
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The particle starts inside the ergosphere, at a radius of at most |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import KerrFrameDraggingSystem
>>> round(KerrFrameDraggingSystem().prepare().system_.elements[0].values["x'"][3], 5)
0.00199
Source code in src/skcomplex/systems/physics/celestial_mechanics/_geodesics.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
KerrSpace(mass=1.0, spin=0.5, *, curvature=False, label='space')
Bases: SpacetimeSpace
Spacetime outside a spinning mass M, the Kerr metric.
The mass has the angular momentum M a, and the metric is in Boyer-Lindquist coordinates.
With Σ = r² + a² cos²θ and Δ = r² - 2 M r + a², the line element in (t, r, theta, phi) is
ds² = -(1 - 2Mr/Σ) dt² - (4 M a r sin²θ / Σ) dt dφ + Σ/Δ dr² + Σ dθ² + (r² + a² + 2 M a² r sin²θ / Σ) sin²θ dφ²,
in units with G = c = 1. The term in dt dφ drags the frames of free particles around the spin axis. The mass and
the spin enter the metric as exact rationals, which keeps the symbolic derivation fast.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mass
|
float
|
The mass |
1.0
|
spin
|
float
|
The spin parameter |
0.5
|
curvature
|
bool
|
Whether |
False
|
label
|
str
|
The label of the space in its system. |
'space'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The mass is not positive, or the spin exceeds the mass. |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import KerrSpace
>>> KerrSpace(mass=1.0, spin=0.5).prepare().metric_[0, 3]
-4*r*sin(theta)^2/(4*r^2 + cos(theta)^2)
Source code in src/skcomplex/systems/physics/celestial_mechanics/_geodesics.py
178 179 180 181 182 183 184 185 186 187 188 | |
LightBendingSystem(impact_parameter=20.0, distance=2000.0, *, mass=1.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A light ray that passes a static mass and is deflected towards it.
The ray follows a null geodesic of the Schwarzschild spacetime SchwarzschildSpace, in units with G = c = 1, with
the affine parameter as the time of the system. It starts at the distance D along the axis behind the mass, offset
by the impact parameter b, aimed parallel to the axis, with the energy E = 1 and the angular momentum L = b.
Far from the mass the ray bends by 4 M / b, twice the Newtonian deflection of a particle at the speed of light, as
the eclipse of 1919 measured for starlight that grazes the Sun. The system has the position photon.x = (t, r,
theta, phi) and the tangent photon.x'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
impact_parameter
|
float
|
The impact parameter |
20.0
|
distance
|
float
|
The distance |
2000.0
|
mass
|
float
|
The mass |
1.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The ray would be captured by the mass, its impact parameter being at most |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import LightBendingSystem
>>> round(LightBendingSystem().prepare().system_.elements[0].values["x'"][0], 4)
1.001
Source code in src/skcomplex/systems/physics/celestial_mechanics/_geodesics.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
NBodySystem(preset='figure_eight', *, masses=None, positions=None, velocities=None, G=None, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Bodies in the plane that attract each other pairwise by Newtonian gravity.
The preset 'figure_eight' is the periodic orbit of three equal masses found by Chenciner and Montgomery, with
period 6.3259 for G = 1. The preset 'inner_solar_system' is the Sun with Mercury, Venus, the Earth, and Mars on
circular orbits, in astronomical units and years, with G = 4 π². Masses, positions, velocities, or G given
explicitly replace those of the preset. The system has the particles body_<i> in two dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
preset
|
str
|
|
'figure_eight'
|
masses
|
Sequence[float] | None
|
The masses of the bodies, or |
None
|
positions
|
Sequence[Sequence[float]] | None
|
The initial positions of the bodies, or |
None
|
velocities
|
Sequence[Sequence[float]] | None
|
The initial velocities of the bodies, or |
None
|
G
|
float | None
|
The gravitational constant, or |
None
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The preset is unknown. |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import NBodySystem
>>> len(NBodySystem('inner_solar_system').prepare().system_.interactions)
10
Source code in src/skcomplex/systems/physics/celestial_mechanics/_orbits.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
RelativisticOrbitSystem(u=1.5, du=0.0, *, alpha=1.0, epsilon=0.05, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Einstein's orbit equation u'' + u = alpha + epsilon u² of a planet.
The perihelion of the planet precesses.
The inverse radius u = 1 / r of the planet is a function of its polar angle, which the simulation time stands for,
so the orbit in the plane is (cos t / u, sin t / u). For epsilon = 0 the orbit is a closed Newtonian ellipse of
eccentricity |u(0) / alpha - 1| for u'(0) = 0. The term epsilon u² is the first relativistic correction, and
with it the orbit is a rosette whose perihelion advances by about 2π epsilon alpha every revolution. The equation
has two fixed points, the roots (1 ∓ sqrt(1 - 4 alpha epsilon)) / (2 epsilon) of epsilon u² - u + alpha. The
smaller one, close to alpha, is a centre, the stable circular orbit, and the larger one is a saddle, the unstable
circular orbit close to the black hole, beyond which a planet falls in. The system has the inverse radius planet.u
along the angle and its derivative planet.u'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
float
|
The initial inverse radius. |
1.5
|
du
|
float
|
The initial derivative of the inverse radius along the angle. |
0.0
|
alpha
|
float
|
The Newtonian inverse semi-latus rectum. |
1.0
|
epsilon
|
float
|
The strength of the relativistic correction. |
0.05
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import RelativisticOrbitSystem
>>> trajectory = RelativisticOrbitSystem(u=1.5).prepare().simulate(until=1.0)
>>> float(trajectory.get_values('planet.u')[0])
1.5
Source code in src/skcomplex/systems/physics/celestial_mechanics/_spin_orbit.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
RestrictedThreeBodySystem(x=0.5, y=0.0, vx=0.0, vy=1.15, *, mu=0.01215, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A light body moving in the plane of two primaries on circular orbits.
The body moves in the frame that rotates with the primaries.
The primaries of masses 1 - μ and μ sit at (-μ, 0) and (1 - μ, 0), and the light body moves under the
Hamiltonian H = (px² + py²) / 2 + y px - x py - (1 - μ) / r1 - μ / r2 of the rotating frame, with the momenta
px = x' - y and py = y' + x. Its terms y px - x py couple the coordinates and the momenta, so the Hamiltonian
is not separable. It equals minus half the Jacobi constant x² + y² + 2 (1 - μ) / r1 + 2 μ / r2 - x'² - y'², which
is conserved. The default μ is that of the Earth and the Moon.
The default start has the Jacobi constant 2.835, below that of the neck towards the Moon, and its orbit is chaotic:
it passes near the Moon after 3.5 time units and wanders between the two primaries, with a Lyapunov exponent near
0.2. Starts of a larger constant are confined around the Earth, such as vy = 0.8 with the constant 3.52, which
traces a regular precessing rosette. The system has the coordinates body.x and body.y and the momenta body.px
and body.py.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The initial first coordinate. |
0.5
|
y
|
float
|
The initial second coordinate. |
0.0
|
vx
|
float
|
The initial first velocity. |
0.0
|
vy
|
float
|
The initial second velocity. |
1.15
|
mu
|
float
|
The mass of the lighter primary, as a fraction of the total. |
0.01215
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import RestrictedThreeBodySystem
>>> RestrictedThreeBodySystem(mu=0.1).prepare().system_.elements[0].mu
0.1
Source code in src/skcomplex/systems/physics/celestial_mechanics/_orbits.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |
RotatingFrameBodyElement(label, *, x=0.5, y=0.0, px=0.0, py=0.5, mu=0.01215)
Bases: Element
Light body at (x, y) with canonical momenta (px, py) in a rotating frame.
The frame rotates with two primaries.
The momenta are px = x' - y and py = y' + x for the unit angular velocity of the frame. The primaries of masses
1 - mu and mu sit at (-mu, 0) and (1 - mu, 0).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the body. |
required |
x
|
float
|
The initial first coordinate. |
0.5
|
y
|
float
|
The initial second coordinate. |
0.0
|
px
|
float
|
The initial first momentum. |
0.0
|
py
|
float
|
The initial second momentum. |
0.5
|
mu
|
Annotated[float, open(0, oo)]
|
The mass of the lighter primary, as a fraction of the total. |
0.01215
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import RotatingFrameBodyElement
>>> RotatingFrameBodyElement('body', mu=0.1).mu
0.1
Source code in src/skcomplex/systems/physics/celestial_mechanics/_orbits.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
RotatingFrameMotionInteraction(label, *, target)
Bases: Interaction
Motion of a light body in the frame that rotates with two primaries.
The coordinates (x, y) and the momenta (px, py) of the target follow Hamilton's equations q' = dH/dp and
p' = -dH/dq of H = (px² + py²) / 2 + y px - x py - (1 - mu) / r1 - mu / r2, with the distances r1 and r2 to
the primaries at (-mu, 0) and (1 - mu, 0) and the mass fraction mu of the target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the light body. |
required |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import RotatingFrameMotionInteraction
>>> RotatingFrameMotionInteraction('motion', target='body').target
'body'
Source code in src/skcomplex/systems/physics/celestial_mechanics/_orbits.py
551 552 553 | |
SchwarzschildPrecessionSystem(semi_major_axis=100.0, eccentricity=0.5, *, mass=1.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A massive particle on a bound orbit around a static mass.
Its perihelion advances every turn.
The particle follows a timelike geodesic of the Schwarzschild spacetime SchwarzschildSpace, in units with G = c =
1 and with its proper time as the time of the system. It starts at the periapsis r₁ = a (1 - e) of an orbit whose
apoapsis is r₂ = a (1 + e), with the energy E and the angular momentum L for which both are turning points of
E² = (1 - 2M/r) (1 + L²/r²) + (dr/dτ)². Unlike a Kepler ellipse, the orbit does not close: the periapsis advances
by 6 π M / (a (1 - e²)) per turn when the orbit is far from the horizon, or 6 π G M / (c² a (1 - e²)) in other
units, which accounts for the anomalous 43 arcseconds per century of Mercury. The system has the position
particle.x = (t, r, theta, phi) and the four-velocity particle.x'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
semi_major_axis
|
float
|
The semi-major axis |
100.0
|
eccentricity
|
float
|
The eccentricity |
0.5
|
mass
|
float
|
The mass |
1.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The eccentricity is outside |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import SchwarzschildPrecessionSystem
>>> round(SchwarzschildPrecessionSystem().prepare().system_.elements[0].x[1], 6)
50.0
Source code in src/skcomplex/systems/physics/celestial_mechanics/_geodesics.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
SchwarzschildSpace(mass=1.0, *, curvature=False, label='space')
Bases: SpacetimeSpace
Spacetime outside a static, spherical mass M, the Schwarzschild metric.
The metric is in units with G = c = 1.
The line element in the coordinates (t, r, theta, phi) is
ds² = -(1 - 2M/r) dt² + dr² / (1 - 2M/r) + r² (dθ² + sin²θ dφ²), with the horizon at r = 2M. The mass enters
the metric as an exact rational, which keeps the symbolic derivation fast.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mass
|
float
|
The mass |
1.0
|
curvature
|
bool
|
Whether |
False
|
label
|
str
|
The label of the space in its system. |
'space'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The mass is not positive. |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import SchwarzschildSpace
>>> SchwarzschildSpace(mass=1.0, curvature=False).prepare().christoffel_[1][0][0]
(r - 2)/r^3
Source code in src/skcomplex/systems/physics/celestial_mechanics/_geodesics.py
118 119 120 | |
SitnikovBodyElement(label, *, z=0.5, e=0.0, values=None)
Bases: Element
Light body at the height z on the axis of two equal primaries.
The axis runs through the centre of mass of the primaries, which orbit with the eccentricity e. The vertical
velocity is z'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the body. |
required |
z
|
float
|
The initial height. |
0.5
|
e
|
Annotated[float, closed_open(0, oo)]
|
The eccentricity of the primaries' orbits. |
0.0
|
values
|
Mapping[str, object] | None
|
Further values by name, such as an initial velocity named with a prime, or |
None
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import SitnikovBodyElement
>>> SitnikovBodyElement('body', e=0.1).e
0.1
Source code in src/skcomplex/systems/physics/celestial_mechanics/_orbits.py
200 201 202 203 204 205 206 207 208 209 210 | |
SitnikovGravityInteraction(label, *, target)
Bases: Interaction
Pull of two equal primaries on a light body on their axis, z'' = -dV/dz.
The primaries of mass 1/2 sit at the distance r(t) = (1 - e cos t) / 2 from the axis, with the eccentricity e of
the target, so the body at the height z has the potential V = -1 / sqrt(z² + r(t)²).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the body. |
required |
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import SitnikovGravityInteraction
>>> SitnikovGravityInteraction('gravity', target='body').target
'body'
Source code in src/skcomplex/systems/physics/celestial_mechanics/_orbits.py
234 235 236 | |
SitnikovSystem(z=0.5, vz=0.0, *, e=0.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A light body moving on the axis through the mass centre of two equal primaries.
The axis is normal to their orbit.
The primaries of mass 1/2 orbit their centre of mass with unit mean separation and period 2π, at distance r(t) =
(1 - e cos t) / 2 from it to first order in the eccentricity e, and the light body follows z'' = -z / (z² +
r(t)²)^(3/2). For circular primaries the energy z'²/2 - 1 / √(z² + 1/4) is conserved and the motion is
integrable, and eccentric primaries make bounded orbits chaotic. The system has the height body.z and the vertical
velocity body.z'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
float
|
The initial height above the plane of the primaries. |
0.5
|
vz
|
float
|
The initial vertical velocity. |
0.0
|
e
|
float
|
The eccentricity of the primaries' orbits. |
0.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import SitnikovSystem
>>> SitnikovSystem(e=0.1).prepare().system_.elements[0].e
0.1
Source code in src/skcomplex/systems/physics/celestial_mechanics/_orbits.py
712 713 714 715 716 717 718 719 720 721 722 723 724 725 | |
StormerProblemSystem(x=1.0, y=0.0, z=0.0, *, vx=0.0, vy=0.1, vz=0.1, alpha=1.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A charged particle moving in the magnetic dipole field of a planet.
This is the Störmer problem.
The charge follows the Euler-Lagrange equations of |x'|² / 2 + alpha (x y' - y x') / r³, the kinetic energy and
the coupling of the velocity to the vector potential of the dipole, whose Lorentz force gives x'' = 3 alpha z (y' z
- z' y) / r⁵ - alpha y' / r³, y'' = -3 alpha z (x' z - z' x) / r⁵ + alpha x' / r³, and z'' = 3 alpha z (x' y -
y' x) / r⁵, with alpha = q M / m for a dipole of moment M along the z axis. The magnetic force does no work,
so the speed is conserved, and the symmetry about the axis conserves x y' - y x' + alpha (x² + y²) / r³. Bounded
orbits near the planet trace the radiation belts, and many of them are chaotic. The system has the coordinates
charge.x, charge.y, and charge.z, and the velocities charge.x', charge.y', and charge.z'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The initial first coordinate, in units of the planet's radius. |
1.0
|
y
|
float
|
The initial second coordinate. |
0.0
|
z
|
float
|
The initial third coordinate, along the dipole. |
0.0
|
vx
|
float
|
The initial first velocity. |
0.0
|
vy
|
float
|
The initial second velocity. |
0.1
|
vz
|
float
|
The initial third velocity. |
0.1
|
alpha
|
float
|
The product of the charge and the dipole moment, divided by the mass. |
1.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import StormerProblemSystem
>>> StormerProblemSystem(alpha=2.0).prepare().system_.elements[0].alpha
2.0
Source code in src/skcomplex/systems/physics/celestial_mechanics/_dipoles.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
TwoBodyOrbitSystem(eccentricity=0.0, *, G=1.0, mass=1000.0, radius=10.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A light planet orbiting a heavy star under Newtonian gravity.
The system is the Kepler problem of their separation.
The planet moves in the coordinate (x, y) relative to the star with the canonical momenta (px, py) per unit
mass, under the Hamiltonian H = (px² + py²) / 2 - G M / sqrt(x² + y²), which is separable. The energy and the
angular momentum x py - y px are conserved, and a bound orbit is an ellipse with the star at a focus. The system
has the coordinates planet.x and planet.y and the momenta planet.px and planet.py.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eccentricity
|
float
|
The eccentricity of the orbit, between 0 for a circle and 1 for an escape. |
0.0
|
G
|
float
|
The gravitational constant. |
1.0
|
mass
|
float
|
The mass of the star. |
1000.0
|
radius
|
float
|
The distance of the planet from the star at its closest approach. |
10.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.physics.celestial_mechanics import TwoBodyOrbitSystem
>>> [element.label for element in TwoBodyOrbitSystem().prepare().system_.elements]
['planet']
Source code in src/skcomplex/systems/physics/celestial_mechanics/_orbits.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |