### Install and build Algebrite Source: https://github.com/davidedc/algebrite/blob/master/README.md Commands for installing dependencies and building the project using Bazel. ```bash npm install ``` ```bash bazelisk build algebrite ``` ```bash bazelisk clean; rm -rf ./dist/* ``` ```bash bazelisk build npm ``` -------------------------------- ### Tensor and Matrix Operations in Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Provides examples for creating and manipulating matrices and tensors, including multiplication, transpose, and identity matrix generation. Requires Algebrite to be imported. ```javascript var Algebrite = require('algebrite'); // Create matrices Algebrite.run('A = [[1,2],[3,4]]'); Algebrite.run('B = [[5,6],[7,8]]'); // Matrix multiplication (dot product) Algebrite.run('dot(A, B)'); // => "[[19,22],[43,50]]" // Inner product (same as dot) Algebrite.run('inner(A, B)'); // Outer product Algebrite.run('outer([1,2], [3,4])'); // => "[[3,4],[6,8]]" // Transpose Algebrite.run('transpose(A)'); // => "[[1,3],[2,4]]" // Trace (sum of diagonal) Algebrite.run('contract(A)'); // => "5" // Identity matrix Algebrite.run('unit(3)'); // 3x3 identity matrix // Zero matrix Algebrite.run('zero(2,3)'); // 2x3 zero matrix // Hilbert matrix (for testing) Algebrite.run('hilbert(3)'); // 3x3 Hilbert matrix // Tensor rank and shape Algebrite.run('rank([[1,2],[3,4]])'); // => "2" Algebrite.run('shape([[1,2],[3,4]])'); // => "[2, 2]" // Adjugate (adjoint) matrix Algebrite.run('adj(A)'); // Cofactor Algebrite.run('cofactor(A, 1, 1)'); // Cofactor at position (1,1) ``` -------------------------------- ### Evaluate Symbolic Expressions with eval() Source: https://context7.com/davidedc/algebrite/llms.txt The `eval` function evaluates symbolic expressions, optionally with current variable bindings, and simplifies the result. It accepts both string inputs and internal expression objects. Use `.toString()` to get a string representation of the result. ```javascript var Algebrite = require('algebrite'); // Evaluate expressions with substitutions Algebrite.run('f = x^2 + 2*x + 1'); Algebrite.run('x = 3'); Algebrite.eval('f').toString(); // => "16" // Evaluate without prior variable assignment Algebrite.eval('sin(0)').toString(); // => "0" Algebrite.eval('cos(pi)').toString(); // => "-1" Algebrite.eval('exp(i*pi)').toString(); // => "-1" (Euler's identity) ``` -------------------------------- ### Algebrite.run Source: https://context7.com/davidedc/algebrite/llms.txt The primary entry point for evaluating mathematical expressions provided as strings. ```APIDOC ## Algebrite.run(expression) ### Description Parses and evaluates a mathematical expression string, returning the result as a string. ### Parameters - **expression** (string) - Required - The mathematical expression to evaluate. ### Request Example Algebrite.run('x + x'); ### Response - **result** (string) - The evaluated result of the expression. ``` -------------------------------- ### Modular Arithmetic and Number Theory in Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Illustrates functions for modular arithmetic, prime testing, finding divisors, and polynomial division. Requires Algebrite to be imported. ```javascript var Algebrite = require('algebrite'); // Modulo operation Algebrite.run('mod(17, 5)'); // => "2" Algebrite.run('mod(-7, 3)'); // => "2" // Prime testing Algebrite.run('isprime(17)'); // => "1" (true) Algebrite.run('isprime(15)'); // => "0" (false) // Nth prime Algebrite.run('prime(10)'); // => "29" (10th prime) // Divisors Algebrite.run('divisors(12)'); // => "[1, 2, 3, 4, 6, 12]" // Quotient (polynomial division) Algebrite.run('quotient(x^3 + x, x + 1)'); // Polynomial quotient ``` -------------------------------- ### Execute Algebrite Expressions with run() Source: https://context7.com/davidedc/algebrite/llms.txt Use the `run` function to evaluate mathematical expressions as strings. It supports basic arithmetic, algebraic operations, and multiple expressions separated by newlines. The library initializes automatically on the first call and maintains state unless `clearall` is invoked. ```javascript var Algebrite = require('algebrite'); // Basic arithmetic and algebraic operations Algebrite.run('x + x'); // => "2*x" Algebrite.run('2 + 3'); // => "5" Algebrite.run('(a + b)^2'); // => "a^2 + 2*a*b + b^2" // Multiple expressions can be separated by newlines Algebrite.run('x = 5 x^2'); // => "25" // The library initializes automatically on first run // Subsequent calls maintain state unless clearall is called Algebrite.run('clearall'); // Resets all variables and state ``` -------------------------------- ### Run Algebrite tests Source: https://github.com/davidedc/algebrite/blob/master/README.md Commands to execute the test suite, optionally bypassing the cache. ```bash bazelisk test :all ``` ```bash bazelisk test :all --cache_test_results=no ``` -------------------------------- ### Check Algebrite Version and Run Expression Source: https://github.com/davidedc/algebrite/blob/master/index.html Use console.log to check the Algebrite version and Algebrite.run() to execute mathematical expressions. Ensure the Algebrite library is loaded before running these commands. ```javascript console.log(Algebrite.version); ``` ```javascript Algebrite.run("1+1"); ``` -------------------------------- ### Polynomial Expansion and Partial Fractions with Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Expands products and powers of sums, and performs partial fraction decomposition. Also supports trigonometric expression expansion. ```javascript var Algebrite = require('algebrite'); // Expand products Algebrite.run('expand((x+1)*(x+2))'); // => "x^2 + 3*x + 2" Algebrite.run('expand((a+b)^3)'); // => "a^3 + 3*a^2*b + 3*a*b^2 + b^3" ``` ```javascript // Partial fraction expansion Algebrite.run('expand(1/(x^2-1))'); // => "1/(2*(x-1)) - 1/(2*(x+1))" Algebrite.run('expand(1/(x^3+x^2), x)'); // => "1/x^2 - 1/x + 1/(x+1)" ``` ```javascript // Expand trigonometric expressions Algebrite.run('circexp(sin(2*x))'); // => "2*sin(x)*cos(x)" ``` -------------------------------- ### Taylor Series Expansion with Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Computes the Taylor series expansion of a function around a specified point. Allows customization of the expansion point and the number of terms. ```javascript var Algebrite = require('algebrite'); // Taylor series of exp(x) around 0 (default) Algebrite.run('taylor(exp(x), x, 5)'); // => "1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5" ``` ```javascript // Taylor series of sin(x) Algebrite.run('taylor(sin(x), x, 5)'); // => "x - 1/6*x^3 + 1/120*x^5" ``` ```javascript // Taylor series around a different point Algebrite.run('taylor(log(x), x, 4, 1)'); // Expand around x=1 ``` ```javascript // Custom number of terms Algebrite.run('taylor(cos(x), x, 4)'); // => "1 - 1/2*x^2 + 1/24*x^4" ``` -------------------------------- ### Numeric Evaluation in Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Shows how to convert symbolic expressions to floating-point numbers and perform rounding, absolute value, and sign operations. Ensure Algebrite is imported. ```javascript var Algebrite = require('algebrite'); // Convert to float Algebrite.run('float(pi)'); // => "3.14159..." Algebrite.run('float(sqrt(2))'); // => "1.41421..." Algebrite.run('float(1/3)'); // => "0.333333..." // Numeric precision Algebrite.run('float(exp(1))'); // => "2.71828..." // Floor and ceiling Algebrite.run('floor(3.7)'); // => "3" Algebrite.run('ceiling(3.2)'); // => "4" // Round Algebrite.run('round(3.5)'); // => "4" // Absolute value Algebrite.run('abs(-5)'); // => "5" Algebrite.run('abs(3+4*i)'); // => "5" // Sign function Algebrite.run('sgn(-3)'); // => "-1" Algebrite.run('sgn(5)'); // => "1" ``` -------------------------------- ### GCD and LCM Operations in Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Demonstrates calculating the greatest common divisor (GCD) and least common multiple (LCM) for both integers and polynomials. Requires Algebrite to be imported. ```javascript var Algebrite = require('algebrite'); // Integer GCD Algebrite.run('gcd(12, 18)'); // => "6" Algebrite.run('gcd(100, 35)'); // => "5" // Multiple integers Algebrite.run('gcd(12, 18, 24)'); // => "6" // Integer LCM Algebrite.run('lcm(4, 6)'); // => "12" Algebrite.run('lcm(3, 4, 5)'); // => "60" // Polynomial GCD Algebrite.run('gcd(x^2 - 1, x^2 + 2*x + 1)'); // => "x + 1" // Polynomial LCM Algebrite.run('lcm(x^2 - 1, x - 1)'); // => "x^2 - 1" ``` -------------------------------- ### Symbolic Integration with integral() Source: https://context7.com/davidedc/algebrite/llms.txt Compute the indefinite integral (antiderivative) of expressions using the `integral` function. It utilizes a comprehensive table of integrals with pattern matching. You can specify the integration variable. ```javascript var Algebrite = require('algebrite'); // Basic integrals Algebrite.run('integral(x^2)'); // => "1/3*x^3" Algebrite.run('integral(1/x)'); // => "log(x)" Algebrite.run('integral(exp(x))'); // => "exp(x)" // Trigonometric integrals Algebrite.run('integral(sin(x))'); // => "-cos(x)" Algebrite.run('integral(cos(x))'); // => "sin(x)" Algebrite.run('integral(tan(x))'); // => "-log(cos(x))" // Specify integration variable Algebrite.run('integral(x^2 + x, x)'); // => "1/3*x^3 + 1/2*x^2" Algebrite.run('integral(a*x, x)'); // => "1/2*a*x^2" // Integration of exponentials Algebrite.run('integral(exp(a*x), x)'); // => "exp(a*x)/a" // Integration of logarithms Algebrite.run('integral(log(x), x)'); // => "x*log(x) - x" // Integration with square roots Algebrite.run('integral(1/sqrt(1-x^2), x)'); // => "arcsin(x)" ``` -------------------------------- ### Definite Integration with Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Computes definite integrals with specified bounds. Supports single, double, and triple integrals, as well as symbolic bounds. ```javascript var Algebrite = require('algebrite'); // Single definite integral Algebrite.run('defint(x^2, x, 0, 1)'); // => "1/3" Algebrite.run('defint(sin(x), x, 0, pi)'); // => "2" ``` ```javascript // Double integral (iterated integral) Algebrite.run('defint(x*y, x, 0, 1, y, 0, 1)'); // => "1/4" ``` ```javascript // Triple integral Algebrite.run('defint(1, x, 0, 1, y, 0, 1, z, 0, 1)'); // => "1" (unit cube volume) ``` ```javascript // Definite integral with symbolic bounds Algebrite.run('defint(x, x, 0, a)'); // => "1/2*a^2" ``` -------------------------------- ### Special Mathematical Functions in Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Demonstrates the usage of Gamma, factorial, binomial, error, Bessel, Hermite, Laguerre, and Legendre functions. Ensure Algebrite is imported before use. ```javascript var Algebrite = require('algebrite'); // Gamma function Algebrite.run('Gamma(5)'); // => "24" (factorial of 4) Algebrite.run('Gamma(1/2)'); // => "pi^(1/2)" // Factorial Algebrite.run('factorial(5)'); // => "120" Algebrite.run('10!'); // => "3628800" // Binomial coefficient Algebrite.run('binomial(5,2)'); // => "10" Algebrite.run('choose(10,3)'); // => "120" // Error function Algebrite.run('erf(x)'); // Error function Algebrite.run('erfc(x)'); // Complementary error function // Bessel functions Algebrite.run('besselj(x, 0)'); // Bessel function of first kind Algebrite.run('bessely(x, 0)'); // Bessel function of second kind // Hermite polynomials Algebrite.run('hermite(x, 3)'); // 3rd Hermite polynomial // Laguerre polynomials Algebrite.run('laguerre(x, 2)'); // 2nd Laguerre polynomial // Legendre polynomials Algebrite.run('legendre(x, 3)'); // 3rd Legendre polynomial ``` -------------------------------- ### Perform symbolic math operations with Algebrite Source: https://github.com/davidedc/algebrite/blob/master/README.md Use the Algebrite library to run symbolic expressions, factorials, and calculus operations. ```javascript var Algebrite = require('algebrite') Algebrite.run('x + x') // => "2 x" Algebrite.factor('10!').toString() // => "2^8 3^4 5^2 7" Algebrite.eval('integral(x^2)').toString() // => "1/3 x^3" // composing... Algebrite.integral(Algebrite.eval('x')).toString() // => "1/2 x^2" ``` -------------------------------- ### Trigonometric Functions Source: https://context7.com/davidedc/algebrite/llms.txt Provides a complete set of trigonometric and hyperbolic functions with symbolic evaluation capabilities. Includes standard, inverse, and hyperbolic functions, as well as conversion to exponential form. ```javascript var Algebrite = require('algebrite'); // Standard trig functions Algebrite.run('sin(pi/6)'); // => "1/2" Algebrite.run('cos(pi/3)'); // => "1/2" Algebrite.run('tan(pi/4)'); // => "1" // Inverse trig functions Algebrite.run('arcsin(1/2)'); // => "pi/6" Algebrite.run('arccos(0)'); // => "pi/2" Algebrite.run('arctan(1)'); // => "pi/4" // Hyperbolic functions Algebrite.run('sinh(x)'); // Hyperbolic sine Algebrite.run('cosh(x)'); // Hyperbolic cosine Algebrite.run('tanh(x)'); // Hyperbolic tangent // Inverse hyperbolic functions Algebrite.run('arcsinh(x)'); Algebrite.run('arccosh(x)'); Algebrite.run('arctanh(x)'); // Convert trig to exponential form Algebrite.run('circexp(sin(x))'); // => "-1/2*i*exp(i*x) + 1/2*i*exp(-i*x)" ``` -------------------------------- ### Finding Polynomial Roots with Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Finds symbolic and numeric roots of polynomial equations. Supports quadratic, polynomial, and complex roots, as well as numeric approximations. ```javascript var Algebrite = require('algebrite'); // Quadratic roots Algebrite.run('roots(x^2 - 4)'); // => "[-2, 2]" Algebrite.run('roots(x^2 + 1)'); // => "[-i, i]" Algebrite.run('roots(x^2 - 2)'); // => "[-2^(1/2), 2^(1/2)]" ``` ```javascript // Polynomial roots Algebrite.run('roots(x^3 - 1)'); // Complex cube roots of unity Algebrite.run('roots(x^2 + 2*x + 1)'); // => "[-1]" (double root) ``` ```javascript // Numeric roots (using nroots for numeric approximation) Algebrite.run('nroots(x^4 + x + 1)'); // Returns floating-point approximations ``` -------------------------------- ### Symbolic Differentiation with derivative() Source: https://context7.com/davidedc/algebrite/llms.txt Compute the symbolic derivative of an expression with respect to a specified variable using the `derivative` function. It supports higher-order derivatives, partial derivatives, and automatic variable guessing. The chain rule is applied automatically. ```javascript var Algebrite = require('algebrite'); // Basic derivatives Algebrite.run('d(x^2, x)'); // => "2*x" Algebrite.run('d(sin(x), x)'); // => "cos(x)" Algebrite.run('d(log(x), x)'); // => "1/x" Algebrite.run('d(exp(x), x)'); // => "exp(x)" // Higher-order derivatives (2nd derivative) Algebrite.run('d(x^3, x, 2)'); // => "6*x" // Partial derivatives Algebrite.run('d(x^2*y^3, x)'); // => "2*x*y^3" Algebrite.run('d(x^2*y^3, y)'); // => "3*x^2*y^2" // Chain rule applied automatically Algebrite.run('d(sin(x^2), x)'); // => "2*x*cos(x^2)" // Derivative of logarithms and exponentials Algebrite.run('d(a^x, x)'); // => "a^x*log(a)" Algebrite.run('d(x^x, x)'); // => "x^x + x^x*log(x)" // Gradient (derivative with respect to vector) Algebrite.run('d(x*y*z, [x,y,z])'); // => "[y*z, x*z, x*y]" ``` -------------------------------- ### Compute Matrix Inverse Source: https://context7.com/davidedc/algebrite/llms.txt Computes the inverse of a square matrix. Includes verification by multiplying the matrix with its inverse to yield the identity matrix. Supports symbolic computation. ```javascript var Algebrite = require('algebrite'); // 2x2 matrix inverse Algebrite.run('inv([[1,2],[3,4]])'); // => "[[-2, 1], [3/2, -1/2]]" // Verify inverse: A * A^(-1) = I Algebrite.run('A = [[1,2],[3,4]]'); Algebrite.run('dot(A, inv(A))'); // => "[[1,0],[0,1]]" // Symbolic matrix inverse Algebrite.run('inv([[a,b],[c,d]])'); // => "[[d/(a*d-b*c), -b/(a*d-b*c)], [-c/(a*d-b*c), a/(a*d-b*c)]]" ``` -------------------------------- ### Complex Number Operations Source: https://context7.com/davidedc/algebrite/llms.txt Offers full support for complex numbers with 'i' as the imaginary unit. Includes basic arithmetic, extraction of real and imaginary parts, conjugate, magnitude, argument, polar/rectangular conversions, and Euler's formula. ```javascript var Algebrite = require('algebrite'); // Basic complex arithmetic Algebrite.run('(2+3*i) + (1-i)'); // => "3 + 2*i" Algebrite.run('(2+3*i) * (1-i)'); // => "5 + i" Algebrite.run('(2+3*i) / (1-i)'); // Complex division // Extract real and imaginary parts Algebrite.run('real(2+3*i)'); // => "2" Algebrite.run('imag(2+3*i)'); // => "3" // Complex conjugate Algebrite.run('conj(2+3*i)'); // => "2 - 3*i" // Magnitude (absolute value) Algebrite.run('abs(3+4*i)'); // => "5" // Argument (phase angle) Algebrite.run('arg(1+i)'); // => "pi/4" // Polar form Algebrite.run('polar(1+i)'); // => "2^(1/2)*exp(i*pi/4)" // Rectangular form Algebrite.run('rect(2*exp(i*pi/4))'); // Convert back to rectangular // Euler's formula Algebrite.run('exp(i*pi)'); // => "-1" ``` -------------------------------- ### Symbolic Integration Source: https://context7.com/davidedc/algebrite/llms.txt Computes the indefinite integral of an expression using the integral() function. ```APIDOC ## integral(expression, [variable]) ### Description Computes the indefinite integral (antiderivative) of an expression. ### Parameters - **expression** (string) - Required - The expression to integrate. - **variable** (string) - Optional - The variable to integrate with respect to. ``` -------------------------------- ### Algebrite.eval Source: https://context7.com/davidedc/algebrite/llms.txt Evaluates a symbolic expression with current variable bindings and simplifies the result. ```APIDOC ## Algebrite.eval(expression) ### Description Evaluates an expression using current variable bindings and returns a simplified result. ### Parameters - **expression** (string) - Required - The expression or variable name to evaluate. ### Response - **result** (object) - An internal expression object with a toString() method. ``` -------------------------------- ### Substitution with Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Substitutes a new expression for an old expression within an expression tree. Supports simple, multiple, and complex substitutions. ```javascript var Algebrite = require('algebrite'); // Simple substitution Algebrite.run('subst(x^2 + x, x, a)'); // => "a^2 + a" Algebrite.run('subst(sin(x), x, pi/2)'); // => "1" ``` ```javascript // Multiple substitutions (chain them) Algebrite.run('subst(subst(x+y, x, a), y, b)'); // => "a + b" ``` ```javascript // Substitution in complex expressions Algebrite.run('subst(x^2 + 2*x*y + y^2, x+y, z)'); // Replaces (x+y) with z where possible ``` -------------------------------- ### Expression Simplification with Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Simplifies algebraic and trigonometric expressions using various mathematical identities. Useful for reducing complex expressions to their simplest forms. ```javascript var Algebrite = require('algebrite'); // Algebraic simplification Algebrite.run('simplify(x^2 - 2*x + 1)'); // May factor to (x-1)^2 Algebrite.run('simplify((x^2-1)/(x-1))'); // => "x + 1" ``` ```javascript // Trigonometric simplification Algebrite.run('simplify(sin(x)^2 + cos(x)^2)'); // => "1" ``` ```javascript // Complex expression simplification Algebrite.run('simplify((a+b)^2 - a^2 - 2*a*b - b^2)'); // => "0" ``` ```javascript // Simplify nested radicals Algebrite.run('simplify(sqrt(2 + sqrt(3)))'); ``` -------------------------------- ### Compute Eigenvalues and Eigenvectors Source: https://context7.com/davidedc/algebrite/llms.txt Computes eigenvalues and eigenvectors of symmetric numerical matrices. Results are stored in D (eigenvalues) and Q (eigenvectors). Supports eigenvalue-only computation and verification of the A = Q^T * D * Q relationship. ```javascript var Algebrite = require('algebrite'); // Compute eigenvalues and eigenvectors Algebrite.run('A = [[1,2],[2,1]]'); Algebrite.run('eigen(A)'); // Stores results in D and Q // D contains eigenvalues on diagonal Algebrite.run('D'); // Diagonal matrix with eigenvalues // Q contains eigenvectors as rows Algebrite.run('Q'); // Eigenvector matrix // Eigenvalue-only computation Algebrite.run('eigenval([[2,1],[1,2]])'); // Verify: A = Q^T * D * Q Algebrite.run('dot(transpose(Q), D, Q)'); // Should equal A // Example with Hilbert matrix Algebrite.run('A = hilbert(3)'); Algebrite.run('eigen(A)'); Algebrite.run('lambda = D[1,1]'); // First eigenvalue Algebrite.run('X = Q[1]'); // First eigenvector ``` -------------------------------- ### Factorization with Algebrite Source: https://context7.com/davidedc/algebrite/llms.txt Factors integers into prime factors and polynomials into irreducible factors. Can factor with respect to a specific variable or multiple variables. ```javascript var Algebrite = require('algebrite'); // Factor integers Algebrite.run('factor(100)'); // => "2^2*5^2" Algebrite.run('factor(10!)'); // => "2^8*3^4*5^2*7" ``` ```javascript // Factor polynomials Algebrite.run('factor(x^2 - 1)'); // => "(x-1)*(x+1)" Algebrite.run('factor(x^2 + 2*x + 1)'); // => "(x+1)^2" Algebrite.run('factor(x^3 - 1)'); // => "(x-1)*(x^2+x+1)" ``` ```javascript // Factor with respect to specific variable Algebrite.run('factor(a*x^2 + a*x, x)'); // => "a*x*(x+1)" ``` ```javascript // Multiple variable factoring Algebrite.run('factor(x^2 - y^2)'); // => "(x-y)*(x+y)" ``` -------------------------------- ### Symbolic Differentiation Source: https://context7.com/davidedc/algebrite/llms.txt Computes the symbolic derivative of an expression using the d() function. ```APIDOC ## d(expression, variable, [order]) ### Description Computes the symbolic derivative of an expression with respect to a variable. ### Parameters - **expression** (string) - Required - The function to differentiate. - **variable** (string) - Required - The variable to differentiate with respect to. - **order** (number) - Optional - The order of the derivative (e.g., 2 for second derivative). ``` -------------------------------- ### Simplify Algebraic Expressions Source: https://github.com/davidedc/algebrite/blob/master/tests-from-master/failed-tests.txt Use the simplify function to reduce complex algebraic expressions to their simplest forms. This is useful for verifying mathematical identities and cleaning up results. ```algebrite simplify((2/(x+4))/((6x^3+17x^2)/(x^2+3x-4))) ``` ```algebrite simplify(((x^2+1)/(2x^2-4x+2))+((x)/((x-1)^2))+((-x-1)/(x^2-2x+1))) ``` ```algebrite simplify((x/(x^2-2x+1))-(2/(x-1))+(3/(x+2))) ``` ```algebrite simplify((2x/(x^2-9))-(1/(x+3))-(2/(x-3))) ``` ```algebrite simplify((4/(x+2)-(1/x)+1)*(x+2)*x) ``` ```algebrite simplify(((3/(x-4))+x/(2x+7))*(x-4)*(2x+7)) ``` ```algebrite simplify((x/(x^2+12x+36))-((x-8)/(x+6))) ``` ```algebrite simplify(((x^2+14x+40)/(x^2+2x-8))*((x^2+5x-14)/(x^2+7x-30))) ``` ```algebrite simplify(1/(x^2-13x+42)+(x+1)/(x-6)-x^2/(x-7)) ``` ```algebrite simplify((x+10)/((3x+8)^3)+x/((3x+8)^2)) ``` ```algebrite simplify((x+1)/(x-1)+6/(x-7)) ``` ```algebrite simplify(9/(x^2-4)-7x/(x^2-4x+4)) ``` ```algebrite simplify((2x+1)/(4x^2-3x-7)-(x+3)/(x+1)+x/(4x-7)) ``` ```algebrite simplify(simplify((2x+1)/(4x^2-3x-7)-(x+3)/(x+1)+x/(4x-7))*(x+1)*(4x-7)) ``` ```algebrite simplify(3/(6x-x^2)-x/(x^2-5x-6)) ``` ```algebrite simplify(3/(x^2)+(x+9)/(x^2+5x)-2/(x^2+10x+25)) ``` -------------------------------- ### Calculate Greatest Common Divisor (GCD) Source: https://github.com/davidedc/algebrite/blob/master/tests-from-master/failed-tests.txt Use the gcd function to find the greatest common divisor of two algebraic expressions. This function can work with factored or unfactored expressions. ```algebrite gcd((x+1)*(x+1),x+1) ``` ```algebrite gcd(x+1,(x+1)*(x+1)) ``` ```algebrite gcd(factor((x+1)*(x+1)),x+1) ``` ```algebrite gcd(factor(x+1),(x+1)*(x+1)) ``` ```algebrite gcd((x+1)*(x+1),factor(x+1)) ``` ```algebrite gcd(x+1,factor((x+1)*(x+1))) ``` ```algebrite gcd(factor((x+1)*(x+1)),factor(x+1)) ``` ```algebrite gcd(factor(x+1),factor((x+1)*(x+1))) ``` ```algebrite gcd(x*(x+1)^2,x+1) ``` ```algebrite gcd(x+1,x*(x+1)^2) ``` ```algebrite gcd(factor(x*(x+1)^2),x+1) ``` ```algebrite gcd(factor(x+1),x*(x+1)^2) ``` ```algebrite gcd(x*(x+1)^2,factor(x+1)) ``` ```algebrite gcd(x+1,factor(x*(x+1)^2)) ``` ```algebrite gcd(factor(x*(x+1)^2),factor(x+1)) ``` ```algebrite gcd(factor(x+1),factor(x*(x+1)^2)) ``` ```algebrite gcd(x^2+7x+6,x^2-5x-6) ``` ```algebrite gcd(x^2-5x-6,x^2+7x+6) ``` ```algebrite gcd(factor(x*(x+1)),x+1) ``` ```algebrite gcd(x+1,factor(x*(x+1))) ``` ```algebrite gcd(factor(x*(x+1)),factor(x+1)) ``` ```algebrite gcd(factor(x+1),factor(x*(x+1))) ``` ```algebrite gcd(x^2+3x,x^2+5x) ``` ```algebrite gcd(x^2+5x,x^2+3x) ``` ```algebrite gcd(6x+20,2x+10) ``` ```algebrite gcd(2x+10,6x+20) ``` ```algebrite gcd(x^3-3x^2,4x^2-5x) ``` ```algebrite gcd(4x^2-5x,x^3-3x^2) ``` ```algebrite gcd(x^2-9,x^2+5x+6) ``` ```algebrite gcd(x^2+5x+6,x^2-9) ``` ```algebrite gcd(factor(x^2-9),x^2+5x+6) ``` ```algebrite gcd(factor(x^2+5x+6),x^2-9) ``` ```algebrite gcd(x^2-9,factor(x^2+5x+6)) ``` ```algebrite gcd(x^2+5x+6,factor(x^2-9)) ``` ```algebrite gcd(x^2-3x+2,x^2-1) ``` ```algebrite gcd(x^2-1,x^2-3x+2) ``` -------------------------------- ### Compute Matrix Determinant Source: https://context7.com/davidedc/algebrite/llms.txt Computes the determinant of a square matrix using Gaussian elimination for numerical matrices. Supports symbolic computation. ```javascript var Algebrite = require('algebrite'); // 2x2 determinant Algebrite.run('det([[1,2],[3,4]])'); // => "-2" // 3x3 determinant Algebrite.run('det([[1,2,3],[4,5,6],[7,8,9]])'); // => "0" (singular matrix) // Symbolic determinant Algebrite.run('det([[a,b],[c,d]])'); // => "a*d - b*c" // Larger matrices Algebrite.run('det([[1,0,0],[0,2,0],[0,0,3]])'); // => "6" (diagonal matrix) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.