All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jscl.math.operator.Derivative Maven / Gradle / Ivy

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy