Revision history [back]

Evaluate polynomial on matrices

Given the polynomial $f = (xy-yx)z \in \mathbb R[x,y,z]$, how can I evaluate it on matrices?

sage: A=random_matrix(QQ,2)
sage: A
[1 1]
[1 2]
sage: B=random_matrix(QQ,2)
sage: B
[ 0  0]
[-1  0]
sage: C=random_matrix(QQ,2)
sage: C
[ 1 -2]
[ 1 -1]
sage: R.<x,y,z> = PolynomialRing(QQ)
sage: f = (x*y-y*x)*z
sage: f(A,B,C)
0
sage: (A*B-B*A)*C
[-1  2]
[ 0  1]


Given the polynomial $f = (xy-yx)z \in \mathbb R[x,y,z]$, Q[x,y,z]$, how can I evaluate it on matrices? sage: A=random_matrix(QQ,2) sage: A [1 1] [1 2] sage: B=random_matrix(QQ,2) sage: B [ 0 0] [-1 0] sage: C=random_matrix(QQ,2) sage: C [ 1 -2] [ 1 -1] sage: R.<x,y,z> = PolynomialRing(QQ) sage: f = (x*y-y*x)*z sage: f(A,B,C) 0 sage: (A*B-B*A)*C [-1 2] [ 0 1]  Evaluate polynomial on matrices Given the polynomial$f = (xy-yx)z \in \mathbb Q[x,y,z]$, how How can I evaluate it on matrices?construct a map$M_2(\mathbb Q)^3 \to M_2(\mathbb Q), (A,B,C) \to (AB-BA)C$where$M_2(\mathbb Q)$denotes the space of 2x2 matrices. sage: A=random_matrix(QQ,2) sage: A [1 1] [1 2] sage: B=random_matrix(QQ,2) sage: B [ 0 0] [-1 0] sage: C=random_matrix(QQ,2) sage: C [ 1 -2] [ 1 -1] sage: R.<x,y,z> = PolynomialRing(QQ) sage: f = (x*y-y*x)*z sage: f(A,B,C) 0 sage: (A*B-B*A)*C [-1 2] [ 0 1]  Evaluate polynomial on matrices How can I construct a map$M_2(\mathbb Q)^3 \to M_2(\mathbb Q), (A,B,C) \to (AB-BA)C$where$M_2(\mathbb Q)$denotes the space of 2x2 matrices. sage: A=random_matrix(QQ,2) sage: A [1 1] [1 2] sage: B=random_matrix(QQ,2) sage: B [ 0 0] [-1 0] sage: C=random_matrix(QQ,2) sage: C [ 1 -2] [ 1 -1] sage: R.<x,y,z> = PolynomialRing(QQ) sage: f = (x*y-y*x)*z sage: f(A,B,C) 0 sage: (A*B-B*A)*C [-1 2] [ 0 1]  Evaluate polynomial expression on matrices How can I construct a map$M_2(\mathbb Q)^3 \to M_2(\mathbb Q), (A,B,C) \to \mapsto (AB-BA)C$where$M_2(\mathbb Q)$denotes the space of 2x2 matrices. sage: A=random_matrix(QQ,2) sage: A [1 1] [1 2] sage: B=random_matrix(QQ,2) sage: B [ 0 0] [-1 0] sage: C=random_matrix(QQ,2) sage: C [ 1 -2] [ 1 -1] sage: R.<x,y,z> = PolynomialRing(QQ) sage: f = (x*y-y*x)*z sage: f(A,B,C) 0 sage: (A*B-B*A)*C [-1 2] [ 0 1]  Evaluate polynomial expression on matrices How can I construct a map$M_2(\mathbb Q)^3 \to M_2(\mathbb Q), (A,B,C) \mapsto (AB-BA)C$where$M_2(\mathbb Q)$denotes the space of 2x2 matrices. sage: A=random_matrix(QQ,2) x,y,z = var('x y z') sage: A [1 1] [1 2] f=(x*y-y*x)*z sage: B=random_matrix(QQ,2) sage: B [ 0 0] [-1 0] sage: C=random_matrix(QQ,2) sage: C [ 1 -2] [ 1 -1] sage: R.<x,y,z> = PolynomialRing(QQ) sage: f = (x*y-y*x)*z sage: f(A,B,C) f 0 sage: (A*B-B*A)*C [-1 2] [ 0 1]  Evaluate polynomial expression on matrices How can I construct a map$M_2(\mathbb Q)^3 \to M_2(\mathbb Q), (A,B,C) \mapsto (AB-BA)C$where$M_2(\mathbb Q)$denotes the space of 2x2 matrices. sage: x,y,z = var('x y z') sage: f=(x*y-y*x)*z sage: f 0  Evaluate polynomial expression "polynomial expression" on matrices How can I construct a map$M_2(\mathbb Q)^3 \to M_2(\mathbb Q), (A,B,C) \mapsto (AB-BA)C$where$M_2(\mathbb Q)\$ denotes the space of 2x2 matrices.

sage: x,y,z = var('x y z')
sage: f=(x*y-y*x)*z
sage: f
0