All Downloads are FREE. Search and download functionalities are using the official Maven repository.

JSci.physics.relativity.LorentzBoost Maven / Gradle / Ivy

Go to download

JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software. It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ... Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).

The newest version!
package JSci.physics.relativity;

import JSci.maths.vectors.Double3Vector;

/**
* The LorentzBoost class encapsulates the Lorentz boosts.
* @version 1.0
* @author Mark Hale
*/
public final class LorentzBoost extends Rank2Tensor {
        /**
        * Constructs a Lorentz boost.
        * @param v velocity
        */
        public LorentzBoost(Double3Vector v) {
                this(v.getComponent(0),v.getComponent(1),v.getComponent(2));
        }
        /**
        * Constructs a Lorentz boost.
        * @param vx x-velocity
        * @param vy y-velocity
        * @param vz z-velocity
        */
        public LorentzBoost(double vx,double vy,double vz) {
                final double vv=vx*vx+vy*vy+vz*vz;
                final double gamma=1.0/Math.sqrt(1.0-vv);
                final double k=(gamma-1.0)/vv;
                rank2[0][0]=gamma;
                rank2[0][1]=rank2[1][0]=-gamma*vx;
                rank2[0][2]=rank2[2][0]=-gamma*vy;
                rank2[0][3]=rank2[3][0]=-gamma*vz;
                rank2[1][1]=1.0+k*vx*vx;
                rank2[1][2]=rank2[2][1]=k*vx*vy;
                rank2[1][3]=rank2[3][1]=k*vx*vz;
                rank2[2][2]=1.0+k*vy*vy;
                rank2[2][3]=rank2[3][2]=k*vy*vz;
                rank2[3][3]=1.0+k*vz*vz;
        }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy