Package cnuphys.swim

Class DefaultDerivative

java.lang.Object
cnuphys.swim.DefaultDerivative
All Implemented Interfaces:
IDerivative

public class DefaultDerivative extends Object implements IDerivative
  • Constructor Details

    • DefaultDerivative

      public DefaultDerivative(int charge, double momentum, FieldProbe field)
      The derivative for swimming through a magnetic field
      Parameters:
      charge - -1 for electron, +1 for proton, etc.
      momentum - the magnitude of the momentum.
      field - the magnetic field
  • Method Details

    • set

      public void set(int charge, double momentum, FieldProbe field)
    • derivative

      public void derivative(double s, double[] u, double[] du)
      Compute the derivatives given the value of s (path length) and the values of the state vector.
      Specified by:
      derivative in interface IDerivative
      Parameters:
      s - the value of the independent variable path length (input).
      u - the values of the state vector ([x,y,z, tx = px/p, ty = py/p, tz = pz/p]) at s (input).
      du - will be filled with the values of the derivatives at s (output).