Ask Your Question
0

right_kernel of a symbolic matrix has a division by zero

asked 2024-10-08 18:25:58 +0100

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-10-08 18:33:05 +0100

Max Alekseyev gravatar image

This is expected as t=0 makes the denominator zero. You need to not substitute t=0 but find the limit as t tends to 0 here:

P.right_kernel().matrix()[0].apply_map(lambda z: z.limit(t=0))
edit flag offensive delete link more

Comments

Yes, but nothing is special with t=0 in this problem. Shouldn't right_kernel() provide a basis that is valid for all t. Wouldn't it be more correct if the right kernel returned a vector space with basis [sin(t), - (cos(t) - 1)], so that it is valid for all t?

odewolf@gmail.com gravatar imageodewolf@gmail.com ( 2024-10-09 04:58:39 +0100 )edit

Point t=0is special as it is a break point where the function - (cos(t) - 1)/sin(t) is undefined. It is a removable discontinuity though.

There is no concept of "valid basis", but you can modify the one computed as you like - e.g. multiply it by the denominator sin(t).

Max Alekseyev gravatar imageMax Alekseyev ( 2024-10-09 06:17:02 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-10-08 18:25:58 +0100

Seen: 136 times

Last updated: Oct 08