Add aliases to Python so "_." prefix no longer needed, update documentation
This commit is contained in:
parent
a9575e64e4
commit
f81db07bf1
@ -193,7 +193,7 @@ public class CodeRunner {
|
||||
.getResourceAsStream("functions."+lang)));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
text += line;
|
||||
text += line+"\n";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
@ -243,6 +243,16 @@ public class Functions {
|
||||
return item;
|
||||
}
|
||||
|
||||
// Fix for Python reserved word "global"
|
||||
public static void setglobal(String name, Object var) {
|
||||
global(name, var);
|
||||
}
|
||||
|
||||
// Fix for Python reserved word "global"
|
||||
public static void getglobal(String name) {
|
||||
global(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all the GLOBALS.
|
||||
*/
|
||||
|
@ -80,7 +80,7 @@
|
||||
</Property>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code=""Version "+MainGUI.VERSION_NAME" type="code"/>
|
||||
<Connection code=""<html><b>Version "+MainGUI.VERSION_NAME+"</b>"" type="code"/>
|
||||
</Property>
|
||||
<Property name="verticalAlignment" type="int" value="1"/>
|
||||
</Properties>
|
||||
|
@ -111,7 +111,7 @@ public class SplashScreen extends javax.swing.JFrame {
|
||||
|
||||
jLabel1.setFont(MainGUI.ubuntuRegular.deriveFont(18.0F));
|
||||
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel1.setText("Version "+MainGUI.VERSION_NAME);
|
||||
jLabel1.setText("<html><b>Version "+MainGUI.VERSION_NAME+"</b>");
|
||||
jLabel1.setVerticalAlignment(javax.swing.SwingConstants.TOP);
|
||||
jLayeredPane1.add(jLabel1);
|
||||
jLabel1.setBounds(200, 110, 130, 30);
|
||||
|
@ -1,42 +1,36 @@
|
||||
'''def notify(msg):
|
||||
def notify(msg):
|
||||
_.notify(msg)
|
||||
|
||||
def ask(msg):
|
||||
return _.ask(msg)
|
||||
|
||||
def diff(fun,var):
|
||||
return _.diff(fun,var)
|
||||
|
||||
def integrate(fun,var):
|
||||
return _.integrate(fun,var)
|
||||
|
||||
def rad(num):
|
||||
return _.rad(num)
|
||||
|
||||
def deg(num):
|
||||
return _.deg(num)
|
||||
|
||||
def subs(fun,var):
|
||||
return _.subs(fun,var)
|
||||
|
||||
def plot():
|
||||
_.plot()
|
||||
|
||||
def plot(fun):
|
||||
_.plot(fun)
|
||||
|
||||
def plotname(fun):
|
||||
_.plotname(fun)
|
||||
|
||||
def plotname():
|
||||
return _.plotname()
|
||||
|
||||
def xlim(min,max):
|
||||
_.xlim(min,max)
|
||||
|
||||
def plotclr():
|
||||
_.plotclr()
|
||||
|
||||
def drawdot(x, y):
|
||||
_.drawdot(x, y)
|
||||
'''
|
||||
def simplify(expr):
|
||||
return _.simplify(expr)
|
||||
def vpa(expr):
|
||||
return _.vpa(expr)
|
||||
def setglobal(key,val):
|
||||
_.setglobal(key,val)
|
||||
def getglobal(key):
|
||||
return _.getglobal(key)
|
@ -12,6 +12,10 @@
|
||||
<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>simplify("expr")</b> Simplifies the given expression.
|
||||
<br><b>vpa("expr")</b> Attempts to find the numerical value of "expr".
|
||||
<br><b>global("name",value)</b> Sets global variable "name" to value.
|
||||
<br><b>global("name")</b> Gets the global variable with id "name".
|
||||
<br><b>replace("text", "find", "replace")</b> Returns "text" with all occurrences of "find" changed to "replace".
|
||||
<br><b>subs("function", "var", "replace")</b> Replaces all occurrences of "var" with "replace" and solves.
|
||||
Returns the answer or 0.0 if there is no numerical answer.
|
||||
|
@ -6,12 +6,8 @@
|
||||
<h1>Code Editor</h1>
|
||||
<p>The code editor allows you to make scripts that can do many things.
|
||||
<br>Scripts can be written in JavaScript or in Python.
|
||||
<br>To switch languages, use the Language option on the Edit menu.
|
||||
<br>To switch languages, use the Language option on the Run menu.
|
||||
</p>
|
||||
<p><i><b>Note:</b>
|
||||
Python scripts require
|
||||
<span style="font-family: monospace;">_.</span>
|
||||
before SyMAT commands.</i></p>
|
||||
<h2>Exporting Code</h2>
|
||||
<p>You can export syntax-highlighted (colored) code to
|
||||
HTML or PDF with the Export tool. This is useful for generating
|
||||
|
@ -5,6 +5,10 @@ integrate('',"x")|Find the integral of the function passed with respect to the s
|
||||
rad(0)|Convert a given number in degrees to radians.
|
||||
deg(0)|Convert a given number in radians to degrees.
|
||||
subs('',"x")|Solve an equation for the second argument.
|
||||
simplify('')|Simplify the given function.
|
||||
vpa('')|Computes numerical value or simplifies.
|
||||
setglobal("", obj)|Set global variable with the given id.
|
||||
getglobal("")|Get global variable with the given id.
|
||||
plot()|Show the plot window.
|
||||
plot('')|Graph the given function.
|
||||
plotname("")|Sets the title of the graph window.
|
||||
|
@ -1,17 +1,21 @@
|
||||
_.notify("")|Display a message in a box.
|
||||
_.ask("")|Ask a question in a box. Supply question text.
|
||||
_.diff('',"x")|Find the derivative of the function passed with respect to the second argument.
|
||||
_.integrate('',"x")|Find the integral of the function passed with respect to the second argument.
|
||||
_.rad(0)|Convert a given number in degrees to radians.
|
||||
_.deg(0)|Convert a given number in radians to degrees.
|
||||
_.subs('',"x")|Solve an equation for the second argument.
|
||||
_.plot()|Show the plot window.
|
||||
_.plot('')|Graph the given function.
|
||||
_.plotname("")|Sets the title of the graph window.
|
||||
_.plotname()|Gets the title of the graph window.
|
||||
_.xlim(min,max)|Sets the x-axis min and max values. Cannot be used after a formula has been graphed.
|
||||
_.plotclr()|Reset the graph.
|
||||
_.drawdot(x, y)|Places a dot at the given coordinates.
|
||||
notify("")|Display a message in a box.
|
||||
ask("")|Ask a question in a box. Supply question text.
|
||||
diff('',"x")|Find the derivative of the function passed with respect to the second argument.
|
||||
integrate('',"x")|Find the integral of the function passed with respect to the second argument.
|
||||
rad(0)|Convert a given number in degrees to radians.
|
||||
deg(0)|Convert a given number in radians to degrees.
|
||||
subs('',"x")|Solve an equation for the second argument.
|
||||
plot()|Show the plot window.
|
||||
plot('')|Graph the given function.
|
||||
plotname("")|Sets the title of the graph window.
|
||||
plotname()|Gets the title of the graph window.
|
||||
xlim(min,max)|Sets the x-axis min and max values. Cannot be used after a formula has been graphed.
|
||||
plotclr()|Reset the graph.
|
||||
drawdot(x, y)|Places a dot at the given coordinates.
|
||||
simplify('')|Simplify the given function.
|
||||
vpa('')|Computes numerical value or simplifies.
|
||||
global("", obj)|Set global variable with the given id.
|
||||
global("")|Get global variable with the given id.
|
||||
fabs(0)|Absolute value of number.
|
||||
asin(0)|
|
||||
acos(0)|
|
||||
|
Loading…
x
Reference in New Issue
Block a user