jscl.math.function.Root 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.function;
import jscl.math.Antiderivative;
import jscl.math.Generic;
import jscl.math.JSCLInteger;
import jscl.math.NotIntegerException;
import jscl.math.NotIntegrableException;
import jscl.math.NumericWrapper;
import jscl.math.TechnicalVariable;
import jscl.math.Variable;
import jscl.math.polynomial.Polynomial;
import jscl.math.polynomial.UnivariatePolynomial;
import jscl.util.ArrayComparator;
public class Root extends Algebraic {
protected Generic subscript;
public static Generic[] apply(Generic parameter[]) {
Generic element[]=new Generic[parameter.length-1];
for(int i=0;i0;
for(int i=0;i0;
for(int i=1;i0) return 1;
else {
Root v=(Root)variable;
c=ArrayComparator.comparator.compare(parameter,v.parameter);
if(c<0) return -1;
else if(c>0) return 1;
else return subscript.compareTo(v.subscript);
}
}
public static Generic sigma(Generic parameter[], int n) {
Sigma s=new Sigma(parameter,n);
s.compute();
return s.getValue();
}
public String toString() {
StringBuffer buffer=new StringBuffer();
buffer.append(name);
buffer.append("[").append(subscript).append("]");
buffer.append("(");
for(int i=0;i");
b.append(new Constant(name,0,new Generic[] {subscript}).toMathML());
for(int i=0;i");
return b.toString();
}
protected Variable newinstance() {
return new Root(new Generic[parameter.length],null);
}
}
class Sigma {
Generic root[];
Generic generic;
boolean place[];
int n;
Sigma(Generic parameter[], int n) {
root=new Generic[parameter.length-1];
for(int i=0;i0) {
for(int i=p;i