Main Content

eliminate

Eliminate variables from rational equations

Description

example

expr = eliminate(eqns,vars) eliminates the variables vars from the rational equations eqns. The result is a vector of symbolic expressions that is equal to zero.

Examples

collapse all

Create two rational equations that contain the variables x and y.

syms x y
eqns = [x*y/(x-2) + y == 5/(y - x), y-x == 1/(x-1)]
eqns = 

(y+xyx-2=-5x-yy-x=1x-1)[y + (x*y)/(x - 2) == -5/(x - y), y - x == 1/(x - 1)]

Eliminate the variable x. The result is a symbolic expression that is equal to zero.

expr = eliminate(eqns,x)
expr = [6y2-5y-75][6*y^2 - 5*y - 75]

Create two polynomial equations that contain the variables x and y.

syms x y
eqns = [2*x+y == 5; y-x == 1]
eqns = 

(2x+y=5y-x=1)[2*x + y == 5; y - x == 1]

Eliminate the variable x from the equations. The result is a symbolic expression that is equal to zero.

expr = eliminate(eqns,x)
expr = [3y-7][3*y - 7]

Now, create three polynomial equations that contain the variables x, y, and z. Eliminate the variable x. The result is a vector of symbolic expressions that is equal to zero.

syms z
eqns = [x^2 + y-z^2 == 2;
        x - z == y;
        x^2 + y^2-z == 4];
expr = eliminate(eqns,x)
expr = [5z3-5z2-8z+4y-8,5z4-11z2-18z-8][5*z^3 - 5*z^2 - 8*z + 4*y - 8, 5*z^4 - 11*z^2 - 18*z - 8]

To eliminate both x and y, use the eliminate function and specify the two variables as the vector [x y].

expr = eliminate(eqns,[x y])
expr = [5z4-11z2-18z-8][5*z^4 - 11*z^2 - 18*z - 8]

Input Arguments

collapse all

Rational equations, specified as a vector of symbolic equations or symbolic expressions. A rational equation is an equation that contains at least one fraction in which the numerator and the denominator are polynomials.

The relation operator == defines symbolic equations. If a symbolic expression eqn in eqns has no right side, then a symbolic equation with a right side equal to 0 is assumed.

Variables to eliminate, specified as a vector of symbolic variables.

See Also

|

Introduced in R2018a