Parses and evaluates expressions over the complex numbers
npm install complex-expression-parseres5/expression.js or es5/expression.min.js before your scripts.
Array or Number.
node.js just run
Expression in your code using
Expression has a single method: evaluate.
Expression takes a single string as an argument to its constructor. This
evaluate takes a single, optional dictionary of symbols and their values and
Complex. If the expression has any
x
yy
M104
☃
\uD83D\uDE80
i - Known constant
2x - Interpreted as 2 x
M104M - Interpreted as M104 M
☃☃ - Interpreted as ☃ ☃
\uD83D\uDE80\uD83D\uDE80 - Interpreted as \uD83D\uDE80 \uD83D\uDE80
e: Euler's constant
i: The imaginary unit
pi: The ratio of a circle's circumference to its diameter
+ (unary): The identity function
+ (binary): Addition
- (unary): Negation
- (binary): Subtraction
: Multiplication
/: Division
abs(x): The magnitude of x
arg(x): The phase of x
ceil(x): The ceiling of x
conj(x): The conjugate of x
exp(x): The exponential of x
floor(x): The floor of x
frac(x): The fractional part of x
imag(x): The imaginary part of x
ℑ(x): The imaginary part of x
lg(x): The log base 2 of x
ln(x): The natural log of x
log(base, x): The log base base of x
log10(x): The log base 10 of x
mod(x, y): x mod y
nint(x): The nearest integer of x
norm(x): The norm of x
pow(base, power): base raised to the power of power
real(x): The real part of x
ℜ(x): The real part of x
sqrt(x): The square root of x
arccos(x): The inverse cosine of x
arccosh(x): The inverse hyperbolic cosine of x
arccot(x): The inverse cotangent of x
arccoth(x): The inverse hyperbolic cotangent of x
arccsc(x): The inverse cosecant of x
arccsch(x): The inverse hyperbolic cosecant of x
arcsec(x): The inverse secant of x
arcsech(x): The inverse hyperbolic secant of x
arcsin(x): The inverse sine of x
arcsinh(x): The inverse hyperbolic sine of x
arctan(x): The inverse tangent of x
arctanh(x): The inverse hyperbolic tangent of x
cos(x): The cosine of x
cosh(x): The hyperbolic cosine of x
cot(x): The cotangent of x
coth(x): The hyperbolic cotangent of x
csc(x): The cosecant of x
csch(x): The hyperbolic cosecant of x
sec(x): The secant of x
sech(x): The hyperbolic secant of x
sin(x): The sine of x
sinh(x): The hyperbolic sine of x
tan(x): The tangent of x
tanh(x): The hyperbolic tangent of x
gamma(x): The gamma of x
Γ(x): The gamma of x