/** * Differentiates an expression tree wrt a variable var. * * @param node the top node of the expression tree * @param var the variable to differentiate wrt * @return the top node of the differentiated expression * @throws ParseException if some error occurred while trying to differentiate, for instance of no * rule supplied for given function. * @throws IllegalArgumentException */ public Node differentiate(Node node, String var, DJep djep) throws ParseException, IllegalArgumentException { this.localDJep = djep; this.nf = djep.getNodeFactory(); this.tu = djep.getTreeUtils(); // this.opSet=djep.getOperatorSet(); if (node == null) throw new IllegalArgumentException("node parameter is null"); if (var == null) throw new IllegalArgumentException("var parameter is null"); Node res = (Node) node.jjtAccept(this, var); return res; }
public Object eval(Node node) throws ParseException { MatrixValueI val = (MatrixValueI) node.jjtAccept(this, null); return val.copy(); }