Mathematical Notation Converter
Equation Converter 0.3.1
Converts equations from standard mathematical notation, to JavaScript notation.
Capabilities
- Supports use of the caret sign ("^") to indicate power. For example,
x^2 = x**2
- Handles implied multiplication. For example,
2x = 2*x, 3(4) = 3*(4)
- Right-parenthesis followed by left-parenthesis, number*, variable, function, or constant
- Number followed by left-parenthesis, variable, function, or constant
- Variable followed by left-parenthesis, number*, variable, function, or constant
- Constant followed by left-parenthesis, number*, variable, function, or constant
- Removes white space. For example
2 + 5x = 2+5x
* Asterisks indicates non-standard formations in mathematics such as (5+2)8
instead of 8(5+2)
. These are (by choice) interpreted as multiplication.
Version history
- Version 0.3.1 (26 Sep 2019)
- Switched to Standard Javascript style for internal code. More explicit handling of math functions, which now allows use of exponential notation (
9e9
to mean9*10^9
). Added a series of code tests that can be run using the commandrunTests()
from the browser console to prevent regressions. - Version 0.3 (24 Sep 2019)
- Switched to using
x**y
for powers instead ofpow(x,y)
. This simplified code and resolved several edge cases that were not processed correctly (such as(2+x)^3
). The power operator has pretty broad browser support now. Also added awith(Math){}
statement to the final JavaScript notation, so that Math functions (likesin()
andcos()
) and constants (likePI
andE
) work out of the box. - Version 0.2.4 (Aug 2009)
- Replaced used of
const
withvar
since only Mozilla recognizes it. Replacedeval
with better code. - Version 0.2.3 (Feb 2008)
- Added support for negative sign following caret. For example,
x^-2 = pow(x,-2)
. Note that negative sign preceding caret is not supported (by choice), i.e.-x^2 = -(x^2)
instead of(-x)^2
. This is in keeping with behavior of most handheld graphing calculators. - Version 0.2.2
- Bug fix regarding mishandling of constants and numbers preceding caret.
- Version 0.2.1 (Apr 2007)
- Bug fixes: added implied multiplication for constant followed by number, stopped reserved constants
LOG2E
andLOG10E
from becomingLOG2*E
andLOG10*E
, fixed mishandling of constants and functions preceding caret. - Version 0.2 (Apr 2007)
- Added support for use of caret sign ("^") as power operator.
- Version 0.1 (Apr 2007)
- Added support for implied multiplication and removes white space.