Package org.apache.commons.math3.analysis.differentiation

Examples of org.apache.commons.math3.analysis.differentiation.DerivativeStructure.multiply()


            dx = variables[0].getField().getOne();
            for (int j = 0; j < n; ++j) {
                s2 = s2.add(dx.multiply(variables[j]));
                dx = dx.multiply(div);
            }
            f[i] = s1.subtract(s2.multiply(s2)).subtract(1);
        }

        DerivativeStructure x1 = variables[0];
        DerivativeStructure x2 = variables[1];
        f[m - 2] = x1;
View Full Code Here


        DerivativeStructure x3 = variables[2];
        DerivativeStructure[] f = new DerivativeStructure[m];
      for (int i = 0; i < m; ++i) {
        double tmp = (i + 1) / 10.0;
        f[i] = x1.multiply(-tmp).exp().subtract(x2.multiply(-tmp).exp()).add(
                  x3.multiply(FastMath.exp(-i - 1) - FastMath.exp(-tmp)));
      }
      return f;
    }

  }
View Full Code Here

        DerivativeStructure x1 = variables[0];
        DerivativeStructure x2 = variables[1];
        DerivativeStructure[] f = new DerivativeStructure[m];
        for (int i = 0; i < m; ++i) {
            double temp = i + 1;
            f[i] = x1.multiply(temp).exp().add(x2.multiply(temp).exp()).subtract(2 + 2 * temp).negate();
        }
        return f;
    }

  }
View Full Code Here

        DerivativeStructure[] f = new DerivativeStructure[m];
        for (int i = 0; i < m; ++i) {
            double temp = (i + 1) / 5.0;
            DerivativeStructure tmp1 = x1.add(x2.multiply(temp)).subtract(FastMath.exp(temp));
            DerivativeStructure tmp2 = x3.add(x4.multiply(FastMath.sin(temp))).subtract(FastMath.cos(temp));
            f[i] = tmp1.multiply(tmp1).add(tmp2.multiply(tmp2));
        }
        return f;
    }

  }
View Full Code Here

        DerivativeStructure[] f = new DerivativeStructure[m];
        DerivativeStructure sum  = variables[0].getField().getZero().subtract(n + 1);
        DerivativeStructure prod = variables[0].getField().getOne();
      for (int j = 0; j < n; ++j) {
        sum  = sum.add(variables[j]);
        prod = prod.multiply(variables[j]);
      }
      for (int i = 0; i < n; ++i) {
        f[i] = variables[i].add(sum);
      }
      f[n - 1] = prod.subtract(1);
View Full Code Here

            // (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;
View Full Code Here

            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;

View Full Code Here

        DerivativeStructure sum = variables[0].getField().getZero();
        for (int i = 0; i < n; ++i) {
            sum = sum.add(variables[i].multiply(i + 1));
        }
        for (int i = 0; i < m; ++i) {
            f[i] = sum.multiply(i + 1).subtract(1);
        }
        return f;
    }

  }
View Full Code Here

        DerivativeStructure sum = variables[0].getField().getZero();
      for (int i = 1; i < (n - 1); ++i) {
          sum = sum.add(variables[i].multiply(i + 1));
      }
      for (int i = 0; i < (m - 1); ++i) {
        f[i] = sum.multiply(i).subtract(1);
      }
      f[m - 1] = variables[0].getField().getOne().negate();
      return f;
    }
View Full Code Here

    private DerivativeStructure distance(Vector2D point,
                                         DerivativeStructure cx, DerivativeStructure cy) {
        DerivativeStructure dx = cx.subtract(point.getX());
        DerivativeStructure dy = cy.subtract(point.getY());
        return dx.multiply(dx).add(dy.multiply(dy)).sqrt();
    }

    public DerivativeStructure getRadius(DerivativeStructure cx, DerivativeStructure cy) {
        DerivativeStructure r = cx.getField().getZero();
        for (Vector2D point : points) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.