Java Code Examples for org.apache.commons.math3.analysis.differentiation.DerivativeStructure#divide()

The following examples show how to use org.apache.commons.math3.analysis.differentiation.DerivativeStructure#divide() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CircleProblem.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public DerivativeStructure[] value(DerivativeStructure[] params) {
    final DerivativeStructure cx = params[0];
    final DerivativeStructure cy = params[1];
    final DerivativeStructure r = params[2];

    final DerivativeStructure[] model = new DerivativeStructure[points.size() * 2];

    for (int i = 0; i < points.size(); i++) {
        final Vector2D p = points.get(i);

        // Find the circle point closest to the observed point
        // (observed points are points add through the addPoint method above)
        final DerivativeStructure dX = cx.subtract(p.getX());
        final DerivativeStructure dY = cy.subtract(p.getY());
        final DerivativeStructure scaling = r.divide(dX.multiply(dX).add(dY.multiply(dY)).sqrt());
        final int index  = i * 2;
        model[index]     = cx.subtract(scaling.multiply(dX));
        model[index + 1] = cy.subtract(scaling.multiply(dY));

    }

    return model;

}
 
Example 2
Source File: CircleProblem.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public DerivativeStructure[] value(DerivativeStructure[] params) {
    final DerivativeStructure cx = params[0];
    final DerivativeStructure cy = params[1];
    final DerivativeStructure r = params[2];

    final DerivativeStructure[] model = new DerivativeStructure[points.size() * 2];

    for (int i = 0; i < points.size(); i++) {
        final Vector2D p = points.get(i);

        // Find the circle point closest to the observed point
        // (observed points are points add through the addPoint method above)
        final DerivativeStructure dX = cx.subtract(p.getX());
        final DerivativeStructure dY = cy.subtract(p.getY());
        final DerivativeStructure scaling = r.divide(dX.multiply(dX).add(dY.multiply(dY)).sqrt());
        final int index  = i * 2;
        model[index]     = cx.subtract(scaling.multiply(dX));
        model[index + 1] = cy.subtract(scaling.multiply(dY));

    }

    return model;

}
 
Example 3
Source File: CircleProblem.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public DerivativeStructure[] value(DerivativeStructure[] params) {
    final DerivativeStructure cx = params[0];
    final DerivativeStructure cy = params[1];
    final DerivativeStructure r = params[2];

    final DerivativeStructure[] model = new DerivativeStructure[points.size() * 2];

    for (int i = 0; i < points.size(); i++) {
        final Vector2D p = points.get(i);

        // Find the circle point closest to the observed point
        // (observed points are points add through the addPoint method above)
        final DerivativeStructure dX = cx.subtract(p.getX());
        final DerivativeStructure dY = cy.subtract(p.getY());
        final DerivativeStructure scaling = r.divide(dX.multiply(dX).add(dY.multiply(dY)).sqrt());
        final int index  = i * 2;
        model[index]     = cx.subtract(scaling.multiply(dX));
        model[index + 1] = cy.subtract(scaling.multiply(dY));

    }

    return model;

}
 
Example 4
Source File: CircleProblem.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public DerivativeStructure[] value(DerivativeStructure[] params) {
    final DerivativeStructure cx = params[0];
    final DerivativeStructure cy = params[1];
    final DerivativeStructure r = params[2];

    final DerivativeStructure[] model = new DerivativeStructure[points.size() * 2];

    for (int i = 0; i < points.size(); i++) {
        final Vector2D p = points.get(i);

        // Find the circle point closest to the observed point
        // (observed points are points add through the addPoint method above)
        final DerivativeStructure dX = cx.subtract(p.getX());
        final DerivativeStructure dY = cy.subtract(p.getY());
        final DerivativeStructure scaling = r.divide(dX.multiply(dX).add(dY.multiply(dY)).sqrt());
        final int index  = i * 2;
        model[index]     = cx.subtract(scaling.multiply(dX));
        model[index + 1] = cy.subtract(scaling.multiply(dY));

    }

    return model;

}
 
Example 5
Source File: CircleProblem.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public DerivativeStructure[] value(DerivativeStructure[] params) {
    final DerivativeStructure cx = params[0];
    final DerivativeStructure cy = params[1];
    final DerivativeStructure r = params[2];

    final DerivativeStructure[] model = new DerivativeStructure[points.size() * 2];

    for (int i = 0; i < points.size(); i++) {
        final Vector2D p = points.get(i);

        // Find the circle point closest to the observed point
        // (observed points are points add through the addPoint method above)
        final DerivativeStructure dX = cx.subtract(p.getX());
        final DerivativeStructure dY = cy.subtract(p.getY());
        final DerivativeStructure scaling = r.divide(dX.multiply(dX).add(dY.multiply(dY)).sqrt());
        final int index  = i * 2;
        model[index]     = cx.subtract(scaling.multiply(dX));
        model[index + 1] = cy.subtract(scaling.multiply(dY));

    }

    return model;

}
 
Example 6
Source File: CircleProblem.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
public DerivativeStructure[] value(DerivativeStructure[] params) {
    final DerivativeStructure cx = params[0];
    final DerivativeStructure cy = params[1];
    final DerivativeStructure r = params[2];

    final DerivativeStructure[] model = new DerivativeStructure[points.size() * 2];

    for (int i = 0; i < points.size(); i++) {
        final Vector2D p = points.get(i);

        // Find the circle point closest to the observed point
        // (observed points are points add through the addPoint method above)
        final DerivativeStructure dX = cx.subtract(p.getX());
        final DerivativeStructure dY = cy.subtract(p.getY());
        final DerivativeStructure scaling = r.divide(dX.multiply(dX).add(dY.multiply(dY)).sqrt());
        final int index  = i * 2;
        model[index]     = cx.subtract(scaling.multiply(dX));
        model[index + 1] = cy.subtract(scaling.multiply(dY));

    }

    return model;

}
 
Example 7
Source File: CircleScalar.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 8
Source File: CircleVectorial.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 9
Source File: CircleScalar.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 10
Source File: CircleVectorial.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 11
Source File: CircleScalar.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 12
Source File: CircleVectorial.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 13
Source File: CircleScalar.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 14
Source File: CircleVectorial.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 15
Source File: CircleScalar.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 16
Source File: CircleVectorial.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 17
Source File: CircleScalar.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}
 
Example 18
Source File: CircleVectorial.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
    DerivativeStructure r = cx.getField().getZero();
    for (Vector2D point : points) {
        r = r.add(distance(point, cx, cy));
    }
    return r.divide(points.size());
}