isolate

Isolate variable or expression from equation

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

isolate(eq, expr)

Description

isolate(eq, expr) rearranges the equation eq so that the expression expr appears on the left side. The result is similar to solving eq for expr. However, isolate returns only one solution even if multiple solutions exist. If isolate cannot isolate expr from eq, it moves all terms containing expr to the left side. You can use the output of isolate as input to subs to eliminate expr from eq.

If eq has no solution, isolate returns an error. The isolate function also ignores special cases. If the only solutions to eq are special cases, then isolate ignores those special cases and returns an error. Additionally, if the solution returned contains parameters, the parameters might not be valid for special cases.

You cannot specify expr as a mathematical constant such as PI, EULER, and so on.

By default, isolate(eq, expr) returns only solutions consistent with the properties of expr.

If the input contains floating-point numbers, the solver replaces them by approximate rational values. The accuracy of these approximate values depends on the environment variable DIGITS. If isolate finds a solution, MuPAD® internally calls the float function for that solution, and then returns the result.

Environment Interactions

isolate reacts to properties of identifiers.

Examples

Example 1

Isolate x from the equation a*x^2 + b*x + c = 0.

eqn := a*x^2 + b*x + c = 0:
xSol := isolate(eqn, x)

Even though the equation has multiple solutions, isolate returns only one solution.

Eliminate x from eqn by calling subs to substitute for x using xSol.

subs(eqn, xSol)

You can also isolate expressions. Isolate x(t) from the following equation.

isolate(a*x(t)^2 + b*c = 0, x(t))

Isolate a*x(t) from the same equation.

isolate(a*x(t)^2 + b*c = 0, a*x(t))

If isolate cannot find a symbolic solution, it returns an error. Because isolate does not return special cases, it also returns an error if the only solutions are special cases.

Compare isolate with solve for an equation whose only solution is a special case.

solve(x = x+a, x);
isolate(x = x+a, x)

Error: Unable to isolate 'x' because the equation has no solution. [isolate]

solve returns the special case while isolate ignores the special case and returns an error.

Example 2

For equations with multiple solutions, isolate returns the ‘simplest’ solution.

Isolate x from equations with many solutions to demonstrate this behavior of isolate.

isolate(cos(x) = x, x)

isolate(x^2 = 1, x)

isolate(sin(x) = 0, x)

isolate(sqrt(x) = C, x)

Example 3

isolate only returns results compatible with assumptions on the variable to be isolated. For example, assume that x represents a real negative number. Then, isolate it from the following equation.

assume(x, Type::Negative):
isolate(x^4 = 1, x)

Remove the assumption. isolate chooses a different solution to return.

unassume(x):
isolate(x^4 = 1, x)

Example 4

If the input contains floating-point numbers, MuPAD calls the float function for the obtained solution.

Isolate x from an equation with floating-point numbers.

isolate(x^3 + 3.0*x + 1 = 0, x)

Example 5

You can isolate an expression in an equation with symbolic parameters. The isolate function returns a general solution where the parameter values are not guaranteed to hold for special cases.

Isolate x in the equation.

isolate(a*x^2/(x-a) = 1, x)

The returned value of x does not hold in the special case that parameter a has value 0.

Parameters

eq

An equation.

expr

The variable or expression to be isolated.

Return Values

isolate(eq, expr) returns an equation where the right side does not contain the variable or expression to be isolated. isolate does not introduce newly generated parameters. The returned equation is always a valid input to subs..

Introduced in R2015a