Left hand side of equations, inequalities, relations, intervals, ranges and tables

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.




lhs(f) returns the left hand side of f.

The call lhs(f) is equivalent to the direct call op(f, 2), of the operand function op, if f is not a table.

If t is a table, the call lhs(t) returns the list of keys of the table (left hand side). Note that the i-th value in rhs(t) corresponds to the i-th key in lhs(t).


Example 1

We extract the left and right hand sides of various objects:

lhs(x = sin(2)), lhs(3.14 <> PI), lhs(x + 3 < 2*y),
rhs(a <= b), rhs(m-1..n+1)

The operands of an expression depend on its internal representation. In particular, a "greater" relation is always converted to the corresponding "less" relation:

y > -infinity; lhs(y > -infinity)

y >= 4; rhs(y >= 4)

Example 2

We extract the left and right hand sides of the solution of the following system:

s := solve({x + y = 1, 2*x - 3*y = 2})

map(op(s), lhs) =  map(op(s), rhs)

Calls to lhs and rhs may be easier to read than the equivalent calls to the operand function op:

map(op(s), op, 1) = map(op(s), op, 2)

However, direct calls to op should be preferred inside procedures for higher efficiency.

delete s:

Example 3

We extract the keys (left hand side) and values (right hand side) from a table:

t := table(1=2, 4=PI, 5=5.6, 19=1/2):
l := lhs(t);

r := rhs(t);

Note that the i-th value corresponds to the i-th key:

bool(r = map(lhs(t), e->t[e]))

delete t,l,r:



An equation x = y, an inequality x <> y, a relation x < y, a relation x <= y, an "is element of"-relation x in y, an interval x...y, a range x..y or a table table(x=y,...)

Overloaded By


See Also

MuPAD Functions

Was this topic helpful?