Back to functions
solve
solve
Similiar to solveFor this will solve for a given variable. The difference is that this is a self contained function.
Usage: nerdamer("nerdamer("solve(expression, variable")")
Parameters
Expression
expression
|
The expression to solve |
String
variable
|
The variable to solve for. |
Returns
Symbol[]
// If a formula is provided, then it will be assumed to equal zero.
var x = nerdamer('solve(x^3+1, x)');
console.log(x.toString());
x = nerdamer.solve('x^2+2*x+1', 'x');
console.log(x.toString());
x = nerdamer.solve('3*(x+a)*(x-b)', 'x');
console.log(x.toString());
x = nerdamer.solve('3*(x+a)*(x-b)', 'x');
console.log(x.toString());
// Full equations are also supported.
x = nerdamer('solve(x^4=1,x)');
console.log(x.toString());
x = nerdamer('solve(y=m*x+c, x)');
console.log(x.toString());