SyMAT Wiki

Site Tools

code:functions

This is an old revision of the document!

Built-in Functions

SyMAT has many built-in functions. These are available from JavaScript and Python.

Reason: Not all functions are documented yet.

Input/Output/Storage

• notify(message): Display a pop-up box with the given message text and an OK button.
• ask(question): Display a pop-up box with the given question and an input box. Returns a String.
• print(text): Output a line of text to the Output box.
• readfile(filename): Read the contents of the given text file and return the data.
• savefile(filename,data): Write the given text data to a file.
• load(key): Return the text corresponding to the given key.
• save(key,text): Link the given text to the given key.

Simple Math

• add(n,n,n…) OR add(n[]): Add together the given numbers or array of numbers and return the sum.
• subtract(n,n,n…) OR subtract(n[]): Subtract the given numbers or array of numbers and return the difference. Calculates from first number to last (i.e. n1-n2-n3).
• times(n,n,n…) OR times(n[]): Multiply together the given numbers or array of numbers and return the product.
• divide(n,n,n…) OR divide(n[]): Divide the given numbers or array of numbers and return the quotient. Calculates from first number to last (i.e. (n1/n2)/n3).
• mod(n,n,n…) OR mod(n[]): Calculate the modulus of the given numbers or array of numbers and return the result. Calculates from first number to last (i.e. (n1 mod n2) mod n3).
• min(n1,n2,…): Returns the smallest of the given numbers.
• max(n1,n2,…): Returns the largest of the given numbers.
• pow(x,y): Raise x to y (x^y) and return the result.

Trigonometry

• sin(n): Find the sine of the given number in radians.
• cos(n): Find the cosine of the given number in radians.
• tan(n): Find the tangent of the given number in radians.
• asin(n): Find the Arcsine (inverse sine) of the given number.
• acos(n): Find the Arccosine (inverse cosine) of the given number.
• atan(n): Find the Arctangent (inverse tangent) of the given number.
• deg(n): Convert the given radians to degrees.