VISH
0.2
|
Demonstration of Lorentz transformation.
#include "../QuadraticMatrix.hpp" #include <iostream> using namespace Eagle; using namespace std; int main() { Quadratic<4, double> Lorentz; { double v = 0.9, gamma = sqrt(1-v*v); Lorentz.set(0.0); Lorentz(0,0) = 1/gamma; Lorentz(1,0) = v/gamma; Lorentz(0,1) = v/gamma; Lorentz(1,1) = 1/gamma; Lorentz(2,2) = 1; Lorentz(3,3) = 1; } cout << Lorentz << endl; { Matrix<4,4, double> Minkowski, Result; Minkowski.set(0.0); Minkowski(0,0) = +1.0; Minkowski(1,1) = -1.0; Minkowski(2,2) = -1.0; Minkowski(3,3) = -1.0; cout << Minkowski << endl; Result = matrix_transform( Lorentz, Minkowski); cout << Result << endl; } cout << "---------------------------------" << endl; { LowerTriangular<4, double> Minkowski; Minkowski.set(0.0); Minkowski(0,0) = +1.0; Minkowski(1,1) = -1.0; Minkowski(2,2) = -1.0; Minkowski(3,3) = -1.0; Matrix<4,4, double> tmp; MatrixMultiply(tmp, Lorentz, Minkowski); Matrix<4,4, double> result; MatrixMultiplyTransposed(result, tmp, Lorentz); cout << result; MatrixTransform(result, Lorentz, Minkowski); cout << result; cout << Lorentz(Minkowski); } return 0; }