Ask Your Question

Assumptions in sage

asked 2012-10-25 10:04:20 -0600

sage_learner gravatar image


I am a sage beginner and I wish to know that How sage handles assumptions ?

My example is as follows.

a= var('a'); solve((a-1)*x ==3, x);

and sage solves and gives correct solution [x==(3 / (a - 1))]. But here how the assumption (a != 1) is handled ? Because solution is not defined for (a=1).

Best regards


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-10-25 16:04:00 -0600

benjaminfjones gravatar image

I would say that 3 / (a-1) is a "symbolic solution"; meaning it's a solution for a particular value of a if and only if it makes sense for that a (i.e. there is no division by zero, etc..). The solve command will return symbolic solutions when possible because they generally make sense for almost all values of any symbolic parameter. You have to take care that solutions may not make sense for some particular values of the parameters.

edit flag offensive delete link more


I got it.. Thank you. I wish to understand something regarding following code. x = var('x'); assume(x>0); print([x>0] == [1==1]) Sage answers it as "False" In the above piece of code "[x>0] == [1==1]" is logically true but it is gives False. I wish to know How does comparison operator "==" works ? Specially when comparing two predicates ? Does there any other function exist for such comparison ? Best regards

sage_learner gravatar imagesage_learner ( 2012-10-26 02:14:34 -0600 )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


Asked: 2012-10-25 10:04:20 -0600

Seen: 155 times

Last updated: Oct 25 '12