# `multcoeffs`

Multiply the coefficients of a polynomial with a factor

MuPAD® notebooks will be removed in a future release. 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.

## Syntax

```multcoeffs(`p`, `c`)
multcoeffs(`f`, <`vars`>, `c`)
```

## Description

`multcoeffs(p, c)` multiplies all coefficients of the polynomial `p` with the factor `c`.

A polynomial expression `f` is first converted to a polynomial with the variables given by `vars`. If no variables are given, they are searched for in `f`. See `poly` about details of the conversion. `FAIL` is returned if `f` cannot be converted to a polynomial. After multiplication with `c`, the result is converted to an expression.

For a polynomial expression `f`, the factor `c` may be any arithmetical expression. For a polynomial `p` of type `DOM_POLY`, the factor `c` must be convertible to an element of the coefficient ring of `p`.

## Examples

### Example 1

Some simple examples:

`multcoeffs(3*x^3 + x^2*y^2 + 2, 5)`
` `
`multcoeffs(3*x^3 + x^2*y^2 + 2, c)`
` `
`multcoeffs(poly(x^3 + 2, [x]), sin(y))`
` `

### Example 2

Mathematically, `multcoeffs(f, c)` is the same as `f*c`. However, `multcoeffs` produces an expanded form of the product which depends on the indeterminates:

```f := 3*x^3 + x^2*y^2 + 2: multcoeffs(f, [x], c), multcoeffs(f, [y], c), multcoeffs(f, [z], c)```
` `
`delete f:`

## Parameters

 `p` A polynomial of type `DOM_POLY` `c` An arithmetical expression or an element of the coefficient ring of `p` `f` `vars` A list of indeterminates of the polynomial: typically, identifiers or indexed identifiers

## Return Values

Polynomial of type `DOM_POLY`, or a polynomial expression, or `FAIL`.

` f`, `p`