Symbolic Math (SymEngine)
Symbolic mathematics library based on SymEngine.
sym.assumptions.refine
Simplifies an expression using the given assumptions.
sym.assumptions.refine(expr, assumptions)
sym.assumptions.ask
Asks a query about a symbol under the given assumptions.
sym.assumptions.ask(query, symbol, assumptions?)
sym.calculus.diff
Computes the derivative of a symbolic expression.
sym.calculus.diff(expr, args)
sym.calculus.series
Computes the Taylor series expansion of an expression around a point.
sym.calculus.series(expr, x, x0?, n?)
sym.logic.BoolTrue
Creates the boolean constant True.
sym.logic.BoolTrue()
sym.logic.BoolFalse
Creates the boolean constant False.
sym.logic.BoolFalse()
sym.abs
symngwasm - SymEngine-based symbolic mathematics in TypeScript with WebAssembly.
sym.abs(x)
sym.acos
Computes the arccosine (inverse cosine) of a symbolic expression.
sym.acos(x)
sym.acosh
Computes the inverse hyperbolic cosine of a symbolic expression.
sym.acosh(x)
sym.acot
Computes the arc-cotangent (inverse cotangent) of a symbolic expression.
sym.acot(x)
sym.acoth
Computes the inverse hyperbolic cotangent of a symbolic expression.
sym.acoth(x)
sym.acsc
Computes the arc-cosecant (inverse cosecant) of a symbolic expression.
sym.acsc(x)
sym.acsch
Computes the inverse hyperbolic cosecant of a symbolic expression.
sym.acsch(x)
sym.add
Add two expressions: a + b
sym.add(a, b)
sym.arg
Computes the argument (phase angle) of a complex expression.
sym.arg(x)
sym.as_real_imag
Extracts the real and imaginary parts of a complex expression.
sym.as_real_imag(expr)
sym.asec
Computes the arc-secant (inverse secant) of a symbolic expression.
sym.asec(x)
sym.asech
Computes the inverse hyperbolic secant of a symbolic expression.
sym.asech(x)
sym.asin
Computes the arcsine (inverse sine) of a symbolic expression.
sym.asin(x)
sym.asinh
Computes the inverse hyperbolic sine of a symbolic expression.
sym.asinh(x)
sym.atan
Computes the arctangent (inverse tangent) of a symbolic expression.
sym.atan(x)
sym.atan2
Computes the two-argument arctangent of symbolic expressions.
sym.atan2(y, x)
sym.atanh
Computes the inverse hyperbolic tangent of a symbolic expression.
sym.atanh(x)
sym.beta
Computes the beta function of symbolic expressions.
sym.beta(a, b)
sym.binomial
Computes the binomial coefficient C(n, k) = n! / (k! * (n-k)!).
sym.binomial(n, k)
sym.boundary
Computes the boundary of a set.
sym.boundary(set)
sym.cbrt
Computes the cube root of a symbolic expression.
sym.cbrt(x)
sym.ceiling
Computes the ceiling function of a symbolic expression.
sym.ceiling(x)
sym.closure
Computes the closure of a set.
sym.closure(set)
sym.coeff
Extract the coefficient of x^n from an expression.
sym.coeff(expr, x, n)
sym.complement
Computes the complement of a set relative to another set.
sym.complement(a, universe)
sym.Complexes
Creates the set of complex numbers ℂ.
sym.Complexes()
sym.conjugate
Computes the complex conjugate of an expression.
sym.conjugate(x)
sym.contains
Checks if an element is contained in a set.
sym.contains(set, element)
sym.cos
Computes the cosine of a symbolic expression.
sym.cos(x)
sym.cosh
Computes the hyperbolic cosine of a symbolic expression.
sym.cosh(x)
sym.cot
Computes the cotangent of a symbolic expression.
sym.cot(x)
sym.coth
Computes the hyperbolic cotangent of a symbolic expression.
sym.coth(x)
sym.csc
Computes the cosecant of a symbolic expression.
sym.csc(x)
sym.csch
Computes the hyperbolic cosecant of a symbolic expression.
sym.csch(x)
sym.cse
Performs common subexpression elimination on a list of expressions.
sym.cse(exprs)
sym.denom
Extracts the denominator of a rational expression.
sym.denom(expr)
sym.diag
Create a diagonal matrix from values.
sym.diag(values, k?)
sym.digamma
Computes the digamma function of a symbolic expression.
sym.digamma(x)
sym.dirichlet_eta
Computes the Dirichlet eta function of a symbolic expression.
sym.dirichlet_eta(s)
sym.div
Divide two expressions: a / b
sym.div(a, b)
sym.dummy
Creates a new unique dummy symbol.
sym.dummy(name?)
sym.EmptySet
Creates the empty set ∅.
sym.EmptySet()
sym.erf
Computes the error function of a symbolic expression.
sym.erf(x)
sym.erfc
Computes the complementary error function of a symbolic expression.
sym.erfc(x)
sym.exp
Computes the exponential function of a symbolic expression.
sym.exp(x)
sym.expand
Expands an expression by distributing multiplication over addition.
sym.expand(expr)
sym.expand_complex
Expands a complex expression into its real and imaginary parts.
sym.expand_complex(expr)
sym.expand_trig
Expands trigonometric functions using exponential identities.
sym.expand_trig(expr)
sym.exprFromWasm
Create an Expr subclass instance from a WASM object based on its type.
sym.exprFromWasm(obj)
sym.eye
Create an identity matrix.
sym.eye(n, m?, k?)
sym.factorial
Computes the factorial n! = 1 * 2 * 3 * ... * n.
sym.factorial(n)
sym.fibonacci
Computes the nth Fibonacci number.
sym.fibonacci(n)
sym.fibonacci2
Computes F(n) and F(n-1) simultaneously.
sym.fibonacci2(n)
sym.FiniteSet
Creates a finite set from elements.
sym.FiniteSet(args)
sym.floor
Computes the floor function of a symbolic expression.
sym.floor(x)
sym.gamma
Computes the gamma function of a symbolic expression.
sym.gamma(x)
sym.gcd
Compute the greatest common divisor of two expressions.
sym.gcd(a, b)
sym.gcdex
Compute the extended greatest common divisor.
sym.gcdex(a, b)
sym.gcdext
Computes the extended GCD of two numbers.
sym.gcdext(a, b)
sym.hasSymbol
Checks if an expression contains a specific symbol.
sym.hasSymbol(expr, symbol)
sym.im
Extracts the imaginary part of a complex expression.
sym.im(x)
sym.inf
Computes the infimum (greatest lower bound) of a set.
sym.inf(set)
sym.Integers
Creates the set of integers ℤ.
sym.Integers()
sym.interior
Computes the interior of a set.
sym.interior(set)
sym.intersection
Computes the intersection of two sets.
sym.intersection(a, b)
sym.Interval
Creates an interval.
sym.Interval(start, end, leftOpen?, rightOpen?)
sym.isComplex
Checks if the expression is a Complex number (exact complex).
sym.isComplex(expr)
sym.isComplexDouble
Checks if the expression is a ComplexDouble (floating-point complex).
sym.isComplexDouble(expr)
sym.isComplexMPC
Checks if the expression is a ComplexMPC (arbitrary-precision complex).
sym.isComplexMPC(expr)
sym.isComplexValued
Checks if the number is complex-valued (has non-zero imaginary part).
sym.isComplexValued(expr)
sym.isInteger
Checks if the expression is an Integer.
sym.isInteger(expr)
sym.isNegative
Checks if the number is negative.
sym.isNegative(expr)
sym.isNumber
Checks if the expression is a Number (Integer, Rational, Real, Complex).
sym.isNumber(expr)
sym.isPositive
Checks if the number is positive.
sym.isPositive(expr)
sym.isProperSubset
Checks if set a is a proper subset of set b.
sym.isProperSubset(a, b)
sym.isProperSuperset
Checks if set a is a proper superset of set b.
sym.isProperSuperset(a, b)
sym.isRational
Checks if the expression is a Rational number.
sym.isRational(expr)
sym.isRealDouble
Checks if the expression is a RealDouble (floating-point real).
sym.isRealDouble(expr)
sym.isRealMPFR
Checks if the expression is a RealMPFR (arbitrary-precision real).
sym.isRealMPFR(expr)
sym.isSet
Checks if the expression is a Set.
sym.isSet(expr)
sym.isSubset
Checks if set a is a subset of set b.
sym.isSubset(a, b)
sym.isSuperset
Checks if set a is a superset of set b.
sym.isSuperset(a, b)
sym.isSymbol
Checks if the expression is a Symbol.
sym.isSymbol(expr)
sym.isZero
Checks if the number has value zero.
sym.isZero(expr)
sym.jacobian
Compute the Jacobian matrix of a vector of functions with respect to variables.
sym.jacobian(funcs, vars)
sym.kronecker_delta
Computes the Kronecker delta of two symbolic expressions.
sym.kronecker_delta(i, j)
sym.lambdify
Converts a symbolic expression to a fast numerical function.
sym.lambdify(expr, args, options?)
sym.lambdifyMulti
Converts multiple symbolic expressions to a fast numerical function.
sym.lambdifyMulti(exprs, args, options?)
sym.lambertw
Computes the Lambert W function of a symbolic expression.
sym.lambertw(x)
sym.lcm
Compute the least common multiple of two expressions.
sym.lcm(a, b)
sym.linsolve
Solves a system of linear equations.
sym.linsolve(system, symbols)
sym.loadWasmModule
Load the WASM module (singleton pattern)
sym.loadWasmModule()
sym.log
Computes the natural logarithm of a symbolic expression.
sym.log(x)
sym.loggamma
Computes the log-gamma function of a symbolic expression.
sym.loggamma(x)
sym.lowergamma
Computes the lower incomplete gamma function of symbolic expressions.
sym.lowergamma(s, x)
sym.lucas
Computes the nth Lucas number.
sym.lucas(n)
sym.lucas2
Computes L(n) and L(n-1) simultaneously.
sym.lucas2(n)
sym.Max
Computes the maximum of multiple symbolic expressions.
sym.Max(args)
sym.Min
Computes the minimum of multiple symbolic expressions.
sym.Min(args)
sym.mod
Computes n mod d (modulo, rounding toward zero).
sym.mod(n, d)
sym.modF
Computes n mod d (modulo, rounding toward -infinity).
sym.modF(n, d)
sym.modInverse
Computes the modular inverse of a modulo m.
sym.modInverse(a, m)
sym.mul
Multiply two expressions: a * b
sym.mul(a, b)
sym.N
Evaluates an expression numerically to the specified precision.
sym.N(expr, precision?)
sym.neg
Negate an expression: -a
sym.neg(a)
sym.neq
Checks if two expressions are not equal.
sym.neq(a, b)
sym.nextprime
Finds the next prime number after a given number.
sym.nextprime(n)
sym.ntheory_gcd
Computes the greatest common divisor (GCD) of two numbers.
sym.ntheory_gcd(a, b)
sym.ntheory_lcm
Computes the least common multiple (LCM) of two numbers.
sym.ntheory_lcm(a, b)
sym.numer
Extracts the numerator of a rational expression.
sym.numer(expr)
sym.ones
Create a matrix of ones.
sym.ones(rows, cols)
sym.parse
Parses a mathematical expression from a string.
sym.parse(str, options?)
sym.polygamma
Computes the polygamma function of symbolic expressions.
sym.polygamma(n, x)
sym.pow
Raise to a power: base ** exp
sym.pow(base, exp)
sym.powsimp
Simplifies expressions with powers by combining bases and exponents.
sym.powsimp(expr)
sym.quotient
Computes n / d (quotient, rounding toward zero).
sym.quotient(n, d)
sym.quotientF
Computes n / d (quotient, rounding toward -infinity).
sym.quotientF(n, d)
sym.quotientMod
Computes both quotient and remainder at once (rounding toward zero).
sym.quotientMod(n, d)
sym.quotientModF
Computes both quotient and remainder (rounding toward -infinity).
sym.quotientModF(n, d)
sym.radsimp
Simplifies expressions involving radicals (roots).
sym.radsimp(expr)
sym.Rationals
Creates the set of rational numbers ℚ.
sym.Rationals()
sym.re
Extracts the real part of a complex expression.
sym.re(x)
sym.Reals
Creates the set of real numbers ℝ.
sym.Reals()
sym.rewrite_as_cos
Rewrites trigonometric functions in terms of cosine only.
sym.rewrite_as_cos(expr)
sym.rewrite_as_exp
Rewrites trigonometric functions in terms of complex exponentials.
sym.rewrite_as_exp(expr)
sym.rewrite_as_sin
Rewrites trigonometric functions in terms of sine only.
sym.rewrite_as_sin(expr)
sym.sec
Computes the secant of a symbolic expression.
sym.sec(x)
sym.sech
Computes the hyperbolic secant of a symbolic expression.
sym.sech(x)
sym.sign
Computes the sign (signum) function of a symbolic expression.
sym.sign(x)
sym.simplify
Simplifies an expression using heuristic algorithms.
sym.simplify(expr, assumptions?)
sym.sin
Computes the sine of a symbolic expression.
sym.sin(x)
sym.sinh
Computes the hyperbolic sine of a symbolic expression.
sym.sinh(x)
sym.solve
Solves an equation for a given symbol.
sym.solve(expr, symbol)
sym.solve_poly
Solve a polynomial equation for a variable.
sym.solve_poly(f, x)
sym.solve_rational
Solves a rational equation for a given symbol.
sym.solve_rational(expr, symbol)
sym.solve_trig
Solves a trigonometric equation for a given symbol.
sym.solve_trig(expr, symbol)
sym.sqrt
Computes the square root of a symbolic expression.
sym.sqrt(x)
sym.sub
Subtract two expressions: a - b
sym.sub(a, b)
sym.sup
Computes the supremum (least upper bound) of a set.
sym.sup(set)
sym.symbols
Create multiple symbols at once.
sym.symbols(names, assumptions?)
sym.tan
Computes the tangent of a symbolic expression.
sym.tan(x)
sym.tanh
Computes the hyperbolic tangent of a symbolic expression.
sym.tanh(x)
sym.toCCode
Converts an expression to C code.
sym.toCCode(expr)
sym.toJSCode
Converts an expression to JavaScript code.
sym.toJSCode(expr)
sym.toJuliaCode
Converts an expression to Julia code.
sym.toJuliaCode(expr)
sym.toLatex
Converts an expression to LaTeX format.
sym.toLatex(expr)
sym.toMathML
Converts an expression to MathML format.
sym.toMathML(expr)
sym.trigsimp
Simplifies trigonometric expressions using trigonometric identities.
sym.trigsimp(expr)
sym.union
Computes the union of two sets.
sym.union(a, b)
sym.UniversalSet
Creates the universal set (contains all elements).
sym.UniversalSet()
sym.uppergamma
Computes the upper incomplete gamma function of symbolic expressions.
sym.uppergamma(s, x)
sym.zeros
Create a matrix of zeros.
sym.zeros(rows, cols)
sym.zeta
Computes the Riemann zeta function of a symbolic expression.
sym.zeta(s)