Ask Your Question
0

checking left hand side of an equation

asked 2014-01-03 10:49:49 +0100

jeanpat gravatar image

updated 2014-01-03 12:01:49 +0100

Hi, I'd like to check if the operation applied to an equation yields the solution as follow: a=var('a') eq= a+7==6

print eq.lhs()
LHS =(eq-7).lhs()
print LHS
LHS==a
a is a
LHS is a

I was waiting that the line LHS==a yields True or False. How can I check that LHS contains the variable a?

edit

`LHS is a`

yields False

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-01-03 12:21:46 +0100

tmonteil gravatar image

updated 2014-01-03 12:27:09 +0100

The problem here is that, since LHS is a symbolic expression, then LHS == a will also be a symbolic expression, not a boolean, see:

sage: LHS.parent()
Symbolic Ring
sage: (LHS == a).parent()
Symbolic Ring

You can try:

sage: bool(LHS == a)
True

Also, LHS is a yields to False since LHS and a do not point to the same object in memory.

edit flag offensive delete link more

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: 2014-01-03 10:49:49 +0100

Seen: 728 times

Last updated: Jan 03 '14