Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

Solve equations (solve)

Solve equations for one or more unknowns.

With this function, the solver shows the steps whenever it finds them.

How to write it

solve(equations, variables)

Solve for the unknowns.

equations
What to solve; a list of equations is a system. Takes an equation, or a list of equations in brackets.
variables
A variable, or a list of variables such as [x, y]. Takes a variable, or a list of variables.

solve(equations, variables, domain = real|complex)

Solve over the real or over the complex numbers.

equations
What to solve; a list of equations is a system. Takes an equation, or a list of equations in brackets.
variables
A variable, or a list of variables such as [x, y]. Takes a variable, or a list of variables.
domain = real|complex
Where to work: the real or the complex numbers. Takes real or complex.

Examples

  • x2−4=0⇒x=−2,x=2\displaystyle x^{2}-4 = 0 \Rightarrow x = -2,\quad x = 2
    solve(x^2 - 4 = 0, x)

    In the solver, solve(x^2 - 4 = 0, x) gives [[x -> -2], [x -> 2]].

    Open in the solver
  • {x+y=3x−y=1⇒(x,y)=(2,1)\displaystyle \begin{cases} x+y = 3 \\ x-y = 1 \end{cases} \Rightarrow (x, y) = (2, 1)
    solve([x + y = 3, x - y = 1], [x, y])

    In the solver, solve([x + y = 3, x - y = 1], [x, y]) gives [[x -> 2, y -> 1]].

    Open in the solver
  • x2+1=0⇒x=−i,x=i\displaystyle x^{2}+1 = 0 \Rightarrow x = -i,\quad x = i
    solve(x^2 + 1 = 0, x, domain = complex)

    In the solver, solve(x^2 + 1 = 0, x, domain = complex) gives [[x -> -i], [x -> i]].

    Open in the solver
  • solve_all

    Describe the complete solution set of equations and inequalities.

  • numeric_solve

    Solve equations numerically.

  • solve_identity

    Find the values of the parameters that make an equation true for every value of the variable.

  • linear_solve

    Solve a linear system A x = b given by its matrix and right-hand side.

  • eliminate

    Eliminate variables from a system of equations, leaving equations in the others.

  • least_squares

    The least-squares solution of A x = b.