Ask Your Question

Revision history [back]

right_kernel of a symbolic matrix has a division by zero

I have a matrix with a symbolic variable t. If I first substitute t to 0, then I have a valid (right) kernel: a vector space with basis [1,0]

If I first compute the (right) kernel, I have a vector space with basis [1, - (cos(t) - 1)/sin(t)]. So, If I evaluate the basis at t=0, I have a divide by zero ValueError.

How could it be? Is there not a way to have right_kernel to return a vector space with basis [sin(t), - (cos(t) - 1)], so that I would avoid this disagreement?

var('t')
P = matrix([[cos(t) - 1 , sin(t)],[sin(t), -cos(t) - 1]])

P.right_kernel()

# Vectorspace with basis [1,0]
P(t=0).right_kernel()

# Vectorspace with basis [1, - (cos(t) - 1)/sin(t)]
P.right_kernel()  

# raise a ValueError: power::eval(): division by zero
P.right_kernel().matrix()[0](t=0)

Also, if I substitute the matrix basis at t=2 I obtained correctly P.right_kernel().matrix()(t=2) # --> [1 -(cos(2) - 1)/sin(2)]

But if I substitute at t=0 P.right_kernel().matrix()(t=0) # --> [1 -(cos(t) - 1)/sin(t)] (without any substitution or ValueError "divide by zero" as I would have expected)

Do I miss something obvious?