Algebra and calculus#
Solve equations#
Put the equation in quotes, including the =, then name the variable to solve for. Any other unassigned name stays symbolic, and numeric coefficients you assigned earlier in the note are available.
solve("x^2=9","x")Interactive examples could not load. You can still copy the expressions.
Use solveEquations for a simultaneous system and solveFor to rearrange an equation around one named variable. A solver can return several roots, so substitute each answer back into the original equation and check the domain.
Differentiate and integrate#
derivative and diff differentiate. integrate returns an antiderivative, so add your own constant of integration where it matters. defint takes lower and upper bounds plus an optional variable. Not every integral has an elementary closed form.
integrate("x^2","x")Interactive examples could not load. You can still copy the expressions.
derivative("x^3+2*x","x")
defint("x^2",0,1,"x")
limit("sin(x)/x","x",0)Interactive examples could not load. You can still copy the expressions.
Transform expressions#
simplify, factor, expand, partfrac, completeSquare, and roots cover the common transformations. sub substitutes a value for a variable. laplace and inverseLaplace handle transforms. summation and the four-argument prod evaluate symbolic sums and products.
factor("x^2-1")
expand("(x+1)^2")
sub("x^2+1","x",3)
summation("k","k",1,4)
prod("k","k",1,4)Interactive examples could not load. You can still copy the expressions.
Reading the result#
These symbolic functions display either an expression or a number. A displayed symbolic result is not a parsed expression, so it has no .evaluate() method. To substitute, call sub(expression, variable, value). To evaluate a numeric expression from a string, use evaluate(expressionString, scope).
Use tex to typeset source expressions and latex for a literal LaTeX string. Never assume that a symbolic result's .toString() is valid expression source. The individual function pages list the supported syntax and the return behavior.
The helpers rationalize and symbolicEqual are currently incompatible with the app's symbolic wrappers; their reference pages explain the alternatives.
Numerical differential equations#
solveODE integrates an initial-value system numerically. Give it a derivative function, a time interval, and an initial state. This is different from finding a symbolic solution. See its editable example.