In a situation where you need to create a conversion table without polluting the global area, this would be useful. For example:
Math.constructor = function() { var i = 0, unicode = {}, zero_padding = "0000", max = 9999;
Run the constructor to populate it as such:
Math.constructor(); Math.constructor["a"]
Another option would be to extend the properties and methods for defining primitives for a graph library:
root (arg, index) "index-th" root of argument. Example: root (x, 6) sixth root of x, root [tan (x), 4] fourth root of the tangent of x.
sqrt () Square root of argument (number or expression inside the parentheses). Equivalent to root (argument, 2)
cbrt () Cube root of argument. Equivalent to root (argument, 3)
logn (arg, base) Logarithm base-base of arg.
ln () Natural logarithm of argument (base-E logarithm of argument where E is Euler constant)
lg () Logarithm base-10 of argument, equivalent to logn (argument, 10).
lb () Logarithm base-2 of argument.
exp () Exponential Function E to the power of argument, equivalent to E ^ argument
sin () sine of argument
cos () Cosine
tan () Tangent
cot () Cotangent
sec () Secant of argument, equiv. to 1 / cos (arg).
csc () Cosecant, equiv. to 1 / sin (arg).
asin () Arc sine
acos () Arc cosine
atan () Arc tangent
acot () Arc cotangent
asec () Arc secant, inverse secant.
acsc () Arc cosecant, inverse cosecant.
sinh () Hyperbolic sine, Sinus hyperbolicus
cosh () Hyperbolic cosine, Cosinus hyperbolicus
tanh () Hyperbolic tangent, Tangens hyperbolicus
coth () Hyperbolic cotangent, Cotangens hyperbolicus
sech () Hyperbolic secant, Secans hyperbolicus.
csch () Hyperbolic cosecant, Cosecans hyperbolicus.
asinh () Area sine, Area sinus hyperbolicus, inverse sinh ().
acosh () Area cosine, Area cosinus hyperbolicus, inverse cosh ().
atanh () Area tangent, Area tangens hyperbolicus, inverse tanh ().
acoth () Area cotangent, Area cotangens hyperbolicus, inverse cotanh ().
asech () Area-secant, Area secans hyperbolicus, inverse sech ().
acsch () Area-cosecant, Area cosecans hyperbolicus, inverse csch ().
gaussd (x, mean, sigma) Gaussian distribution ("Bell Curve"). gaussd (x, 0,1), by the way, is the special case "Normal distribution density with mean-value = 0, standard-deviation = 1".
min (arg1, arg2) Returns the lesser of the two arguments
max (arg1, arg2) Returns the greater of the two arguments
round () Rounds argument up or down to the closest integer
floor () Rounds arg down.
ceil () Rounds arg up.
abs () or | | Absolute value of argument. Example: 2abs (sin [x]) or alternatively 2 | sin (x) | .
sgn () Sign Function.
rand Random number between 0 und 1. Example:
pi * rand * sin (x) or even Pirandsin (x).
E Euler constant 2.718281828459045 ...
LN2 Natural logarithm of 2, is 0.6931471805599453 ...
LN10 Natural logarithm of 10, is 2.302585092994046 ...
LOG2E Base-2 logarithm of E (E: see above), is 1.4426950408889633 ...
LOG10E Base-10 logarithmus of E, is 0.4342944819032518 ...
PHI Golden Ratio 1.61803398874989 ...
PI 3.141592653589793 ...
SQRT1_2 Square root of 1/2, is 0.7071067811865476 ...
SQRT2 Square root of 2, is 1.4142135623730951 ...
References