MathExt 0.6.3 γ
Documentation
You need to activate JavaScript in order to use the documentation interactively.
0

Contents
  1. Getting Started
    1. Introduction
    2. About MathExt
    3. Hello World
    4. Changelog
  2. Nomenclature
    1. Arithmetic Precision
    2. Error Handling
    3. Fraction
    4. Power of Ten
    5. Power of Ten Limits
    6. Priorities
    7. Radian and Degree
    8. Radix Char
    9. Separators
    10. Thousands Separator
    11. Input Types
    12. Localisations
    13. Variables
  3. MathExt.Load
  4. API Reference
  5. API Reference (private)
Getting Started
Introduction

Welcome to the MathExt JavaScript library.

This library was made to parse and calculate mathematical formulas of any kind and any complexity. It can easily be integrated into websites and web applications. As developer you can set all kind of settings. You can even specify what commands (» Actions) should be available to the user and in what priority they should be proceeded. The client's web browser just needs to be ECMA-262 3rd edition (= JavaScript 1.5) compliant.

About MathExt

The MathExt project has been developed by Lars Knickrehm.

If you like MathExt, please donate to help keeping its development active. Thanks!

MathExt is offered as free open source library and can be used, modified and redistributed under the terms of the GNU Affero General Public License Version 3 (AGPL3). If you want to use MathExt in a closed source project, please do not hesitate to contact me via mail.

You can download the latest version of MathExt, report bugs or ask for help at the project's page, which is hosted for free by SourceForge.net. This documentation uses the open source projects SyntaxHighlighter and ExplorerCanvas.

Hello World

Setting up MathExt is quite simple. Just follow these steps and you can already use MathExt including all default commands.

  • First you need to load the MathExt class. It is somewhat the kernel of MathExt. So just put the following piece of code into your html source:

    <script src="MathExt.Class.min.js" type="text/javascript"></script>

    Now your page is already loading the MathExt class code.

  • Next you need to load the actions. To do so do the same as before, but select the actions class and load function:

    <script src="MathExt.Actions.min.js" type="text/javascript"></script>
    <script src="MathExt.Load.min.js" type="text/javascript"></script>

    The order of these JavaScript files can be what ever you want. I like to sort them alphabetically...

  • The function MathExt.Load initializes a new MathExt.Class object for you and it loads all defined functions from the MathExt.Actions class. So let us run that command:

    <script type="text/javascript">
    	var oMathExt = MathExt.Load();
    </script>

    This piece of code needs to be used after loading the JavaScript files.

    I recommend you to define MathExt.Class objects globally to keep user created variables available for further calculations.

  • To execute a calculation you just need to call oMathExt.Calculate now. After this paragraph you can find a really simple example, which calculates the value of a textbox on submitting.

<html>
	<head>
		<script src="MathExt.Actions.min.js" type="text/javascript"></script>
		<script src="MathExt.Class.min.js" type="text/javascript"></script>
		<script src="MathExt.Load.min.js" type="text/javascript"></script>
		<script type="text/javascript">
			var oMathExt = MathExt.Load();
			
			function fOnSubmit() {
				var sInput = document.getElementById('input').value;
				document.getElementById('output').innerHTML = oMathExt.Calculate(sInput);
			}
		</script>
	</head>
	<body>
		<form onsubmit="fOnSubmit(); return false;">
			<input id="input" value="" />
			<input type="submit" value=" = " />
			<div id="output">0</div>
		</form>
	</body>
</html>
Changelog
Version 0.6.1
  • Actions
    • Fixed some source comments.
  • Class
    • Added new localisations system.
    • Added MathExt.Class.Private [function].
    • Changed MathExt.Class.Settings.Input.Separators.Get [function]: It returns an array instead of an object now.
    • Changed MathExt.Class.Settings.Input.ThousandsSeparators.Get [function]: It returns an array instead of an object now.
    • Fixed MathExt.Class.Settings.Input.Separators.Remove [function].
    • Fixed some source comments.
    • Removed old translations system.
  • Documentation
    • Added index.html file.
    • Added chapter "MathExt.Load".
    • Added chapter "API Reference (private)".
    • Added changelog.
    • Added minimizable graph feature.
    • Added updated content.
    • Changed location of scripts and styles.
    • Fixed a lot graph realted and general style problems.
  • Load
    • Added action "set".
    • Added constant alias "yp".
    • Added usage of oClass.Settings.Output.Signs [function].
    • Fixed converting from and to "sm".
    • Fixed some source comments.
    • Removed action "¹".
  • Localisations
    • Added Arabic localisation.
    • Added Catalan localisation.
    • Added French localisation.
    • Added German localisation.
    • Added Italian localisation.
    • Added Portuguese localisation.
    • Added Romanian localisation.
    • Added Serbian localisation.
    • Added Spanish localisation.
    • Added Swedish localisation.
Version 0.6.2
  • Class
    • Added possibility to set PowerOfTen output limits.
    • Added fraction and mixed output.
    • Added priv.Tools.Tools.CheckInfinity [function] to check numbers for infinity and automatically throw an error.
    • Rewrote priv.Tools.Convert.ToString [function] for better and faster converting.
    • Rewrote MathExt.Class.Settings.Output.Signs [function] to get better output options. It is backward compatible!
    • Fixed wrong handling of negative values or zero as input of MathExt.Class.Settings.Output.ArithmeticPrecision [function].
  • Documentation
    • Rewrote the canvas graph from scratch.
    • Added new objects.
    • Fixed some mistakes.
  • Load
    • Added "gcd" as function for the greatest common divisor.
    • Added "lcm" as function for the least common multiple.
    • Changed the array handling behaviour of "set" to support arrays in variables.
    • Updated list of input signs.
    • Removed usage of oClass.Settings.Output.Signs [function] for compatibility reasons.
  • Localisations
    • Added Vietnamese localisation.
    • Updated German localisation.
Version 0.6.3
  • Documentation
Nomenclature

In the MathExt project some words are used, which can be ambiguous or even unknown to some developers. They are explained in the paragraphs below. But it is recommended for all developers to read these explanations!

Arithmetic Precision

Mathematical information can be found at Wikipedia in Arithmetic precision.

To simplify the MathExt output it can cut off decimals until a given number. You can enable its arithmetic precision using MathExt.Class.Settings.Output.ArithmeticPrecision [function].

Note: MathExt saves the exact number instead of its output in the answer memory.

Error Handling

MathExt handles error messages in an own object, which can be handled by using the functions in MathExt.Class.Errors [namespace]. Optionally you can enable logging to user defined functions (» Functions), the browser's console (» Console) or an alert message box (» Alert).

Fraction

Mathematical information can be found at Wikipedia in Fraction (mathematics).

MathExt allows you to choose between three different states of the Fraction setting. You can change them using the Fraction function.

  1. Decimal: 1.2
  2. Fraction: 6⁄5
  3. Mixed: 1 + 1⁄5

Power of Ten

Mathematical information can be found at Wikipedia in Powers of 10.

Most calculators use EXP or E for this feature. The "Power of Ten" is just a short form of 10 ^ and quite often used in physics while processing big and small numbers.

If you use MathExt.Load [function] to create a new MathExt class, E is loaded as function for "Power of Ten".
Note: e is not "Power of Ten", but Euler's number, a constant!

Power of Ten Limits

The Power of Ten feature is just used, if the exponent is smaller or higher than a specified value. MathExt allows you to change these values just as you like it.

PowerOfTenLimits requires two arguments. The first one specifies until what value negative exponents are created. The second one affects positive exponents.

For default MathExt uses 7 and 14. Here are some examples:

  • Entering 0.000001 returns 0.000001.
  • Entering 0.0000001 returns 1E-7.
  • Entering 10000000000000 returns 10000000000000.
  • Entering 100000000000000 returns 1E14.

Priorities

To calculate things in the right order, MathExt has integrated support for priorities of actions, which require at least one argument before and one argument after their expression.

The following list shows you in what order input types and actions are handled.

  • Brackets and constants
  • Argument(s) before action (Example: !)
  • Action before argument(s) (Example: sin)
  • Arguments before and after an expression:
    • Power (^)
    • Arguments before and after the action (action; Example: mod)
    • Multiply and divide (*/)
    • Plus and minus (+-)
    • Equals sign (=)

MathExt.Class.Settings.Actions.Add [function] allows you to define what priority your actions with arguments before and after the expression should be in.

Radian and Degree

Mathematical information can be found at Wikipedia in Radian and Degree (angle).

The default angle unit is radian. It can be changed to degree if needed. Though you can pass degree values followed by °. Then the degree value gets converted into radian.

You can specify the default angle unit by using MathExt.Class.Settings.Input.Radian [function].

Radix Char

MathExt allows you to change the used input and output radix char. The radix char can change in different localisations.

  • English: 123,456.789
  • German: 123.456,789
Separators

Separators can be used in different situations:

  • Passing more than one argument to an action. Example: round(1.235; 2) returns 1.24.
  • Separating different calculations from each other. Example: 1 + 2; 3 − 4 returns 3; −1
  • You can even separate different parts in a calculation. Example: 5 × (6; 7) returns 30; 35

Note: You can set multiple input separators, but just one output separator.

Thousands Separator

To simplify reading big numbers, MathExt allows you to change the input and output thousands separators. The thousands separators can change in different localisations.

  • English: 123,456.789
  • German: 123.456,789

Note: It is possible to specify more than one input thousands separator. By default the output thousands separator is empty.

Input Types

In the MathExt documentation and code the following phrases are used to specify the different input types.

Note: Some input types combine different functionalities. Others are handled as subtypes of an upper rated input type.

Absolute Value

Mathematical information can be found at Wikipedia in Absolute value.

Absolute values can be inserted using its specified characters. They get calculated and then handled just like brackets. Example: |−8| returns 8.

Action

In MathExt user defined constants and functions are called action. Some actions require arguments before and / or after its expression in the formula. There are four different action types:

Before After Description
false false Constants such as e and pi do not require any arguments.
false true The default way to define functions is this one. Most functions require arguments after the expression. Example: sin
true false A small number of functions even require arguments in front of the expression. Example: !
true true Some functions require arguments before and after the expression. Example: mod

Read about the priority order of actions in the part about Priorities.

Bracket

Mathematical information can be found at Wikipedia in Bracket (mathematics).

In order to simplify the usage of brackets in mathematical formulas, MathExt supports different brackets and corrects missing brackets.

  • Not closed bracket: 2 × (3 + 4 returns 2 × (3 + 4) = 14.
  • Not opened bracket: 2 + 3) × 4 returns (2 + 3) × 4 = 20.

MathExt.Load registers three bracket character pairs: (), [] and {}. To change the registered bracket characters you can use the functions of MathExt.Class.Settings.Brackets.

Number

MathExt supports numbers, which contain thousands separators and a radix char.

Note: Other calculators handle 1.2E-3 as number, but MathExt creates the number object 1.23 first and multiplies it with the result of E-3, which is 0.001 in this case. That just works if the action E is loaded. If you use MathExt.Load it is done automatically.

Note: The minimum and maximum values of a number and the closest number to zero should be the same in all environments, but they even could be different.

Sign

The five basic actions Plus and Minus, Multiply and Divide and Power can be called using single characters, which have a higher priority as normal text.

Example: 1 +sin 90° returns 2. It calls the function sin instead of +sin, which could be called if + is not a registered sign.

String

It is possible to pass strings to actions. Example: "text" returns text.

Note: If the ending character needs to be inside of the string itself, it needs to be typed two times. Example: "a""b" returns a"b.

Localisations

MathExt allows you to localise your classes. A localisation translates the originally English error messages and changes some region specific settings for the in- and output of a MathExt class.

Variables

Variables can be specified while calculating. Afterwards they can be used to simplify a lot formulas. Variables are saved in the current MathExt class. New classes do not have any registered variables. To use variables MathExt.Load needs to be used.

To set variables you can use the action set or the equal sign: set("a"; 123) or "a" = 123

If you need to get variables back, just use get or ?: get("a") or "a"?

MathExt.Load

The following paragraphs show you, what expressions can be used after loading MathExt.Load. Please go to the API Reference to learn more about its technical usage.

Actions

This list represents all available actions, which can be used in mathemtical expressions.

Action Symbols Notes
Absolute value abs
Answer ans
Area hyperbolic cosecant arcsch
Area hyperbolic cosine arcosh
Area hyperbolic cotangent arcoth
Area hyperbolic secant arsech
Area hyperbolic sine arsinh
Area hyperbolic tangent artanh
Average Ø, ø, ave
Binary logarithm lb Base: 2
Binomial coefficient ncr
Centi c × 10 ^ (−2)
Common logarithm lg Base: 10
Constant const
Convert conv
Cosecant csc
Cosine cos
Cotangent cot
Count count
Cube ³
Deca da × 10 ^ (+1)
Deci d × 10 ^ (−1)
Degree °
Euler's number e Constant
Factorial !
Femto f × 10 ^ (−15)
Five eight Constant: 0.625
Gamma Г, gamma
Get ?, get
Giga G × 10 ^ (+9)
Greatest common divisor gcd
Half ½ Constant: 0.5
Hecto h × 10 ^ (+2)
Hyperbolic cosecant csch
Hyperbolic cosine cosh
Hyperbolic cotangent coth
Hyperbolic secant sech
Hyperbolic sine sinh
Hyperbolic tangent tanh
Inverse cosecant acsc, arccsc
Inverse cosine acos, arccos
Inverse cotangent acot, arccot
Inverse secant asec, arcsec
Inverse sine asin, arcsin
Inverse tangent atan, arctan
Kilo k × 10 ^ (+3)
Least common multiple lcm
Logarithm log
Mega M × 10 ^ (+6)
Micro µ, μ × 10 ^ (−6)
Milli m × 10 ^ (−3)
Modulo mod
Nano n × 10 ^ (−9)
Natural logarithm ln Base: e
One eight Constant: 0.125
Per mil × 10 ^ (−3)
Percentage % × 10 ^ (−2)
Permutation npr
Peta P × 10 ^ (+15)
Pi π, pi Constant
Pico p × 10 ^ (−12)
Plus-minus ±
Power of ten E Base: 10
Product ∏, Π, product
Quarter ¼ Constant: 0.25
Radian rad
Random ran, random
Root √, root
Round rnd, round
Secant sec
Square ²
Set =, set
Seven eight Constant: 0.875
Sine sin
Square root sqrt Degree: 2
Summation Σ, ∑, sum
Tangent tan
Terra T × 10 ^ (+12)
Three eight Constant: 0.375
Three fourth ¾ Constant: 0.75
Brackets

Please continue reading here.

Physical Constants

The following symbols can be used as arguments for the action const to easily get the value of a required pysical constant.

Example: const('c') returns 299792458.

Quantity Symbol(s) Value
Reduced Planck constant ħ 1.054571628 × 10 ^ -34
Magnetic flux quantum Φ0 2.067833667 × 10 ^ -15
Fine-structure constant α 0.0072973525376
Gyromagnetic ratio γp (yp) 267522209.9
Stefan–Boltzmann constant σ 5.6704 × 10 ^ -8
Magnetic constant (vacuum permeability) μ0 (µ0) 1.2566370614 × 10 ^ -6
Bohr magneton μB (µB) 9.27400915 × 10 ^ -24
Magnetic moment (electron) μe (µe) -9.28476377 × 10 ^ -24
Nuclear magneton μN (µN) 5.05078324 × 10 ^ -27
Magnetic moment (proton) μp (µp) 1.410606662 × 10 ^ -26
Electric constant (vacuum permittivity) ε0 8.85418781762 × 10 ^ -12
Bohr radius a0 5.2917720859 × 10 ^ -11
Atomic mass unit amu, mu, u 1.660538782 × 10 ^ -27
Standard atmosphere atm, n0, NL 1.01325
Speed of light c, c0 299792458
c1 3.74177118 × 10 ^ -16
c2 0.014387752
Elementary charge e 1.602176487 × 10 ^ -19
Faraday constant F 96485.3399
Gravitational constant G 6.67428 × 10 ^ -11
Planck constant h 6.62606896 × 10 ^ -34
Boltzmann constant k, kB 1.3806504 × 10 ^ -23
Avogadro constant L, NA 6.02214179 × 10 ^ 23
Rest mass (electron) me 9.10938215 × 10 ^ -31
Rest mass (neutron) mn 1.674927211 × 10 ^ -27
Rest mass (proton) mp 1.672621637 × 10 ^ -27
Gas constant R, R0 8.314472
Rydberg constant R∞ (R8) 10973731.568527
Classical electron radius re 2.8179402894 × 10 ^ -15
Absolute zero (temperature) t, T0 273.15
Signs

I guess most users use the default plus and minus, multiply and divide and power characters, but some calculators (such as the one at top) need to use other, more mathematical looking characters. This table lists all signs, which are registered by MathExt.Load. The first character is always the default one.

Plus
+
Minus
-
U+2212
Multiply
*
× U+00D7
U+2715
U+2716
U+u22C5
U+2219
U+2217
U+2062
Divide
/
: U+003A
÷ U+00F7
÷ U+2215
÷ U+2044
Power
^
Units

The following units can be used to convert values. The units can be combined in any way for each category. The first unit of each category represents the default SI unit. Internally values will be converted to that unit before converting to the required output value.

Example: conv("m/s"; "km/h"; 1) returns 3.6.

It is possible to convert more than one value at the same time. You just need to add more arguments to the action call.

Example: conv("m/s"; "km/h"; 1; 2; 3) returns 3.6; 7.2; 10.8.

Energy
J Joule
cal Calorie
Length
m Metre
ft Foot
in Inch
mile Mile
sm Nautical mile
yd Yard
Mass
g Gram
lb Pound
Pressure
Pa Pascal
bar Bar
psi Pounds per square inch
Power
W Watt
PS Pferdestärke
Speed
m/s Metres per second
km/h Kilometres per hour
Temperature
K Kelvin
°C Celsius
°F Fahrenheit
Volume
Cubic metre
gal Imperial (UK) gallon
l Litre
API Reference

This part of the documentation is not finished, yet.

The API Reference is a full documentation for all public objects, which can be used to handle MathExt and MathExt classes.

MathExt [namespace]
Load [function]

This function registers a lot stuff, which is used in scientific calculators. A full list of registered functions can be found here.

Optionally you can pass two arguments to MathExt.Load. These arguments are just needed if you manually changed the object names of the MathExt.Class and MathExt.Actions object.

  • oClass - MathExt.Class object
  • oActions - MathExt.Actions object
Actions [class]

ArcusCoSecant [function]

Mathematical information can be found at Wikipedia in Inverse trigonometric functions.

ArcusCoSine [function]

Mathematical information can be found at Wikipedia in Inverse trigonometric functions.

ArcusCoTangent [function]

Mathematical information can be found at Wikipedia in Inverse trigonometric functions.

ArcusSecant [function]

Mathematical information can be found at Wikipedia in Inverse trigonometric functions.

ArcusSine [function]

Mathematical information can be found at Wikipedia in Inverse trigonometric functions.

ArcusTangent [function]

Mathematical information can be found at Wikipedia in Inverse trigonometric functions.

AreaHyperbolicCoSecant [function]

Mathematical information can be found at Wikipedia in Inverse hyperbolic function.

AreaHyperbolicCoSine [function]

Mathematical information can be found at Wikipedia in Inverse hyperbolic function.

AreaHyperbolicCoTangent [function]

Mathematical information can be found at Wikipedia in Inverse hyperbolic function.

AreaHyperbolicSecant [function]

Mathematical information can be found at Wikipedia in Inverse hyperbolic function.

AreaHyperbolicSine [function]

Mathematical information can be found at Wikipedia in Inverse hyperbolic function.

AreaHyperbolicTangent [function]

Mathematical information can be found at Wikipedia in Inverse hyperbolic function.

Average [function]

Mathematical information can be found at Wikipedia in Arithmetic mean.

BinomialCoefficient [function]

Mathematical information can be found at Wikipedia in Binomial coefficient.

Constant [function]

Mathematical information can be found at Wikipedia in Physical constant.

Convert [function]

Mathematical information can be found at Wikipedia in Conversion of units.

CoSecant [function]

Mathematical information can be found at Wikipedia in Trigonometric functions.

CoSine [function]

Mathematical information can be found at Wikipedia in Trigonometric functions.

CoTangent [function]

Mathematical information can be found at Wikipedia in Trigonometric functions.

Count [function]

Degree [function]

Mathematical information can be found at Wikipedia in Degree (angle).

Factorial [function]

Mathematical information can be found at Wikipedia in Factorial.

Gamma [function]

Mathematical information can be found at Wikipedia in Gamma function.

Get [function]

Logarithm [function]

Mathematical information can be found at Wikipedia in Logarithm.

HyperbolicCoSecant [function]

Mathematical information can be found at Wikipedia in Hyperbolic function.

HyperbolicCoSine [function]

Mathematical information can be found at Wikipedia in Hyperbolic function.

HyperbolicCoTangent [function]

Mathematical information can be found at Wikipedia in Hyperbolic function.

HyperbolicSecant [function]

Mathematical information can be found at Wikipedia in Hyperbolic function.

HyperbolicSine [function]

Mathematical information can be found at Wikipedia in Hyperbolic function.

HyperbolicTangent [function]

Mathematical information can be found at Wikipedia in Hyperbolic function.

Modulo [function]

Mathematical information can be found at Wikipedia in Modulo operation.

Permutation [function]

Mathematical information can be found at Wikipedia in Permutation.

PlusMinus [function]

Mathematical information can be found at Wikipedia in Plus-minus sign.

Product [function]

Mathematical information can be found at Wikipedia in Product (mathematics).

Radian [function]

Mathematical information can be found at Wikipedia in Radian.

Random [function]

Root [function]

Mathematical information can be found at Wikipedia in nth root.

Round [function]

Mathematical information can be found at Wikipedia in Rounding.

Secant [function]

Mathematical information can be found at Wikipedia in Trigonometric functions.

Set [function]

Sine [function]

Mathematical information can be found at Wikipedia in Trigonometric functions.

Summation [function]

Mathematical information can be found at Wikipedia in Summation.

Tangent [function]

Mathematical information can be found at Wikipedia in Trigonometric functions.

Settings [namespace]
GammaAccuracy [function]

Constants [namespace]
Add [function]

Clear [function]

Get [function]

Remove [function]

Units [namespace]
Add [function]

Clear [function]

Get [function]

Remove [function]

Variables [namespace]
Add [function]

Clear [function]

Get [function]

Remove [function]

Class [class]

Calculate [function]

Private [function]

Errors [namespace]
Clear [function]

Get [function]

GetAll [function]

GetArray [function]

Settings [namespace]
Localisation [function]

Actions [namespace]
Add [function]

Clear [function]

Get [function]

Remove [function]

Brackets [namespace]

Mathematical information can be found at Wikipedia in Bracket (mathematics).

Add [function]

Clear [function]

Get [function]

Remove [function]

Errors [namespace]
Alert [function]

Console [function]

Functions [namespace]
Add [function]

Clear [function]

Get [function]

Remove [function]

Input [namespace]
Radian [function]

Mathematical information can be found at Wikipedia in Radian.

RadixChar [function]

Mathematical information can be found at Wikipedia in Decimal separator.

Separators [namespace]
Add [function]

Clear [function]

Get [function]

Remove [function]

Signs [namespace]
Add [function]

Clear [function]

Get [function]

Remove [function]

ThousandsSeparators [namespace]
Add [function]

Clear [function]

Get [function]

Remove [function]

Output [namespace]
ArithmeticPrecision [function]

Mathematical information can be found at Wikipedia in Arithmetic precision.

Fraction [function]

Mathematical information can be found at Wikipedia in Fraction (mathematics).

PowerOfTen [function]

Mathematical information can be found at Wikipedia in Powers of 10.

PowerOfTenLimits [function]

RadixChar [function]

Mathematical information can be found at Wikipedia in Decimal separator.

Separator [function]

Signs [function]

ThousandsSeparator [function]
Localisations [namespace]

MathExt.Class.Settings.Localisation [function] can be used to load a MathExt localisation object. To load a MathExt localisation you need to link to its JavaScript file:

<script src="MathExt.Localisations/de.min.js" type="text/javascript"></script>

Afterwards the localisation object can be passed as an argument to MathExt.Class.Settings.Localisation [function]:

<script type="text/javascript">
	oMathExt.Settings.Localisation(MathExt.Localisations.de);
</script>
ar [object]

العربية (Arabic)

ca [object]

Català (Catalan)

de [object]

Deutsch (German)

en [object]

English

es [object]

Español (Spanish)

fr [object]

Français (French)

it [object]

Italiano (Italian)

null [object]

This function should only be used to create new localisations!

  • Create a copy of MathExt.Localisations/null.js.
  • Update the localisation information and change the author.
  • Enter a valid radix character for in- and output and a thousands separator character for the input.
pt [object]

Português (Portuguese)

ro [object]

Română (Romanian)

sr [object]

Cрпски језик (Serbian)

sv [object]

Svensk (Swedish)

vi [object]

Tiếng Việt (Vietnamese)

API Reference (private)

This part of the documentation is not finished, yet.

The private API Reference can be used by action developers. The API is passed as this to all action functions automatically.

It is strongly recommended to take a look at the source code of some action functions of the MathExt.Actions class. They can be used as good and clean development examples for new action functions.

Answer [mixed]

This mixed variable contains the previous calculation result.

Usage example: MathExt.Load registers the variable ans, which can be used in formulas to use the result of the previous calculation.

Errors [array]

This array contains all thrown errors. Every single error array consists of:

  • sFunction: Path and name of the function, which has thrown the error.
  • sType: Error type (usually: Argument, Math, Syntax or Variable)
  • sMessage: Error message
  • aTokens: Tokens array
Settings [namespace]
Actions [object]

Brackets [namespace]

Mathematical information can be found at Wikipedia in Bracket (mathematics).

Close [object]

Open [object]

Errors [namespace]
Alert [boolean]

Console [boolean]

Functions [object]

Input [namespace]
RadixChar [character]

Mathematical information can be found at Wikipedia in Decimal separator.

Radian [string]

Mathematical information can be found at Wikipedia in Radian.

Separators [object]

Signs [object]

ThousandsSeparators [object]

Localisation [namespace]
RadixChar [character]

Mathematical information can be found at Wikipedia in Decimal separator.

ThousandsSeparator [character]

Translations [object]

Output [namespace]
ArithmeticPrecision [number]

Mathematical information can be found at Wikipedia in Arithmetic precision.

Fraction [number]

Mathematical information can be found at Wikipedia in Fraction (mathematics).

PowerOfTen [string]

Mathematical information can be found at Wikipedia in Powers of 10.

PowerOfTenLimits [array]

RadixChar [character]

Mathematical information can be found at Wikipedia in Decimal separator.

Separator [string]

Signs [array]

ThousandsSeparator [character]
Tools [namespace]
Calculate [function]

Convert [namespace]
StringToArray [function]

ToString [function]

Errors [namespace]
Log [function]

Throw [function]

Maths [namespace]
AbsoluteValue [function]

Mathematical information can be found at Wikipedia in Absolute value.

Divide [function]

Mathematical information can be found at Wikipedia in Division (mathematics).

GreatestCommonDivisor [function]

Mathematical information can be found at Wikipedia in Greatest common divisor.

LeastCommonMultiple [function]

Mathematical information can be found at Wikipedia in Least common multiple.

Minus [function]

Mathematical information can be found at Wikipedia in Subtraction.

Multiply [function]

Mathematical information can be found at Wikipedia in Multiplication.

Plus [function]

Mathematical information can be found at Wikipedia in Addition.

Power [function]

Mathematical information can be found at Wikipedia in Exponentiation.

Tools [namespace]
CheckInfinity [function]

Clone [function]

ForEach [function]

ForEach2 [function]

IsPlusMinus [function]

IsWhitespace [function]

PrepareFloat [function]

PrepareFloats [function]

Translate [function]

Types [namespace]

This private namespace owns classes, which are used to convert a formula string into an array. They should not be used by action developers and therefore they are not documentated in any way.