Vectorization
- task7
You are given a row matrix, for example,
a = [1, 2, -2, 4]
and a numberx
, for example, 1. The rowa
specifies coefficients of a polinomial, starting from the lowest degree, that is, the row from the example specifies the polynomial . Compute the value of the polinomial at the pointx
. The answer in the example is 5. - task8
You are given a column matrix
. Create a square matrix of the same size, its value in the row number and the column number should be equal to . - task9 You are given a three columns matrix. Imagine, that each row specifies a line of the form
, whith the columns being, correspondingly,a
,b
,c
. Return a matrix, that has two columns, correspondingly,k
иb
, that define the same lines, but in the form . For example, the row[1 1 1]
should be converted to the row[-1 -1]
. - all2dets(x). You are given a matrix
x
of two columns. Return a new square matrix with the size equal to the number of rows inx
. An element in the row number and the column number should be equal to . This is a determinant of a matrix composed from the i-th and the j-th rows ofx
. I remind that . -
all_lines_intersections(a). You are given a matrix
а
of three columns, it describes a set of lines (as previously). The short task statement is: intersect each line with each line. To be more specific: the intersection of the line from the i-th row and the line from j-th row has two coordinates and . The function should return two matricesx
andy
. The first one contains the x-coordinate of this intersection in the row and the column . The second one contains, correspondingly, the y-coordinate. Don’t consider the case of parallel lines.Here is the formula for intersection of lines
= 0 and :Δ = det([a1 b1; a2 b2]) Δx = det([-c1 b1; -c2 b2]) Δy = det([a1 -c1; a2 -c2]) x = Δx / Δ y = Δy / Δ
So, you will need a previously implemented
all2dets
function.