public ConstantsRegistry() { this.add(new PiConstant()); this.add(new ExtendedConstant(Constants.PI_INV, Math.PI, null)); this.add(new ExtendedConstant(Constants.INF, Double.POSITIVE_INFINITY, "JsclDouble.valueOf(Double.POSITIVE_INFINITY)")); this.add(new ExtendedConstant(Constants.INF_2, Double.POSITIVE_INFINITY, "JsclDouble.valueOf(Double.POSITIVE_INFINITY)")); this.add(new ExtendedConstant(Constants.I, "√(-1)", null)); this.add(new ExtendedConstant(new Constant(E), Math.E, null)); this.add(new ExtendedConstant(new Constant(C), C_VALUE, null)); this.add(new ExtendedConstant(new Constant(G), G_VALUE, null)); this.add(new ExtendedConstant(new Constant(H_REDUCED), H_REDUCED_VALUE, null)); this.add(new ExtendedConstant(new Constant(NAN), Double.NaN, null)); } }
@Override public int compareTo(ExtendedConstant o) { return this.constant.compareTo(o.getConstant()); } }
public Generic selfElementary() { return new Fraction(parameters[0], new Abs(parameters[0]).selfElementary()).selfElementary(); }
public Generic selfElementary() { return new Ln( new Root( new Generic[]{ JsclInteger.valueOf(1), JsclInteger.valueOf(2).multiply(parameters[0]), JsclInteger.valueOf(-1) }, 0 ).selfElementary() ).selfElementary(); }
static Generic nth(Generic parameter[]) { int degree = parameter.length - 1; Generic a = new Fraction(parameter[0], parameter[degree]).selfSimplify(); return new Pow( a.negate(), new Inverse(JsclInteger.valueOf(degree)).selfSimplify() ).selfSimplify(); }
public Generic antiDerivative(int n) throws NotIntegrableException { if (n == 0) { return new Pow(parameters[0], parameters[1].add(JsclInteger.valueOf(1))).selfExpand().multiply(new Inverse(parameters[1].add(JsclInteger.valueOf(1))).selfExpand()); } else { return new Pow(parameters[0], parameters[1]).selfExpand().multiply(new Inverse(new Ln(parameters[0]).selfExpand()).selfExpand()); } }
@Override public void copy(@Nonnull MathEntity that) { this.constant.copy(that); if (that instanceof IConstant) { this.description = ((IConstant) that).getDescription(); this.value = ((IConstant) that).getValue(); } if (that instanceof ExtendedConstant) { this.javaString = ((ExtendedConstant) that).javaString; } }
@Nonnull @Override public CustomFunction create() { final CustomFunction customFunction = new CustomFunction(name, parameterNames, prepareContent(content), description); customFunction.setSystem(system); if (id != null) { customFunction.setId(id); } return customFunction; }
public Generic selfElementary() { return new Exp( new Ln( parameters[0] ).selfElementary().multiply( parameters[1] ) ).selfElementary(); }
public Generic derivative(int n) { return Constants.Generic.THIRD.multiply( new Inverse( selfExpand().pow(2) ).selfExpand() ); }
Sigma(Generic parameter[], int n) { root = new Generic[parameter.length - 1]; for (int i = 0; i < root.length; i++) root[i] = new Root(parameter, i).expressionValue(); place = new boolean[root.length]; this.n = n; }
public Generic derivative(int n) { int c[] = new int[derivations.length]; for (int i = 0; i < c.length; i++) { if (i == n) c[i] = derivations[i] + 1; else c[i] = derivations[i]; } return new ImplicitFunction(name, parameters, c, subscripts).selfExpand(); }
public Generic selfExpand() { final Generic result = selfEvaluate(); if (result == null) { return expressionValue(); } else { return result; } }
private Generic lg(Generic a, boolean aOne) { Generic lga; if (aOne) { lga = ZERO; } else { lga = new Lg(a).selfSimplify(); } return lga; }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ExtendedConstant)) return false; ExtendedConstant that = (ExtendedConstant) o; if (!constant.equals(that.constant)) return false; return true; }
@Override public Generic selfExpand() { return expressionValue(); }
public Generic selfElementary() { return new Ln( new Root( new Generic[]{ JsclInteger.valueOf(-1), JsclInteger.valueOf(2).multiply(parameters[0]), JsclInteger.valueOf(-1) }, 0 ).selfElementary() ).selfElementary(); }
public Generic selfElementary() { return new Ln( new Root( new Generic[]{ JsclInteger.valueOf(1).add(parameters[0]), JsclInteger.valueOf(0), JsclInteger.valueOf(1).subtract(parameters[0]) }, 0 ).selfElementary() ).selfElementary(); }
public Generic selfElementary() { return new Ln( new Root( new Generic[]{ JsclInteger.valueOf(1).add(parameters[0]), JsclInteger.valueOf(0), JsclInteger.valueOf(-1).add(parameters[0]) }, 0 ).selfElementary() ).selfElementary(); }