RiptideRiptide
Download Riptide SDKInstall Riptorch
Menu
Raya docs · Geometry, physics and speed

Relativity

Special relativity as red geometry with exact velocity composition, and light and orbits around a black hole traced with only + − × ÷.

import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
17 classes114 functions and methods104 of 220 documented74 runnable examples

Overview

Einstein through rational geometry: special relativity as red geometry, and light and orbits around a black hole traced with only {+}\ {-}\ \times\ \div.

Analog horizons and wormholes: the flume's Froude quadrance and Unruh's wave equation stepped by the energy-exact Cayley map, the bathtub vortex from the quadrance and its superradiance, the Einstein–Rosen bridge in its rational chart, the Kruskal boost as a red rotation and a rational Penrose compactification.

Functions and constants

Functions

bumpfunction
T bump<T>(KeplerArith<T> f, T x, T w)

The rational bump (1 - (\frac{x}{w})^{2})^{2} inside |x| < w, else 0.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print([for (final x in [0, 1, 2, 3]) bump(q, r(x), r(2))]);
}
Output
[1, 9/16, 0, 0]
T bernoulliDepth<T>(KeplerArith<T> f, {required T q2, required T e0, required T b, required T start, int iterations = 40})

The same cubic by Newton's iteration ({+}\ {-}\ \times\ \div only), from a start on the wanted branch: above the critical depth for subcritical, below it for supercritical.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(bernoulliDepth(q, q2: r(1, 4), e0: r(9, 8), b: r(1, 10), start: r(1), iterations: 6).toDouble());
}
Output
0.8533421838195763
(double, double) vortexVelocityRational(double a, double b, double x, double y)

The draining-bathtub vortex, rational: v = (-Ax − By, -Ay + Bx)/(x^{2} + y^{2}).

(double, double) vortexVelocityClassic(double a, double b, double x, double y)

The same flow, classic: polar r = \sqrt{x^{2} + y^{2}}, \theta = \operatorname{atan2}(y, x), v_{r} = -\frac{A}{r}, v_{\theta} = \frac{B}{r} (Transcendental, Root).

classicDrivefunction
double classicDrive(double omega, double t)

The classic wave maker's drive, \sin \omega t (Transcendental). The rational one turns a phasor by the Cayley rotor \frac{((1 - \tau^{2}), 2\tau)}{1 + \tau^{2}} every step.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(classicDrive(1, 0.5)));
}
Output
0.479426
double classicFroude(double q, double h)

The classic horizon test: F = v/√(gh) against 1 (Root).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(classicFroude(0.5, 1)));
}
Output
0.500000
solveDensefunction
List<T> solveDense<T>(KeplerArith<T> f, List<List<T>> m, List<T> b)

Solves M x = b by Gaussian elimination with pivoting on the largest |entry| ({+}\ {-}\ \times\ \div only; exact over \mathbb{Q}).

(double, double) classicAzimuth(int m, double theta)

The classic way's angular factor e^{im\theta} at angle \theta: (\cos m\theta, \sin m\theta) (Transcendental).

classicBoostfunction
(double, double) classicBoost((double, double) event, double v)

A Lorentz boost from the velocity: \gamma = \frac{1}{\sqrt{1 - v^{2}}} (Root), or from the rapidity: \cosh \eta, \sinh \eta (Transcendental).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final (t, x) = classicBoost((5, 3), 0.6);
  print('${f6(t)}, ${f6(x)}');
}
Output
8.500000, 7.500000
redQuadrancefunction
T redQuadrance<T>(KeplerArith<T> f, (T, T) event)

The red quadrance (squared interval) of an event, t^{2} - x^{2}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  // The interval t² − x², exactly: positive timelike, zero on the light cone.
  for (final e in [(r(5), r(3)), (r(1), r(1)), (r(1), r(2))]) print('(${e.$1}, ${e.$2}): ${redQuadrance(q, e)}');
}
Output
(5, 3): 16
(1, 1): 0
(1, 2): -3
T addVelocities<T>(KeplerArith<T> f, T v, T w)

Einstein's velocity addition, \frac{v + w}{1 + vw} (also rational).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print('1/2 ⊕ 1/2 = ${addVelocities(q, r(1, 2), r(1, 2))}');
  var v = r(0);
  for (var i = 0; i < 5; i++) v = addVelocities(q, v, r(9, 10));
  print('five boosts of 9/10: $v, still below 1: ${v < r(1)}');
}
Output
1/2 ⊕ 1/2 = 4/5
five boosts of 9/10: 1238049/1238050, still below 1: true
T compactRational<T>(KeplerArith<T> f, T x)

The Penrose diagram's compactification, rational: \frac{x}{1 + |x|}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print([for (final x in [-10, -1, 0, 1, 100]) compactRational(q, r(x))]);
}
Output
[-10/11, -1/2, 0, 1/2, 100/101]
double compactClassic(double x)

The classic compactification (\frac{2}{\pi}) \cdot \operatorname{atan} x.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(compactClassic(1)));
}
Output
0.500000
kruskalRedfunction
(T, T) kruskalRed<T>(KeplerArith<T> f, T rho, T tau)

Kruskal coordinates (X, T) from a red radius \rho and the half-rapidity \tau = \tanh(\frac{t}{8M}): \frac{\rho((1 + \tau^{2}), 2\tau)}{1 - \tau^{2}}. X^{2} - T^{2} = \rho^{2} exactly.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(kruskalRed(q, r(1, 2), r(1, 3)));
}
Output
(5/8, 3/8)
(double, double) kruskalClassic(double m, double t, double r)

Classic Kruskal (X, T) outside the horizon (r > 2M): \sqrt{\frac{r}{2M} - 1} e^{r/4M}(cosh, sinh)(\frac{t}{4M}).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final (x, t) = kruskalClassic(1, 0.5, 3);
  print('${f6(x)}, ${f6(t)}');
}
Output
1.508655, 0.187606
kruskalRhofunction
double kruskalRho(double m, double r)

The classic red radius \rho(r) = \sqrt{\frac{r}{2M} - 1} e^{r/4M}, and r from UV on the singularity side by Newton ((1 - \frac{r}{2M})e^{r/2M} = UV).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(kruskalRho(1, 3)));
}
Output
1.496945
(RayEnd, T?) rightMovingRay<T>(KeplerArith<T> f, T u0, T v0, {T? alpha})

The fate of a right-moving ray (constant U, V increasing) starting at (u0, v0), and the V where it ends (the singularity at UV = 1) or null if it reaches the right exterior's infinity.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(rightMovingRay(q, r(-1, 2), r(1, 4)));
}
Output
(RayEnd.rightExterior, null)
T uncompactRational<T>(KeplerArith<T> f, T p)

The inverse of compactRational: x = \frac{P}{1 - |P|}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(uncompactRational(q, compactRational(q, r(7, 3))));
}
Output
7/3
double uncompactClassic(double p)

The inverse of compactClassic: \tan(\frac{\pi P}{2}).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(uncompactClassic(0.5)));
}
Output
1.000000
(double, double) classicCircle(double phi)

A round direction drawn the classic way: (\cos \varphi, \sin \varphi).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(classicCircle(0));
}
Output
(1.0, 0.0)
double classicTimeSlope(double m, double t)

Constant Schwarzschild time t outside the horizon, classic: the Kruskal ray \frac{V}{U} = -e^{t/2M}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(classicTimeSlope(1, 0)));
}
Output
-1.000000
T rationalTimeSlope<T>(KeplerArith<T> f, T tau)

The same ray, rational: with \tau = \tanh(\frac{t}{8M}), e^{t/4M} = \frac{1 + \tau}{1 - \tau}, so \frac{V}{U} = -(\frac{1 + \tau}{1 - \tau})^{2}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(rationalTimeSlope(q, r(1, 3)));
}
Output
-4
double classicKruskalProduct(double m, double r)

Kruskal's UV on a sphere of radius r, classic: (1 - \frac{r}{2M}) e^{r/2M} (outside: negative).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(classicKruskalProduct(1, 2)));
}
Output
0.000000

Classes

class

Flume

final class Flume<T>

A flume: depth h(x) = h_{0}(1 - d \cdot \operatorname{bump}(\frac{x}{w})), flow per width q = F_{0} \cdot \sqrt{g h_{0}^{3}} set so that the upstream Froude number is froude0 (units g = h_{0} = 1, so q = F_{0} and c_{0} = 1). Everything the lab draws follows rationally: v = \frac{q}{h}, c^{2} = h, F^{2} = \frac{q^{2}}{h^{3}}, and the obstacle that makes this depth, by Bernoulli backwards, b(x) = E_{0} - h - \frac{q^{2}}{2h^{2}}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final fl = Flume(q, froude0: r(1, 2), dip: r(1, 2), halfWidth: r(4));
  print('depth at 0 ${fl.depth(r(0))}, F² ${fl.froude2(r(0))}, supercritical ${fl.supercritical(r(0))}');
}
Output
depth at 0 1/2, F² 2, supercritical true

Constructors

Flumeconstructor
Flume(this.f, {required this.froude0, required this.dip, required this.halfWidth})
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(Flume(q, froude0: r(1, 4), dip: r(1, 4), halfWidth: r(2)).depth(r(1)));
}
Output
55/64

Properties

ffield
final KeplerArith<T> f
froude0field
final T froude0
dipfield
final T dip
final T halfWidth

Methods

depthmethod
T depth(T x)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(Flume(q, froude0: r(1, 2), dip: r(1, 2), halfWidth: r(4)).depth(r(2)));
}
Output
23/32
velocitymethod
T velocity(T x)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(Flume(q, froude0: r(1, 2), dip: r(1, 2), halfWidth: r(4)).velocity(r(0)));
}
Output
1
T waveSpeed2(T x)

c^{2} = g h.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(Flume(q, froude0: r(1, 2), dip: r(1, 2), halfWidth: r(4)).waveSpeed2(r(0)));
}
Output
1/2
froude2method
T froude2(T x)

F^{2} = \frac{q^{2}}{g h^{3}}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(Flume(q, froude0: r(1, 2), dip: r(1, 2), halfWidth: r(4)).froude2(r(0)));
}
Output
2
bool supercritical(T x)

Supercritical (F^{2} > 1): inside the analog black hole.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final fl = Flume(q, froude0: r(1, 2), dip: r(1, 2), halfWidth: r(4));
  print([for (final x in [-3, 0, 3]) fl.supercritical(r(x))]);
}
Output
[false, true, false]
bottommethod
T bottom(T x)

The bottom that makes this depth: E_{0} - h - \frac{q^{2}}{2h^{2}}, with E_{0} = 1 + \frac{q^{2}}{2} upstream.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(Flume(q, froude0: r(1, 2), dip: r(1, 2), halfWidth: r(4)).bottom(r(0)));
}
Output
1/8
horizonsmethod
(T, T)? horizons({int iterations = 50})

The horizons: where F^{2} crosses 1 in (-w, 0) (black: the flow enters supercritical) and (0, w) (white), by bisection on the sign of F^{2} - 1 (rational); null if the flow stays subcritical.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(Flume(q, froude0: r(1, 2), dip: r(1, 2), halfWidth: r(4)).horizons(iterations: 20));
}
Output
(-783901/524288, 783901/524288)
T redQuadrance(T x, T dt, T dx)

The red quadrance of a displacement (dt, dx) in the acoustic metric at x: (dx - v dt)² − c² dt². Negative inside the sound cone, zero on it.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(Flume(q, froude0: r(1, 2), dip: r(1, 2), halfWidth: r(4)).redQuadrance(r(0), r(1), r(1)));
}
Output
-1/2
final class ClassicFlume

The classic flume: c = √(gh), F = \frac{v}{c}, and the depth solved forward from an obstacle by Viète's trigonometric root of Bernoulli's cubic h^{3} + (b - E_{0})h^{2} + \frac{q^{2}}{2} = 0 (Transcendental, Root).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(const ClassicFlume(q: 0.5, e0: 1.125).depths(0.1));
}
Output
(0.853342183819576, 0.4780653893015603)

Constructors

ClassicFlumeconstructor
const ClassicFlume({required this.q, required this.e0})
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(const ClassicFlume(q: 0.5, e0: 1.125).froude(1)));
}
Output
0.500000

Properties

qfield
final double q
e0field
final double e0

Methods

waveSpeedmethod
double waveSpeed(double h)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(const ClassicFlume(q: 0.5, e0: 1.125).waveSpeed(0.81)));
}
Output
0.900000
froudemethod
double froude(double h)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(const ClassicFlume(q: 0.5, e0: 1.125).froude(0.5)));
}
Output
1.414214
depthsmethod
(double, double)? depths(double b)

The two positive roots (subcritical, supercritical) of h^{3} + (b - E_{0})h^{2} + \frac{q^{2}}{2} = 0, or null if the bump is too high for the flow (no steady solution).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(const ClassicFlume(q: 0.5, e0: 1.125).depths(0.2));
}
Output
null
final class UnruhWave1D<T>

Unruh's wave equation on a 1-D flow: \varphi at nodes, the momentum p = \dot{\varphi} + v \partial\varphi, Dirichlet ends. v at nodes, c2 at the n + 1 faces (face k between nodes k - 1 and k; faces 0 and n touch the walls).

\dot{\varphi}_{i} = p_{i} - v_{i} \frac{\varphi_{i + 1} - \varphi_{i - 1}}{2dx} \dot{p}_{i} = -\frac{v_{i + 1}p_{i + 1} - v_{i - 1}p_{i - 1}}{2dx} + \frac{c^{2}_{i + 1}(\varphi_{i + 1} - \varphi_{i}) - c^{2}_{i}(\varphi_{i} - \varphi_{i - 1})}{dx^{2}}

Constructors

UnruhWave1Dconstructor
UnruhWave1D(this.f, {required List<T> v, required List<T> c2, required this.dx})

Properties

ffield
final KeplerArith<T> f
nfield
final int n
vfield
final List<T> v
c2field
final List<T> c2
dxfield
final T dx
phifield
List<T> phi
pfield
List<T> p
stepsfield
int steps
energygetter
T get energy

The discrete energy H (indefinite where the flow is supercritical).

Methods

ratemethod
(List<T>, List<T>) rate(List<T> ph, List<T> pp)

(\dot{\varphi}, \dot{p}) of a state.

T energyDensity(int i)

The energy at node i: \tfrac{1}{2}p^{2} - p v (K\varphi) + \tfrac{1}{2}c^{2}(\partial\varphi)^{2} of the face to its right (the faces 1 \cdots n - 1 are shared this way).

stepRk4method
void stepRk4(T dt)

Classic: one RK4 step.

void stepCayley(T dt)

Rational: one Cayley (implicit-midpoint) step, (I - (\frac{dt}{2})A)z' = (I + (\frac{dt}{2})A)z, solved by block Thomas with 2 \times 2 blocks (unknowns (\varphi_{i}, p_{i})). Exact over \mathbb{Q}; conserves energy exactly.

absorbmethod
void absorb(int width, T k)

A damping sponge in the outer width nodes: multiplies \varphi and p by 1 - k \cdot d^{2} (d the depth into the layer, 0…1);

  • {-}\ \times\ \div, but it removes energy on purpose (waves leave the flume).
final class VortexScattering

Superradiant scattering off the draining-bathtub vortex (c = 1): the radial equation of Berti, Cardoso & Lemos,

\frac{d^{2}H}{dr}² + [(\omega − mB/r^{2})² − (1 − A²/r²)((m² − ¼)/r² + 5A²/(4r⁴))] H = 0, dr/dr = 1 - \frac{A^{2}}{r^{2}},

With an ingoing wave at the horizon (H ~ e^{-i\varpi r}, \varpi = \omega − mB/A^{2}) and I e^{-i\omega r} + R e^{i\omega r*} far away. Superradiant (|\frac{R}{I}|^{2} > 1) for 0 < \omega < mB/A^{2}.

Constructors

VortexScatteringconstructor
const VortexScattering({required this.a, required this.b, required this.m})

Properties

afield
final double a
bfield
final double b
mfield
final int m
thresholdgetter
double get threshold

m\Omega_{H} = mB/A^{2} (rational).

Methods

double reflectionRational(double w, {double delta = 1e-5, double rMax = 160, double step = 0.01})

Rational: integrate (r, H, G) in r* without ever computing r* (dr/dr* = 1 - \frac{A^{2}}{r^{2}}): start H = 1, G = -i\varpi at r = A(1 + \delta), stop at rMax; split by derivatives only: |\frac{R}{I}|^{2} = |H + \frac{G}{i\omega}|^{2} / |H - \frac{G}{i\omega}|^{2}.

tortoisemethod
double tortoise(double r)

The tortoise coordinate r* = r + (\frac{A}{2}) \ln(\frac{r - A}{r + A}) (Transcendental).

radiusOfmethod
double radiusOf(double rs, double guess)

r from r* by Newton's iteration on tortoise.

double reflectionClassic(double w, {double delta = 1e-5, double rMax = 160, double step = 0.01})

Classic: RK4 in r* with r recovered from the logarithmic tortoise relation, the horizon wave e^{-i\varpi r} and the far split by e^{\pm i\omega r} (cos, sin).

final class VortexWave2D

Unruh's equation on a 2-D flow (the bathtub vortex), on an n \times n grid over [-L, L]^{2}, c = 1:

\dot{\varphi} = p - v \cdot \nabla\varphi, \dot{p} = -\nabla \cdot (v p) + \nabla^{2}\varphi

Stepped by RK4 ({+}\ {-}\ \times\ \div only). The flow comes in as arrays (vx, vy); the drain's core (inside the horizon, where nothing comes back out) and a band along the edges are sponges; a line source near the right edge sends in waves with the drive the caller gives each step.

Constructors

VortexWave2Dconstructor
VortexWave2D({required this.n, required this.halfSize, required this.a, required this.b, required bool rational})

Static

bandconstant
static const int band = 10

Properties

nfield
final int n
final double halfSize
hfield
final double h
afield
final double a
bfield
final double b
phifield
final Float64List phi
pfield
final Float64List p
vxfield
final Float64List vx
vyfield
final Float64List vy
dampfield
final Float64List damp
dtfield
late final double dt
timefield
double time
double get horizonQuadrance

The horizon (Q = A^{2}) and the ergoregion (Q = A^{2} + B^{2}) as quadrances.

double get ergoQuadrance
closedfield
bool closed

A closed tank: no sponges, no drain absorption and no wave maker, so the waves keep their energy (the Cayley step keeps energy to rounding; RK4 lets it drift).

int lastIterations

BiCGSTAB iterations the last stepCayley took.

energygetter
double get energy

The discrete energy H = \sum \tfrac{1}{2}p^{2} - p v \cdot G\varphi + \tfrac{1}{2} \sum_{\mathrm{edges}} (\frac{\Delta\varphi}{h})^{2} (per cell area; the boundary ring is held at 0). The scheme is Hamiltonian in exactly this H, so implicit midpoint keeps it; it is indefinite in the ergoregion.

Methods

xOfmethod
double xOf(int i)
stepmethod
void step(double drive)

One RK4 step (the classic way); then the source and the sponges (_after).

void stepCayley(double drive, {double tolerance = 1e-15, int maxIterations = 80})

One Cayley (Crank–Nicolson, implicit-midpoint) step, the rational way: (I - (\frac{dt}{2})A) z' = (I + (\frac{dt}{2})A) z, only {+}\ {-}\ \times\ \div. The matrix is near the identity (its spectrum is 1 - (\frac{dt}{2})\lambda with \lambda on the imaginary axis), so BiCGSTAB solves it to rounding in a few iterations; the step then keeps energy exactly up to rounding (VortexWave2DExact is the same step solved by elimination, exact over \mathbb{Q}). Then the source and sponges.

bumpmethod
void bump(double x0, double y0, double w, double height)

Puts a still polynomial bump (1 - \frac{d^{2}}{w^{2}})^{2} of height at (x0, y0) (radius w).

final class VortexWave2DExact<T>

The same 2-D scheme over any KeplerArith (\mathbb{Q} for the proof), on an n \times n grid whose boundary ring is held at 0, with the flow given node by node. stepCayley solves (I - (\frac{dt}{2})A) z' = (I + (\frac{dt}{2})A) z by Gaussian elimination over T: over \mathbb{Q} the energy is kept EXACTLY. Small grids only (dense).

Constructors

VortexWave2DExact(this.f, {required this.n, required this.h, required this.dt, required this.vx, required this.vy})

Properties

ffield
final KeplerArith<T> f
nfield
final int n
hfield
final T h
dtfield
final T dt
vxfield
final List<T> vx
vyfield
final List<T> vy
phifield
List<T> phi
pfield
List<T> p
energygetter
T get energy

Methods

ratemethod
(List<T>, List<T>) rate(List<T> ph, List<T> pp)
void stepCayley()
class

Cz

final class Cz<T>

a + bi over T (this package's own, so it needs nothing beyond {+}\ {-}\ \times\ \div).

Constructors

Czconstructor
const Cz(this.re, this.im)

Properties

refield
final T re
imfield
final T im
final class VortexBomb<T>

The black-hole bomb (Weinfurtner 44:10–50:35): one azimuthal mode e^{im\theta} of waves on the draining bathtub vortex (c = 1, v_{r} = -\frac{A}{r}, \Omega = \frac{B}{r^{2}}), between the drain and a MIRROR at r = R. Co-rotating waves come back from the vortex amplified (\omega < m\Omega_{H}); the mirror sends them back in, again and again: the amplitude grows exponentially. Here the hole pays for it: backReaction lowers the circulation as the mode grows, B = \frac{B_{0}}{1 + \beta \cdot S} with S = \sum r|\psi|^{2} (a model of the spin-down, not computed from the fluid), until m\Omega_{H} falls to the mode's frequency and the bomb is quenched, as the superfluid experiment saw.

The radial scheme is Hamiltonian in the discrete energy

H = \sum_{j} r_{j} [\tfrac{1}{2}|\pi_{j}|^{2} - \operatorname{Re}(\bar{\pi}_{j} X_{j}) + \tfrac{1}{2} \frac{m^{2}|\psi_{j}|^{2}}{r_{j}^{2}}] + \sum_{\mathrm{faces}} \tfrac{1}{2} r_{f} \frac{|\psi_{j + 1} - \psi_{j}|^{2}}{\Delta r^{2}}, X_{j} = v_{j} \frac{\psi_{j + 1} - \psi_{j - 1}}{2\Delta r} + i m \Omega_{j} \psi_{j},

So the Cayley (Crank–Nicolson) step, solved by a 2 \times 2 complex block Thomas algorithm, keeps H exactly over \mathbb{Q}(i) in a closed tank (no drain absorption, no back-reaction). H is indefinite inside the ergoregion: negative energy falling into the drain is what feeds the growth. The classic way steps the same equations by RK4.

Constructors

VortexBombconstructor
VortexBomb(this.f, {required this.n, required this.r0, required this.mirror, required this.a, required this.b0, required this.m, required this.dt})

Properties

ffield
final KeplerArith<T> f
nfield
final int n
mfield
final int m
r0field
final T r0
mirrorfield
final T mirror
afield
final T a
b0field
final T b0
dtfield
final T dt
drfield
final T dr
bfield
T b

The circulation now (B_{0} until the back-reaction lowers it).

T? backReaction

\beta of the spin-down model (0: off).

drainfield
bool drain

Absorb inside the horizon (the drain). Off: a closed tank, energy kept.

bool mirrorOn

The mirror at r = R reflects (true); false: the outer fifth absorbs instead, so waves leave and nothing builds.

psifield
List<Cz<T>> psi
pifield
List<Cz<T>> pi
stepsfield
int steps
energygetter
T get energy

The discrete energy H (above).

sizegetter
T get size

\sum r_{j} |\psi_{j}|^{2}: the mode's size.

Methods

rmethod
T r(int j)
rFacemethod
T rFace(int j)
blocksmethod
(List<Cz<T>>, List<Cz<T>>, List<Cz<T>>) blocks(int j)

The 2 \times 2 complex blocks of A for row j: (lower = column j - 1, diagonal, upper = column j + 1), each [\psi\psi, \psi\pi, \pi\psi, \pi\pi].

ratemethod
(List<Cz<T>>, List<Cz<T>>) rate(List<Cz<T>> ps, List<Cz<T>> pp)

(\dot{\psi}, \dot{\pi}).

void stepCayley()

One Cayley step (rational): (I - (\frac{dt}{2})A) z' = (I + (\frac{dt}{2})A) z by block Thomas over \mathbb{Q}(i).

stepRk4method
void stepRk4()

One RK4 step (classic).

seedmethod
void seed(T at, T w, T height)

A small co-rotating bump at at (a polynomial (1 - \frac{d^{2}}{w^{2}})^{2}, real).

final class ClassicSchwarzschildOrbit

The Binet equation u'' + u = K + 3Mu^{2} by RK4 in the angle \varphi, positions from \cos \varphi and \sin \varphi (Transcendental).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final o = ClassicSchwarzschildOrbit.light(m: 1, b: 6, dphi: 0.01);
  for (var i = 0; i < 100; i++) o.step();
  print('u after 100 steps ${f6(o.u)}');
}
Output
u after 100 steps 0.146252

Constructors

ClassicSchwarzschildOrbit({required this.m, required this.u, required this.v, required this.k, required this.dphi})
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final o = ClassicSchwarzschildOrbit(m: 1, u: 0.1, v: 0, k: 1 / 12, dphi: 0.01);
  o.step();
  print(f6(o.u));
}
Output
0.100001
factory ClassicSchwarzschildOrbit.light({required double m, required double b, required double dphi})

Light from infinity with impact parameter b.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(ClassicSchwarzschildOrbit.light(m: 1, b: 6, dphi: 0.01).v));
}
Output
0.166667

Properties

mfield
final double m
kfield
final double k
dphifield
final double dphi
ufield
double u
vfield
double v
phifield
double phi
stepsfield
int steps
positiongetter
(double, double) get position
double get firstIntegral

Methods

stepmethod
void step()
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final o = ClassicSchwarzschildOrbit.light(m: 1, b: 6, dphi: 0.01)..step();
  print(f6(o.u));
}
Output
0.001667
final class RedBoost<T>

A Lorentz boost with rational half-rapidity parameter t (|t| < 1), over T.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final b = RedBoost(q, r(1, 3));
  print('t = 1/3: v = ${b.velocity}, γ = ${b.gamma}, γv = ${b.gammaVelocity}');
}
Output
t = 1/3: v = 3/5, γ = 5/4, γv = 3/4

Constructors

RedBoostconstructor
RedBoost(this.f, this.t)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(RedBoost(q, r(1, 2)).velocity);
}
Output
4/5

Properties

ffield
final KeplerArith<T> f
tfield
final T t
gammagetter
T get gamma

\gamma = \frac{1 + t^{2}}{1 - t^{2}}.

velocitygetter
T get velocity

The velocity, v = \frac{2t}{1 + t^{2}} (a fraction of c).

T get gammaVelocity

\gamma v = \frac{2t}{1 - t^{2}}.

Methods

applymethod
(T, T) apply((T, T) event)

The boosted event: (t', x') = (\gamma t + \gamma v x, \gamma v t + \gamma x).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final b = RedBoost(q, r(1, 2));
  final e = (r(5), r(3)), m = b.apply(e);
  print('(5, 3) → (${m.$1}, ${m.$2}); interval ${redQuadrance(q, e)} → ${redQuadrance(q, m)}');
}
Output
(5, 3) → (37/3, 35/3); interval 16 → 16
thenmethod
RedBoost<T> then(RedBoost<T> o)

This boost followed by o: the half-parameters compose as \frac{t_{1} + t_{2}}{1 + t_{1}t_{2}}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final a = RedBoost(q, r(1, 3)), b = RedBoost(q, r(1, 5));
  print('${a.then(b).velocity} = ${addVelocities(q, a.velocity, b.velocity)}');
}
Output
4/5 = 4/5
enum RayFate

What happened to a traced ray.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(RayFate.values);
}
Output
[RayFate.captured, RayFate.escaped, RayFate.stillGoing]

Values

captured
escapedvalue
escaped
stillGoing
final class RationalSchwarzschildOrbit<T>

A light ray (or orbit) around a Schwarzschild black hole of mass m, traced rationally over T.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  // Light from infinity with impact parameter 6 passing a mass-1 hole: the rational recipe run in doubles.
  const d = F64Arith();
  final o = RationalSchwarzschildOrbit.light(d, m: 1.0, b: 6.0, tau: 0.01);
  print('fate ${o.trace(maxSteps: 5000)}');
}
Output
fate RayFate.escaped

Constructors

RationalSchwarzschildOrbit(this.f, {required this.m, required T u0, required T v0, required this.k, required this.tau})

Starts at u = u0 (\frac{1}{r}), u' = v0, direction (1, 0), with the constant term k (0 for light) and angle parameter tau (each step turns by 2 \cdot \operatorname{atan} \tau).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final o = RationalSchwarzschildOrbit(q, m: r(1), u0: r(1, 10), v0: r(0), k: r(1, 12), tau: r(1, 10));
  for (var i = 0; i < 3; i++) o.step();
  print('direction ${o.direction}');
}
Output
direction (851499/1030301, 580060/1030301)
factory RationalSchwarzschildOrbit.light(KeplerArith<T> f, {required T m, required T b, required T tau})

Light coming in from infinity with impact parameter b (u = 0, u' = \frac{1}{b}).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  // Exact: three steps of a light ray, every quantity a fraction.
  final o = RationalSchwarzschildOrbit.light(q, m: r(1), b: r(5), tau: r(1, 20));
  for (var i = 0; i < 3; i++) o.step();
  print('direction ${o.direction}');
  print('first integral ≈ ${o.firstIntegral.toDouble()} (the true motion keeps 1/b² = 0.04; the step tracks it closely)');
}
Output
direction (61605999/64481201, 19040120/64481201)
first integral ≈ 0.040021241927510505 (the true motion keeps 1/b² = 0.04; the step tracks it closely)

Properties

ffield
final KeplerArith<T> f
mfield
final T m
kfield
final T k
taufield
final T tau
stepsfield
int steps
ugetter
T get u

u = \frac{1}{r}.

vgetter
T get v

u' = \frac{du}{d\varphi}.

directiongetter
(T, T) get direction

The direction from the hole, (\cos \varphi, \sin \varphi) as a rational unit vector.

positiongetter
(T, T) get position

The position r·(direction) = direction / u.

T get firstIntegral

The first integral (u')^{2} + u^{2} - 2Ku - 2Mu^{3} (\frac{1}{b^{2}} for light): conserved by the true motion.

Methods

stepmethod
void step()
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final o = RationalSchwarzschildOrbit.light(q, m: r(1), b: r(10), tau: r(1, 10));
  o.step();
  print('position after one step ${o.position}');
}
Output
position after one step (99/2, 10)
tracemethod
RayFate trace({int maxSteps = 1000000})

Traces until the ray falls through the horizon (u \ge \frac{1}{2M}), escapes (u \le 0 again after moving in), or maxSteps run out.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  // Below the critical impact parameter 3√3 ≈ 5.196 the light is captured.
  const d = F64Arith();
  for (final b in [5.0, 5.4]) print('b = $b: ${RationalSchwarzschildOrbit.light(d, m: 1.0, b: b, tau: 0.01).trace(maxSteps: 20000)}');
}
Output
b = 5.0: RayFate.captured
b = 5.4: RayFate.escaped
final class EinsteinRosen<T>

The Einstein–Rosen bridge of mass m, rational.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final w = EinsteinRosen(q, r(1));
  print('r(u) at u = 0, 1, 2: ${[for (final u in [0, 1, 2]) w.radius(r(u))]} (the throat is r = 2M)');
}
Output
r(u) at u = 0, 1, 2: [2, 3, 6] (the throat is r = 2M)

Constructors

EinsteinRosenconstructor
const EinsteinRosen(this.f, this.m)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(EinsteinRosen(q, r(3, 2)).radius(r(0)));
}
Output
3

Properties

ffield
final KeplerArith<T> f
mfield
final T m

Methods

radiusmethod
T radius(T u)

r = 2M + u^{2}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(EinsteinRosen(q, r(1)).radius(r(1, 2)));
}
Output
9/4
T radialMetric(T u)

g_{uu} = 4(2M + u^{2}).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(EinsteinRosen(q, r(1)).radialMetric(r(1)));
}
Output
12
T embeddingHeight2(T u)

Flamm's height squared, z^{2} = 8M u^{2}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print('z² = ${EinsteinRosen(q, r(1)).embeddingHeight2(r(3))}');
}
Output
z² = 72
T throatRadius(T p)

The throat's radius at the half-tangent clock p: \frac{2M}{1 + p^{2}}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print([for (final p in [0, 1, 3]) EinsteinRosen(q, r(1)).throatRadius(r(p))]);
}
Output
[2, 1, 1/5]
circlemethod
(T, T) circle(T s)

The rational circle point \frac{((1 - s^{2}), 2s)}{1 + s^{2}} (the sheets' round direction).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(EinsteinRosen(q, r(1)).circle(r(1, 2)));
}
Output
(3/5, 4/5)
final class ClassicEinsteinRosen

The classic counterparts (Transcendental, Root).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final c = ClassicEinsteinRosen(1);
  print('proper distance to u = 1: ${f6(c.properDistance(1))}');
}
Output
proper distance to u = 1: 3.049009

Constructors

const ClassicEinsteinRosen(this.m)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(const ClassicEinsteinRosen(1).embeddingHeight(4)));
}
Output
4.000000

Properties

mfield
final double m

Methods

double properDistance(double u)

Proper radial distance from the throat to u: u\sqrt{2M + u^{2}} + 2M \operatorname{asinh}(\frac{u}{\sqrt{2M}}).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(const ClassicEinsteinRosen(1).properDistance(2)));
}
Output
7.191411
double embeddingHeight(double r)

Flamm's paraboloid z(r) = \sqrt{8M(r - 2M)}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(const ClassicEinsteinRosen(1).embeddingHeight(3)));
}
Output
2.828427
throatmethod
(double, double) throat(double eta)

The throat on the cycloid: (r, \tau) at the cycloid angle \eta.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(const ClassicEinsteinRosen(1).throat(0));
}
Output
(2.0, 0.0)
enum

RayEnd

enum RayEnd

Where a light ray from (u_{0}, v_{0}) in Kruskal null coordinates ends: it keeps U (moving to larger V). A shock of strength alpha along V = 0 (negative energy, Gao–Jafferis–Wall) shifts it U \mapsto U - \alpha when it crosses V = 0.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(RayEnd.values);
}
Output
[RayEnd.singularity, RayEnd.rightExterior, RayEnd.leftExterior]

Values

singularity
rightExterior
leftExterior
final class TraversableModel<T>

A traversable wormhole (Gao–Jafferis–Wall; Maldacena–Stanford–Yang), beyond Witten's talk. A signal leaves the left boundary at time -t_{s} and runs in at constant Kruskal U = \frac{u_{1}}{w}, w = e^{t_{s}/4M} (earlier signals hug the horizon). Coupling the two boundaries at t = 0 sends a negative-energy shock along V = 0 that shifts every crossing ray by U \mapsto U - \alpha (\alpha > 0 for the right sign of the coupling, \alpha < 0 for the wrong one: a delay). The signal's own energy E, blue-shifted by w at the shock, pushes back: \alpha_{\mathrm{eff}} = \alpha - \kappa E \cdot w. The signal comes out on the right iff its U after the shift is negative:

\frac{u_{1}}{w} < \alpha - \kappa E \cdot w (a window in w: e w^{2} - \alpha w + u_{1} < 0)

Rational: w = \frac{1 + \tau}{1 - \tau} with \tau = \tanh(\frac{t_{s}}{8M}), the red-rotation half-parameter, so the test is {+}\ {-}\ \times\ \div. Arriving at the right boundary at U' < 0 means right time t_{R} with e^{-t_{R}/4M} = -U'/u_{1}, rationally the half parameter \tau_{R} = \frac{u_{1} + U'}{u_{1} - U'}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final t = TraversableModel(q, u1: r(1), alpha: r(1, 2), kappaE: r(1, 10));
  final w = t.boost(r(1, 3));
  print('w = $w, gets through: ${t.through(w)}, arrives at τ = ${t.arrival(w)}');
}
Output
w = 2, gets through: false, arrives at τ = null

Constructors

TraversableModelconstructor
const TraversableModel(this.f, {required this.u1, required this.alpha, required this.kappaE})
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(TraversableModel(q, u1: r(1), alpha: r(1, 2), kappaE: r(1, 10)).boost(r(0)));
}
Output
1

Properties

ffield
final KeplerArith<T> f
u1field
final T u1
alphafield
final T alpha
kappaEfield
final T kappaE

Methods

boostmethod
T boost(T tau)

w = e^{t_{s}/4M} from the half-parameter \tau: \frac{1 + \tau}{1 - \tau}.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(TraversableModel(q, u1: r(1), alpha: r(1, 2), kappaE: r(1, 10)).boost(r(1, 2)));
}
Output
3
sendUmethod
T sendU(T w)

U of the signal before the shock.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(TraversableModel(q, u1: r(1), alpha: r(1, 2), kappaE: r(1, 10)).sendU(r(2)));
}
Output
1/2
shiftmethod
T shift(T w)

The shift the signal meets, \alpha - \kappa E \cdot w.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(TraversableModel(q, u1: r(1), alpha: r(1, 2), kappaE: r(1, 10)).shift(r(2)));
}
Output
3/10
afterUmethod
T afterU(T w)

U after the shock: negative means it comes out on the right.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(TraversableModel(q, u1: r(1), alpha: r(1, 2), kappaE: r(1, 10)).afterU(r(2)));
}
Output
1/5
throughmethod
bool through(T w)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final t = TraversableModel(q, u1: r(1), alpha: r(1, 2), kappaE: r(1, 10));
  print([for (final w in [1, 2, 5]) t.through(r(w))]);
}
Output
[false, false, false]
arrivalmethod
T? arrival(T w)

The right boundary's arrival half-parameter \tau_{R} = \frac{u_{1} + U'}{u_{1} - U'}, or null if it never arrives.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(TraversableModel(q, u1: r(1), alpha: r(1, 2), kappaE: r(1, 10)).arrival(r(2)));
}
Output
null
final class ClassicTraversable

The classic counterpart: w = e^{t_{s}/4M}, arrival time t_{R} = -4M \ln(-U'/u_{1}), and the window's edges from the roots of e w^{2} - \alpha w + u_{1} (Transcendental, Root).

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(const ClassicTraversable(m: 1, u1: 1, alpha: 0.5, kappaE: 0.1).window());
}
Output
null

Constructors

const ClassicTraversable({required this.m, required this.u1, required this.alpha, required this.kappaE})
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(const ClassicTraversable(m: 1, u1: 1, alpha: 0.5, kappaE: 0.1).boost(4)));
}
Output
2.718282

Properties

mfield
final double m
u1field
final double u1
alphafield
final double alpha
kappaEfield
final double kappaE

Methods

boostmethod
double boost(double ts)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(const ClassicTraversable(m: 1, u1: 1, alpha: 0.5, kappaE: 0.1).boost(0)));
}
Output
1.000000
afterUmethod
double afterU(double ts)
Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  print(f6(const ClassicTraversable(m: 1, u1: 1, alpha: 0.5, kappaE: 0.1).afterU(1)));
}
Output
0.407203
double? arrivalTime(double ts)
windowmethod
(double, double)? window()

The send times that get through, (earliest, latest) in t_{s}, or null if none.

Example
import 'package:riptide_kepler/riptide_kepler.ray';
import 'package:riptide_precision/riptide_precision.ray';
import 'package:riptide_rational_relativity/riptide_rational_relativity.ray';
import 'raya:convert';

Rational r(int n, [int d = 1]) => Rational.fromInt(n, d);
String f6(num x) => x.toStringAsFixed(6);

void main() {
  const q = ExactArith();
  final w = const ClassicTraversable(m: 1, u1: 1, alpha: 0.5, kappaE: 0.1).window();
  print(w == null ? 'none' : '${f6(w.$1)} … ${f6(w.$2)}');
}
Output
none