Assume that n is positive integer

asked 2016-04-22 11:24:24 +0100

Kofi gravatar image

It seems I cannot make Sage assume that the variable n is a positive integer.

var('n')
assume(n, 'integer')
assume(n>0)

In this code, the "n>0" overwrites the assumption that n is an integer. The command

n.is_integer()

returns false. How do I do this?

edit retag flag offensive close merge delete

Comments

It is pretty weird. If you type

assume(n,'integer')
assume(n>0)

The command

assumptions()

returns

[ n is integer,n > 0,]

and

n.is_integer()

returns false. But if you assume the other way around

assume(n>0)
assume(n,'integer')

then

n.is_integer()

returns true. I guess it's a sort of bug

roberto gravatar imageroberto ( 2016-04-23 02:04:15 +0100 )edit