use core::f64::consts::PI;
use crate::{C, G, HBAR};
pub fn alcubierre_energy(radius: f64, wall: f64, speed: f64) -> f64 {
-speed * speed / 12.0 * radius * radius / wall * C * C / G
}
pub fn quantum_inequality(tau: f64) -> f64 {
-3.0 * HBAR * C / (32.0 * PI * PI * (C * tau).powi(4))
}
pub fn casimir_energy_density(d: f64) -> f64 {
-PI * PI * HBAR * C / (720.0 * d.powi(4))
}
pub fn casimir_pressure(d: f64) -> f64 {
-PI * PI * HBAR * C / (240.0 * d.powi(4))
}
pub fn casimir_sphere_plate(radius: f64, d: f64) -> f64 {
-PI.powi(3) * HBAR * C * radius / (360.0 * d.powi(3))
}
pub fn wormhole_throat_tension(b0: f64) -> f64 {
C.powi(4) / (8.0 * PI * G * b0 * b0)
}
pub fn wormhole_edge_tension() -> f64 {
-C.powi(4) / (8.0 * G)
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Metric {
GeneralRelativity,
PolarizableVacuum,
}
pub fn light_bending(mass: f64, b: f64, metric: Metric) -> f64 {
let x = G * mass / (C * C * b);
let second = match metric {
Metric::GeneralRelativity => 15.0 * PI / 4.0,
Metric::PolarizableVacuum => 4.0 * PI,
};
4.0 * x + second * x * x
}
#[cfg(test)]
mod tests {
use super::*;
use crate::PLANCK_LENGTH;
fn close(a: f64, b: f64, rel: f64) -> bool {
(a / b - 1.0).abs() < rel
}
#[test]
fn warp_bubbles_and_quantum_inequalities() {
assert!(close(alcubierre_energy(100.0, 100.0 * PLANCK_LENGTH, 1.0), -6.94e62, 5e-3));
assert!(close(alcubierre_energy(100.0, 1.0, 1.0) / 1.989e30, -0.564, 5e-3));
assert!(close(quantum_inequality(1e-9), -3.72e-26, 5e-3));
assert!(close(quantum_inequality(1e-15), -3.72e-2, 5e-3));
}
#[test]
fn casimir_closed_forms() {
assert!(close(casimir_pressure(1e-6), -1.300e-3, 1e-3));
let d = 1e-6;
let energy = |d: f64| casimir_energy_density(d) * d;
let h = 1e-12;
assert!(close(-(energy(d + h) - energy(d - h)) / (2.0 * h), casimir_pressure(d), 1e-6));
assert!(close(casimir_sphere_plate(1e-4, d), 2.0 * PI * 1e-4 * energy(d), 1e-12));
}
#[test]
fn wormholes() {
assert!(close(wormhole_throat_tension(10.0), 4.82e40, 5e-3));
assert!(close(wormhole_edge_tension(), -1.513e43, 1e-3));
}
#[test]
fn polarizable_vacuum_against_general_relativity() {
let (sun, limb) = (1.327_124_4e20 / G, 6.957e8);
let arcsec = 180.0 / PI * 3600.0;
let gr = light_bending(sun, limb, Metric::GeneralRelativity);
assert!((gr * arcsec - 1.7512).abs() < 1e-4);
let diff = light_bending(sun, limb, Metric::PolarizableVacuum) - gr;
assert!(close(diff * arcsec * 1e6, 0.730, 5e-3));
}
}