Main Content

Solve Symbolic Equation

Find analytic solutions of symbolic equations in Live Editor

Since R2020a

Description

The Solve Symbolic Equation task enables you to interactively find analytic solutions of symbolic equations. The task automatically generates MATLAB® code for your live script. For more information about Live Editor tasks, see Add Interactive Tasks to a Live Script.

Using this task, you can:

  • Find analytic solutions of symbolic equations, which include a single equation and a system of algebraic equations.

  • Specify the solver options to find solutions.

  • Generate the code used to solve equations.

Solve Symbolic Equation task in Live Editor

Open the Task

To add the Solve Symbolic Equation task to a live script in the MATLAB Editor:

  • On the Live Editor tab, select Task > Solve Symbolic Equation.

  • In a code block in your script, type a relevant keyword, such as solve, symbolic, or equation. Select Solve Symbolic Equation from the suggested command completions.

Parameters

expand all

Select this check box to return solutions for which every subexpression of the equation represents a real number. This option assumes all parameters of the equation represent real numbers.

Select this check box to return a single solution (principal value). If an equation or a system of equations does not have any solution, the solver returns an empty symbolic object.

Select this check box to return the more general solution and the analytic constraints under which the solution holds. This option returns a structure with the fields parameters and conditions that contain the parameters in the solution and the conditions under which they hold, respectively.

Select this check box to express the root function in terms of square roots in the solutions. The results can be lengthy or less accurate for floating-point approximations.

Select this check box to apply purely algebraic simplifications, such as log(a) + log(b) = log(a*b) with the assumption that a and b are real positive numbers. Setting Ignore analytic constraints to on can give you simpler solutions, which could lead to results not generally valid. In other words, this option applies mathematical identities that are convenient for most engineering workflow, but do not always hold for all values of variables. In some cases, it also enables the Solve Symbolic Equation task to solve equations and systems that cannot be solved otherwise. For details, see Algorithms.

Select this check box to ignore assumptions on the variables to solve for. This option may include solutions that are inconsistent with assumptions on the variables to solve for.

Algorithms

When you use Ignore analytic constraints, the solver applies some of these rules to the expressions on both sides of an equation.

  • log(a) + log(b) = log(a·b) for all values of a and b. In particular, the following equality is valid for all values of a, b, and c :

      (a·b)c = ac·bc.

  • log(ab) = b·log(a) for all values of a and b. In particular, the following equality is valid for all values of a, b, and c :

      (ab)c = ab·c.

  • If f and g are standard mathematical functions and f(g(x)) = x for all small positive numbers, f(g(x)) = x is assumed to be valid for all complex values x. In particular:

    • log(ex) = x

    • asin(sin(x)) = x, acos(cos(x)) = x, atan(tan(x)) = x

    • asinh(sinh(x)) = x, acosh(cosh(x)) = x, atanh(tanh(x)) = x

    • Wk(x·ex) = x for all branch indices k of the Lambert W function.

  • The solver can multiply both sides of an equation by any expression except 0.

  • The solutions of polynomial equations must be complete.

Version History

Introduced in R2020a

See Also

Functions

Live Editor Tasks