Main Content

lhs

Left side (LHS) of equation

Description

lhsEqn = lhs(eqn) returns the left side of the symbolic equation eqn. The value of eqn also can be a symbolic condition, such as x > 0. If eqn is an array, then lhs returns an array of the left sides of the equations in eqn.

Conditions that use the > or >= operator are internally rewritten using the < or <= operator. Therefore, lhs returns the original right side. For example, lhs(x > 0) returns 0.

example

Examples

collapse all

Find the left side of the equation 2y=x2 by using lhs.

First, declare the equation.

syms x y
eqn = 2*y == x^2
eqn = 2y=x2

Find the left side of eqn by using lhs.

lhsEqn = lhs(eqn)
lhsEqn = 2y

Find the left side of the condition x+y<1 by using lhs.

First, declare the condition.

syms x y
cond = x + y < 1
cond = x+y<1

Find the left side of cond by using lhs.

lhsCond = lhs(cond)
lhsCond = x+y

For an array that contains equations and conditions, lhs returns an array of the left sides of those equations or conditions. The output array is the same size as the input array.

Find the left side of the equations and conditions in the vector V.

syms x y
V = [y^2 == x^2, x ~= 0, x*y >= 1]
V = (y2=x2x01xy)
lhsV = lhs(V)
lhsV = (y2x1)

Because any condition using the >= operator is internally rewritten using the <= operator, the sides of the last condition in V are exchanged.

Find the left side of a symbolic equation that involves symbolic matrix variables.

Create the symbolic matrix variables and the symbolic equation.

syms A [2 2] matrix
syms B [2 1] matrix
syms C [1 2] matrix
eqn = B*C == A*A - 2*A + eye(2)
eqn = BC=I2-2A+A2

Find the left side of the equation by using lhs.

lhsEqn = lhs(eqn)
lhsEqn = BC

Input Arguments

collapse all

Equation or condition, specified as a symbolic equation or condition, or a vector, matrix, or multidimensional array of symbolic equations or conditions.

Data Types: sym | symfun | symmatrix | symfunmatrix

Version History

Introduced in R2017a

expand all

See Also

| | |