Ask Your Question
2

order of assume

asked 2015-12-04 11:34:49 +0100

daniele gravatar image

updated 2015-12-04 15:00:13 +0100

tmonteil gravatar image

I am working on cloud-sagemath. I have a question on how "assume" works.

I type:

 E.<x,y> = ExteriorAlgebra(SR)
_ = var('t')
psi = t*x+y
assume(t==0)
psi

when I check the output the first time with shift+enter, I just get

t * x + y

The second time, I get the expected answer:

y

Why? how to force the second answer since the beginning?

thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-12-04 13:53:35 +0100

tmonteil gravatar image

updated 2015-12-04 15:01:25 +0100

The problems seems to be the following: actually, psi is uncompletely aware of the fact that t is equal to zero:

sage: psi - y
0
sage: psi == y
False

The problem seems to be that some data regarding psi (in particular the string that represent psi) seem cached, and the cache is not updated during the assumption:

sage: psi._cache_key()
(The exterior algebra of rank 2 over Symbolic Ring, 't*x + y')

You can workaround in two ways:

First, you can assume before defining psi:

sage: E.<x,y> = ExteriorAlgebra(SR)
sage: _ = var('t')
sage: assume(t==0)
sage: psi = t*x+y
sage: psi
y

If it is not possible, you can redefine psi as follows:

sage:  E.<x,y> = ExteriorAlgebra(SR)
sage: _ = var('t')
sage: psi = t*x+y
sage: assume(t==0)
sage: psi
t*x + y
sage: psi += 0
sage: psi
y
sage: psi == y
True

In particular, the responsible is more how the class/caching was implemented with respect to the symbolic ring, not the cloud or any kind of user interface.

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: 2015-12-04 11:34:49 +0100

Seen: 3,073 times

Last updated: Dec 04 '15