%display latex
reset()
Vetores são constrídos pelo comando vector
, com sintaxe vector([x1,x2,x3,...,xn])
v = vector([x,x^8,5])
print(parent(v))
Vector space of dimension 3 over Symbolic Ring
w=vector([5,2,1])
v.cross_product(w)
v*w
v.dot_product(w)
var('y', domain='real')
z = vector([I*2,x,y]);
z*w
z.hermitian_inner_product(w)
w.norm()
z.norm()
a = matrix(SR,[[1,2,3],[5,23,8],[8,5,1]]);a
(a).transpose()*z
z*a
matrix.zero(10,15)
matrix.identity(4)
matrix.ones(3)
d = matrix.diagonal([y,y,y^2])
d.det()
d.trace()
d.transpose()
d.conjugate()
d.inverse()
T = linear_transformation(a)
T
print(T)
Vector space morphism represented by the matrix: [ 1 2 3] [ 5 23 8] [ 8 5 1] Domain: Vector space of dimension 3 over Symbolic Ring Codomain: Vector space of dimension 3 over Symbolic Ring
T.is_bijective()
d.charpoly()
a.eigenvalues()
a.eigenvectors_right()
k = matrix([[1,1,-3],[0,4,0],[-3,3,1]])
k.eigenvectors_right()
k.eigenmatrix_right()
onde I é a matriz identidade
m1 = matrix([[1,2],[2,2]]);m1
exp(m1)
var('theta')
exp((i/2)*theta*matrix([[0,i],[-i,0]]))
x.simplify_rectform()
Rotações
J1 = I*matrix([[0,0,0,0],[0,0,0,0],[0,0,0,-1],[0,0,1,0]])
J2 = I*matrix([[0,0,0,0],[0,0,0,1],[0,0,0,0],[0,-1,0,0]])
J3 = I*matrix([[0,0,0,0],[0,0,-1,0],[0,1,0,0],[0,0,0,0]])
show(J1,J2,J3)
th = var('theta',n=4);th
R1 = exp(I*th[1]*J1)
R2 = exp(I*th[2]*J2)
R3 = exp(I*th[3]*J3)
show(R1,R2,R3)
R1[2,2].expand().simplify_rectform()
R1.expand()
Funçãozinha em Python
def resolve(M):
for lin in range(4):
for col in range(4):
M[lin,col] = M[lin,col].expand().simplify_rectform()
return M
resolve(R1);resolve(R2);resolve(R3)
show(R1,R2,R3)
Boosts
K1 = -I*matrix([[0,1,0,0],[1,0,0,0],[0,0,0,0],[0,0,0,0]])
K2 = -I*matrix([[0,0,1,0],[0,0,0,0],[1,0,0,0],[0,0,0,0]])
K3 = -I*matrix([[0,0,0,1],[0,0,0,0],[0,0,0,0],[1,0,0,0]])
show(K1,K2,K3)
B1 = exp(I*th[1]*K1).expand()
B2 = exp(I*th[1]*K2).expand()
B3 = exp(I*th[1]*K3).expand()
show(B1,B2,B3)
eta = diagonal_matrix([-1,1,1,1]);eta
(R1.transpose()*eta*R1).simplify_trig()
(B3.transpose()*eta*B3).expand()
M = VectorSpace(SR,4, inner_product_matrix=eta)
w = M([3,2,1,2]);w
u = M([3,0,1,2]);u
w.dot_product(w) #Euclidiano
w.inner_product(u) #Minkowski
w*eta*u
(w).inner_product(w)
(u).inner_product(u)
w.norm()
sqrt(u*eta*u)