First time here? Check out the FAQ!

Ask Your Question
0

checking left hand side of an equation

asked 11 years ago

jeanpat gravatar image

updated 11 years ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 11 years ago

tmonteil gravatar image

updated 11 years ago

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.

Preview: (hide)
link

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: 11 years ago

Seen: 757 times

Last updated: Jan 03 '14