Programming can facilitate many tasks in them including Mathematics, although many will know that there are libraries that are imported into our Java Project where there are a set of Classes, which have a series of Methods and Attributes. In short, these libraries contain codes that facilitate us in the elaboration of the Project.
WE WILL USE THE VERSION: jep-java-3.4-trial.jar Download
1. IMPORT LIBRARY JEP.
2. INSERT JAVA CODE.
*For example we will solve this mathematical exercise: "sin(x^2) + x" cuando x =25
2. INSERT JAVA CODE.
*For example we will solve this mathematical exercise: "sin(x^2) + x" cuando x =25
package Ejemplos;
import com.singularsys.jep.JepException;
import org.nfunk.jep.JEP;
public class Evaluar_Funcion {
public static void main(String[] args) throws JepException {
JEP j = new JEP();
j.addStandardConstants();
j.addStandardFunctions();
j.addVariable("x", 25); //("variable", numero a evaluar)
j.parseExpression("sin(x^2)+x");
//Si existiere algun error.
if(j.hasError()){
System.out.println(j.getErrorInfo()); // Imprimir error.
}
System.out.println(j.getValue()); //Imprimir resultado.
}
}


