@Nonnull public Variable newInstance() { return new Derivative(null, null, null, null); } }
private Derivative(Generic parameters[]) { super(NAME, createParameters(parameters)); }
void derivationToMathML(MathML element, boolean fenced) { if (fenced) { MathML e1 = element.element("mfenced"); derivationToMathML(e1); element.appendChild(e1); } else { derivationToMathML(element); } }
@Override public Generic numeric() { try { parameters[3].integerValue(); return expand().numeric(); } catch (NotIntegerException e) { } return expressionValue(); }
public Generic selfExpand() { if (JsclMathEngine.getInstance().getAngleUnits() != AngleUnit.rad) { JsclMathEngine.getInstance().getMessageRegistry().addMessage(new JsclMessage(Messages.msg_25, MessageType.warning)); } Variable variable = parameters[1].variableValue(); try { int n = parameters[3].integerValue().intValue(); Generic a = parameters[0]; for (int i = 0; i < n; i++) { a = a.derivative(variable); } return a.substitute(variable, parameters[2]); } catch (NotIntegerException e) { } return expressionValue(); }
public void toMathML(MathML element, Object data) { int exponent = data instanceof Integer ? (Integer) data : 1; if (exponent == 1) derivationToMathML(element, false); else { MathML e1 = element.element("msup"); derivationToMathML(e1, true); MathML e2 = element.element("mn"); e2.appendChild(element.text(String.valueOf(exponent))); e1.appendChild(e2); element.appendChild(e1); } MathML e1 = element.element("mfenced"); parameters[0].toMathML(e1, null); if (parameters[2].compareTo(parameters[1]) != 0) parameters[2].toMathML(e1, null); element.appendChild(e1); }
@Nonnull @Override public Operator newInstance(@Nonnull Generic[] parameters) { return new Derivative(parameters); }