Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to save and load assumptions?

I use save_session() and load_session() to transfer data between worksheets, but I noticed that among other things, assumptions are not saved. So what I tried to do is save all assumptions in a separate list beforehand:

list_assumptions = assumptions()
save_session('temp/worksheet')

In the receiving worksheet, I tried:

load_session('temp/worksheet.sobj')
assumption1 = list_assumptions[1]
print assumption1
assumption1.assume()

but I get the following error:

a_s is real
TypeError: ECL says: Error executing code in Maxima: activate: no such context _SAGE_VAR_contextsage52

Interestingly, it works if I declare the assumption in the same way explicitly:

decl = sage.symbolic.assumptions.GenericDeclaration(a_s, 'real')
decl.assume()

And, by the way:

assumption1 == decl 
True

Is this a bug, or am I doing something wrong? Thanks for your help!