@Test public void testDerivations() throws Exception { final AngleUnit defaultAngleUnits = JsclMathEngine.getInstance().getAngleUnits(); try { JsclMathEngine.getInstance().setAngleUnits(AngleUnit.rad); assertEquals("-0.909297426825682", Expression.valueOf("∂(cos(t),t,2)").numeric().toString()); assertEquals("∂(cos(t), t, 2, 1)", Expression.valueOf("∂(cos(t),t,2)").simplify().toString()); assertEquals("-2.234741690198506", Expression.valueOf("∂(t*cos(t),t,2)").numeric().toString()); assertEquals("-4.469483380397012", Expression.valueOf("2*∂(t*cos(t),t,2)").numeric().toString()); assertEquals("-sin(2)", Expression.valueOf("∂(cos(t),t,2)").expand().toString()); assertEquals("-sin(t)", Expression.valueOf("∂(cos(t),t)").expand().toString()); assertEquals("-sin(t)", Expression.valueOf("∂(cos(t),t,t,1)").expand().simplify().toString()); assertEquals("∂(cos(t), t, t, 1°)", Expression.valueOf("∂(cos(t),t,t,1°)").expand().simplify().toString()); } finally { JsclMathEngine.getInstance().setAngleUnits(defaultAngleUnits); } assertEquals("∂(cos(t), t, t, 1°)", Expression.valueOf("∂(cos(t),t,t,1°)").expand().numeric().toString()); }
@Nonnull public static Expression valueOf(@Nonnull Variable variable) { return valueOf(Literal.valueOf(variable)); }
Expression extends Generic { @Nonnull public static Expression valueOf(@Nonnull Variable variable) { return valueOf(Literal.valueOf(variable)); } }
Expression extends Generic { @Nonnull public static Expression valueOf(@Nonnull Variable variable) { return valueOf(Literal.valueOf(variable)); } Expression();   Expression(int size); }
Expression extends Generic { @Nonnull public static Expression valueOf(@Nonnull Variable variable) { return valueOf(Literal.valueOf(variable)); } Expression();   Expression(int size); static Variable[] variables(Generic elements[]); @Nonnull static Expression valueOf(@Nonnull Variable variable); @Nonnull static Expression valueOf(@Nonnull Literal literal); @Nonnull static Expression valueOf(@Nonnull JsclInteger integer); @Nonnull static Expression valueOf(@Nonnull Literal literal, @Nonnull JsclInteger integer); static Expression valueOf(Rational rational); static Expression valueOf(@Nonnull Constant constant); static Expression valueOf(double value); static Expression valueOf(@Nonnull String expression); Expression init(@Nonnull NumericWrapper numericWrapper); static void separateSign(MathML element, Generic generic); int size(); Literal literal(int n); JsclInteger coef(int n); Expression add(@Nonnull Expression that); @Nonnull Generic add(@Nonnull Generic that); Expression subtract(Expression expression); @Nonnull Generic subtract(@Nonnull Generic that); Expression multiply(Expression expression); @Nonnull Generic multiply(@Nonnull Generic that); @Nonnull Generic divide(@Nonnull Generic that); Generic[] divideAndRemainder(Generic generic); Generic gcd(@Nonnull Generic generic); @Nonnull Generic gcd(); @Nonnull Literal literalScm(); Generic negate(); int signum(); int degree(); Generic antiDerivative(@Nonnull Variable variable); Generic derivative(@Nonnull Variable variable); Generic substitute(@Nonnull final Variable variable, final Generic generic); Generic expand(); Generic factorize(); Generic elementary(); Generic simplify(); Generic numeric(); @Nonnull Generic valueOf(@Nonnull Generic generic); @Nonnull Generic[] sumValue(); @Nonnull Generic[] productValue(); Power powerValue(); Expression expressionValue(); @Override boolean isInteger(); JsclInteger integerValue(); @Override double doubleValue(); Variable variableValue(); Variable[] variables(); boolean isPolynomial(@Nonnull Variable variable); boolean isConstant(@Nonnull Variable variable); JsclVector grad(Variable variable[]); Generic laplacian(Variable variable[]); Generic dalembertian(Variable variable[]); int compareTo(Expression expression); int compareTo(@Nonnull Generic generic); String toString(); String toJava(); void toMathML(MathML element, @Nullable Object data); @Nonnull @Override Set<? extends Constant> getConstants(); }
Expression extends Generic { @Nonnull public static Expression valueOf(@Nonnull Variable variable) { return valueOf(Literal.valueOf(variable)); } Expression();   Expression(int size); static Variable[] variables(Generic elements[]); @Nonnull static Expression valueOf(@Nonnull Variable variable); @Nonnull static Expression valueOf(@Nonnull Literal literal); @Nonnull static Expression valueOf(@Nonnull JsclInteger integer); @Nonnull static Expression valueOf(@Nonnull Literal literal, @Nonnull JsclInteger integer); static Expression valueOf(Rational rational); static Expression valueOf(@Nonnull Constant constant); static Expression valueOf(double value); static Expression valueOf(@Nonnull String expression); Expression init(@Nonnull NumericWrapper numericWrapper); static void separateSign(MathML element, Generic generic); int size(); Literal literal(int n); JsclInteger coef(int n); Expression add(@Nonnull Expression that); @Nonnull Generic add(@Nonnull Generic that); Expression subtract(Expression expression); @Nonnull Generic subtract(@Nonnull Generic that); Expression multiply(Expression expression); @Nonnull Generic multiply(@Nonnull Generic that); @Nonnull Generic divide(@Nonnull Generic that); Generic[] divideAndRemainder(Generic generic); Generic gcd(@Nonnull Generic generic); @Nonnull Generic gcd(); @Nonnull Literal literalScm(); Generic negate(); int signum(); int degree(); Generic antiDerivative(@Nonnull Variable variable); Generic derivative(@Nonnull Variable variable); Generic substitute(@Nonnull final Variable variable, final Generic generic); Generic expand(); Generic factorize(); Generic elementary(); Generic simplify(); Generic numeric(); @Nonnull Generic valueOf(@Nonnull Generic generic); @Nonnull Generic[] sumValue(); @Nonnull Generic[] productValue(); Power powerValue(); Expression expressionValue(); @Override boolean isInteger(); JsclInteger integerValue(); @Override double doubleValue(); Variable variableValue(); Variable[] variables(); boolean isPolynomial(@Nonnull Variable variable); boolean isConstant(@Nonnull Variable variable); JsclVector grad(Variable variable[]); Generic laplacian(Variable variable[]); Generic dalembertian(Variable variable[]); int compareTo(Expression expression); int compareTo(@Nonnull Generic generic); String toString(); String toJava(); void toMathML(MathML element, @Nullable Object data); @Nonnull @Override Set<? extends Constant> getConstants();  }