Main Content

# uminus

Unary minus for Laurent polynomial or Laurent matrix

## Syntax

``Q = uminus(P)``
``Q = -P``

## Description

example

````Q = uminus(P)` negates the Laurent polynomial or the Laurent matrix specified by `P`. If `P` is a Laurent matrix, `uminus` negates the matrix elements. NoteThe `laurentPolynomial` and `laurentMatrix` objects have their own versions of `uminus`. The input data type determines which version is executed. ```
````Q = -P` is equivalent to `Q = uminus(P)`.```

## Examples

collapse all

Create a Laurent polynomial

`a = laurentPolynomial(Coefficients=[-2 6 -7 -2 1],MaxOrder=3);`

Confirm the sum of $a\left(z\right)$ and its unary minus is 0.

```au = uminus(a); a+au```
```ans = laurentPolynomial with properties: Coefficients: 0 MaxOrder: 0 ```

Create the Laurent polynomials

• $a\left(z\right)=z+1$

• $b\left(z\right)={z}^{2}+z+{z}^{-1}$

• $c\left(z\right)=z$

• $d\left(z\right)={z}^{2}+{z}^{-1}$

```lpA = laurentPolynomial(Coefficients=[1 1],MaxOrder=1); lpB = laurentPolynomial(Coefficients=[1 1 0 1],MaxOrder=2); lpC = laurentPolynomial(Coefficients=[1],MaxOrder=1); lpD = laurentPolynomial(Coefficients=[1 0 0 1],MaxOrder=2);```

Create the matrix `lmat` = $\left[\begin{array}{cc}\mathit{a}\left(\mathit{z}\right)& \mathit{b}\left(\mathit{z}\right)\\ \mathit{c}\left(\mathit{z}\right)& \mathit{d}\left(\mathit{z}\right)\end{array}\right]$.

`lmat = laurentMatrix(Elements={lpA,lpB;lpC,lpD});`

Confirm the sum of `lmat` and its unary negative is 0.

```lmatu = uminus(lmat); xmat = lmat+lmatu; dispMat(xmat)```
```| 0.00e+00 0.00e+00 | | | | 0.00e+00 0.00e+00 | ```

## Input Arguments

collapse all

Laurent polynomial or Laurent matrix, specified as a `laurentPolynomial` object or a `laurentMatrix` object, respectively.

## Output Arguments

collapse all

Negated Laurent polynomial or Laurent matrix, returned as a `laurentPolynomial` object or a `laurentMatrix` object. If `P` is a Laurent polynomial, the coefficients are negated.

## Version History

Introduced in R2021b