Complex conjugation
MuPAD® notebooks are not recommended. 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.
conjugate(z
) conjugate(L
)
conjugate(z)
computes the conjugate ℜ(z)
 i ℑ(z) of
a complex number z = ℜ(z)
+ i ℑ(z).
For numbers of
type DOM_INT
, DOM_RAT
, DOM_FLOAT
,
or DOM_COMPLEX
,
the conjugate is computed directly and very efficiently.
conjugate
can handle symbolic expressions. Properties of
identifiers are taken into account (see assume
). An identifier z
without
any property is assumed to be complex, and the symbolic call conjugate(z)
is
returned. See Example 2.
conjugate
knows how to handle special mathematical
functions, such as:
_mult _plus _power abs cos cosh cot coth csc csch erf erfc exp gamma igamma sec sech sin sinh tan tanh
If conjugate
does not know how to handle
a special mathematical function, then a symbolic conjugate
call
is returned. See Example 3.
This function is automatically mapped to all entries of container objects such as arrays, lists, matrices, polynomials, sets, and tables.
conjugate
is sensitive to properties of
identifiers set via assume
.
conjugate
knows how to handle sums, products,
the exponential function and the sine function:
conjugate((1 + I)*exp(2  3*I))
delete z: conjugate(z + 2*sin(3  5*I))
conjugate
reacts to properties of identifiers:
delete x, y: assume(x, Type::Real): conjugate(x), conjugate(y)
If the input contains a function that the system does not know,
then a symbolic conjugate
call is returned:
delete f, z: conjugate(f(z) + I)
Now suppose that f
is some userdefined mathematical
function, and that $$\overline{f\left(z\right)}=f\left(\overline{z}\right)$$ holds
for all complex numbers z.
To extend the functionality of conjugate
to f
,
we embed it into a function environment and
suitably define its "conjugate"
slot:
f := funcenv(f): f::conjugate := u > f(conjugate(u)):
Now, whenever conjugate
is called with an
argument of the form f(u)
, it calls f::conjugate(u)
,
which in turn returns f(conjugate(u))
:
conjugate(f(z) + I), conjugate(f(I))
 

A container object: an array, an hfarray, a list, a matrix, a polynomial, a set, or a table. 
arithmetical expression or a container object containing such expressions
z
If a subexpression of the form f(u,...)
occurs
in z
and f
is a function environment, then conjugate
attempts
to call the slot "conjugate"
of f
to
determine the conjugate of f(u,...)
. In this way,
you can extend the functionality of conjugate
to
your own special mathematical functions.
The slot "conjugate"
is called with the arguments u
,...
of f
.
If f
has no slot "conjugate"
,
then the subexpression f(u,...)
is replaced by
the symbolic call conjugate(f(u,...))
in the returned
expression.
See Example 3.
Similarly, if an element d
of a library domainT
occurs
as a subexpression of z
, then conjugate
attempts
to call the slot "conjugate"
of that domain with d
as
argument to compute the conjugate of d
.
If T
does not have a slot "conjugate"
,
then d
is replaced by the symbolic call conjugate(d)
in
the returned expression.