jscl.math.operator.Derivative Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jscl Show documentation
Show all versions of jscl Show documentation
java symbolic computing library and mathematical editor
The newest version!
package jscl.math.operator;
import jscl.math.Generic;
import jscl.math.JSCLInteger;
import jscl.math.NotIntegerException;
import jscl.math.Variable;
public class Derivative extends Operator {
public Derivative(Generic expression, Generic variable, Generic value, Generic order) {
super("d",new Generic[] {expression,variable,value,order});
}
public Generic compute() {
Variable variable=parameter[1].variableValue();
try {
int n=parameter[3].integerValue().intValue();
Generic a=parameter[0];
for(int i=0;i");
b.append(derivationToMathML());
b.append(parameter[2].toMathML());
b.append("");
} else {
b.append(derivationToMathML());
}
return b.toString();
}
String derivationToMathML() {
Variable v=parameter[1].variableValue();
StringBuffer b = new StringBuffer();
b.append("");
b.append(parameter[3].toMathML());
b.append(" ");
b.append(v.toMathML());
b.append(" ");
b.append(parameter[0].toMathML());
b.append(" ");
return b.toString();
}
protected Variable newinstance() {
return new Derivative(null,null,null,null);
}
}