Rename D() to diff(), add integrate()
This commit is contained in:
parent
10e2b13e59
commit
3174ab585b
@ -28,8 +28,6 @@
|
||||
package net.apocalypselabs.symat;
|
||||
|
||||
import static java.lang.Math.*;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import javax.swing.JOptionPane;
|
||||
import org.matheclipse.core.eval.EvalUtilities;
|
||||
import org.matheclipse.parser.client.math.MathException;
|
||||
@ -42,9 +40,8 @@ import org.matheclipse.parser.client.math.MathException;
|
||||
* @author Skylar
|
||||
*/
|
||||
public class Functions {
|
||||
|
||||
private ScriptEngine symja = new ScriptEngineManager().getEngineByExtension("m");
|
||||
private EvalUtilities util = new EvalUtilities(true, true);
|
||||
|
||||
private final EvalUtilities util = new EvalUtilities(true, true);
|
||||
Graph graphwin = new Graph(true);
|
||||
|
||||
/*
|
||||
@ -63,9 +60,27 @@ public class Functions {
|
||||
*/
|
||||
|
||||
// Derivative of function with respect to idv
|
||||
public String D(String function, String idv) {
|
||||
public String diff(String function, String idv) {
|
||||
return util.evaluate("diff(" + function + "," + idv + ")").toString();
|
||||
}
|
||||
|
||||
public String diff(String function) {
|
||||
// Assume "x" as var
|
||||
return diff(function, "x");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String D(String function, String idv) {
|
||||
return diff(function, idv);
|
||||
}
|
||||
|
||||
public String integrate(String function, String idv) {
|
||||
return util.evaluate("integrate(" + function + "," + idv + ")").toString();
|
||||
}
|
||||
|
||||
public String integrate(String function) {
|
||||
return integrate(function, "x");
|
||||
}
|
||||
|
||||
public String factor(String function) {
|
||||
return sym("Factor(" + function + ")");
|
||||
|
@ -8,7 +8,8 @@
|
||||
<b>notify(var)</b> Creates a popup box with the given content.
|
||||
<br><b>ask(prompt)</b> Returns the entered text.
|
||||
<br><b>print(text)</b> Outputs the given text to the screen. Does not require special prefix in Python.
|
||||
<br><b>D("3*x", "x")</b> Returns the derivative of the function with respect to the second argument.
|
||||
<br><b>diff("x^3", "x")</b> Returns the derivative of the function with respect to the second argument.
|
||||
<br><b>integrate("3*x^2", "x")</b> Returns the integral of the function with respect to the second argument.
|
||||
<br><b>$("command")</b> Parses the given text with the Symja library.
|
||||
<br> <i>Aliases: sym</i>
|
||||
<br><b>replace("text", "find", "replace")</b> Returns "text" with all occurrences of "find" changed to "replace".
|
||||
|
@ -1,6 +1,7 @@
|
||||
notify|return nothing|Display a message in a box.
|
||||
ask|return String|Ask a question in a box. Supply question text.
|
||||
D|return String|Find the derivative of the function passed with respect to the second argument.
|
||||
diff|return String|Find the derivative of the function passed with respect to the second argument.
|
||||
integrate|return String|Find the integral of the function passed with respect to the second argument.
|
||||
rad|return double|Convert a given number in degrees to radians.
|
||||
deg|return double|Convert a given number in radians to degrees.
|
||||
subs|return double|Solve an equation for the second argument.
|
||||
|
@ -1,6 +1,7 @@
|
||||
_.notify|return nothing|Display a message in a box.
|
||||
_.ask|return String|Ask a question in a box. Supply question text.
|
||||
_.D|return String|Find the derivative of the function passed with respect to the second argument.
|
||||
_.diff|return String|Find the derivative of the function passed with respect to the second argument.
|
||||
_.integrate|return String|Find the integral of the function passed with respect to the second argument.
|
||||
radians|return double|Convert a given number in degrees to radians.
|
||||
degrees|return double|Convert a given number in radians to degrees.
|
||||
_.subs|return double|Solve an equation for the second argument.
|
||||
|
Loading…
x
Reference in New Issue
Block a user