Let's ask ourselves a task that is formulated as follows:

There is a function of one variable, which is given in matrix form.

Do not think that such functions do not exist. The very first example that comes to mind is practical problems in economics.

But it’s generally not about giving concrete examples from life.

Now the task is, but how, in general, to investigate such a matrix function for maximums, minimums?

Of course, you can substitute a numerical value instead of an unknown parameter, find out the value of the function and move in this way, you can use the approximation honey, or rather, use the poke method to find the minima and maxima, as well as the roots of this matrix equation.

The second option is to decompose this matrix into a polyminal function. Yes, this is the most reasonable, but not the easiest way, although in our example such a solution can be applied.

Reduce and get our final answer

Not bad, but what if the matrix has dimensions of 4, 5, or ten columns?

I am not sure that someone in solid memory will undertake to solve the 5 * 5 matrix with, for example, 12 unknowns.

And if the elements of the matrix are complex ?? The same..

In order not to break brains, it is also easy to turn matrix functions into polynomial and this bot was created

**Update 08.17.2015: What we calculate in this material is widely used in higher mathematics and is called the characteristic equation.** **Such characteristic equations, for example, are used to bring a curve or a second-order surface into a canonical form.**

## Syntax

For those who use XMPP clients, just enter the command **poly_m matrix elements**

Matrix elements - must be separated by a space. Elements can be any numbers or functions. Including complex

__We consider matrices only not more than 8 * 8.____Be careful when calculating.__

## Example

Immediately take for example the case that we cited above.

So given the function

and 9 unknown cells which are equal to x. Bring this function to polynomial

Well, decide with pens? :)

Let's try to feed this matrix to our bot.

poly_m x 8 xx 6 -4 9 xx 0 2 -2 0 0 -3 -1 xxx 0 5 -2 -7 0 x

In response, we get

this is our polynomial function of the matrix.

This view provides completely different possibilities. This function is easier to research, and based on the analysis to make certain decisions.

Check it out? Yes easily

we determine what the resulting function is equal to, for example, for x = 3, and determine what the determinant of the matrix is equal to if we replace all unknown x in the matrix with the value -3

In both cases, we get a value of 900. Which proves that the calculations were made correctly.

We complicate our task and the matrix will be complex

We give the bot this line 0: 1 x -2 0: -1 0: 1 0: -1 9 xx 0 2 -2 0 1 -3 -1 x -x 3 * x 0 x 0: -2 -7: 1 x 2

The answer will not keep us waiting long and the next function will be the answer

Let's check her too

Let x = 1-i

The function gives the answer **-680.0000000001-1248i**

If in the matrix we replace all the unknowns with this number and calculate the determinant, then we will get the same value.