use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.
the class TransformProviderUtilTest method testCombine.
@Test
public void testCombine() throws OrekitException {
RandomGenerator random = new Well19937a(0x6e3b2c793680e7e3l);
final AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
for (int i = 0; i < 20; ++i) {
TransformProvider first = constantProvider(random);
TransformProvider second = constantProvider(random);
TransformProvider combined = TransformProviderUtils.getCombinedProvider(first, second);
checkNoTransform(new Transform(date, new Transform(date, first.getTransform(date), second.getTransform(date)).getInverse(), combined.getTransform(date)), random);
}
}
use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.
the class PVCoordinatesTest method testCrossProduct.
@Test
public void testCrossProduct() {
DSFactory factory = new DSFactory(1, 2);
RandomGenerator generator = new Well19937a(0x85c592b3be733d23l);
FiniteDifferencesDifferentiator differentiator = new FiniteDifferencesDifferentiator(5, 1.0e-3);
for (int i = 0; i < 200; ++i) {
final PVCoordinates pv1 = randomPVCoordinates(generator, 1.0, 1.0, 1.0);
final PVCoordinates pv2 = randomPVCoordinates(generator, 1.0, 1.0, 1.0);
DerivativeStructure x = differentiator.differentiate(new UnivariateFunction() {
public double value(double t) {
return Vector3D.crossProduct(pv1.shiftedBy(t).getPosition(), pv2.shiftedBy(t).getPosition()).getX();
}
}).value(factory.variable(0, 0.0));
DerivativeStructure y = differentiator.differentiate(new UnivariateFunction() {
public double value(double t) {
return Vector3D.crossProduct(pv1.shiftedBy(t).getPosition(), pv2.shiftedBy(t).getPosition()).getY();
}
}).value(factory.variable(0, 0.0));
DerivativeStructure z = differentiator.differentiate(new UnivariateFunction() {
public double value(double t) {
return Vector3D.crossProduct(pv1.shiftedBy(t).getPosition(), pv2.shiftedBy(t).getPosition()).getZ();
}
}).value(factory.variable(0, 0.0));
PVCoordinates product = PVCoordinates.crossProduct(pv1, pv2);
Assert.assertEquals(x.getValue(), product.getPosition().getX(), 1.0e-16);
Assert.assertEquals(y.getValue(), product.getPosition().getY(), 1.0e-16);
Assert.assertEquals(z.getValue(), product.getPosition().getZ(), 1.0e-16);
Assert.assertEquals(x.getPartialDerivative(1), product.getVelocity().getX(), 9.0e-10);
Assert.assertEquals(y.getPartialDerivative(1), product.getVelocity().getY(), 9.0e-10);
Assert.assertEquals(z.getPartialDerivative(1), product.getVelocity().getZ(), 9.0e-10);
Assert.assertEquals(x.getPartialDerivative(2), product.getAcceleration().getX(), 3.0e-9);
Assert.assertEquals(y.getPartialDerivative(2), product.getAcceleration().getY(), 3.0e-9);
Assert.assertEquals(z.getPartialDerivative(2), product.getAcceleration().getZ(), 3.0e-9);
}
}
use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.
the class FieldPVCoordinatesTest method testNormalize.
@Test
public void testNormalize() {
DSFactory factory = new DSFactory(1, 2);
RandomGenerator generator = new Well19937a(0x7ede9376e4e1ab5al);
FiniteDifferencesDifferentiator differentiator = new FiniteDifferencesDifferentiator(5, 1.0e-3);
for (int i = 0; i < 200; ++i) {
final FieldPVCoordinates<DerivativeStructure> pv = randomPVCoordinates(generator, 1e6, 1e3, 1.0);
DerivativeStructure x = differentiator.differentiate(new UnivariateFunction() {
public double value(double t) {
return pv.shiftedBy(t).getPosition().normalize().getX().getValue();
}
}).value(factory.variable(0, 0.0));
DerivativeStructure y = differentiator.differentiate(new UnivariateFunction() {
public double value(double t) {
return pv.shiftedBy(t).getPosition().normalize().getY().getValue();
}
}).value(factory.variable(0, 0.0));
DerivativeStructure z = differentiator.differentiate(new UnivariateFunction() {
public double value(double t) {
return pv.shiftedBy(t).getPosition().normalize().getZ().getValue();
}
}).value(factory.variable(0, 0.0));
FieldPVCoordinates<DerivativeStructure> normalized = pv.normalize();
Assert.assertEquals(x.getValue(), normalized.getPosition().getX().getValue(), 1.0e-16);
Assert.assertEquals(y.getValue(), normalized.getPosition().getY().getValue(), 1.0e-16);
Assert.assertEquals(z.getValue(), normalized.getPosition().getZ().getValue(), 1.0e-16);
Assert.assertEquals(x.getPartialDerivative(1), normalized.getVelocity().getX().getValue(), 3.0e-13);
Assert.assertEquals(y.getPartialDerivative(1), normalized.getVelocity().getY().getValue(), 3.0e-13);
Assert.assertEquals(z.getPartialDerivative(1), normalized.getVelocity().getZ().getValue(), 3.0e-13);
Assert.assertEquals(x.getPartialDerivative(2), normalized.getAcceleration().getX().getValue(), 6.0e-10);
Assert.assertEquals(y.getPartialDerivative(2), normalized.getAcceleration().getY().getValue(), 6.0e-10);
Assert.assertEquals(z.getPartialDerivative(2), normalized.getAcceleration().getZ().getValue(), 6.0e-10);
}
}
Aggregations