Ask Your Question
2

Where is information passed on to var() stored?

asked 2016-01-28 08:38:07 -0500

stan gravatar image

We can link additional information to expressions defined by var(), such as the domain or latex expression, e.g.

sage: var('xt1',domain = real,latex_name = 'x_{t1}')

Where is this information stored and is there a way to modify it, e.g. change the domain or latex_name without having to redefine the expression?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2016-01-31 04:35:22 -0500

ndomes gravatar image
var('xt1',latex_name='x_{t1}')
pretty_print(xt1)
f = xt1^2 + 4
print f._latex_(); pretty_print(f)     # defining f creates a latex_name of f
var('xt1',latex_name='{xt}_1')
pretty_print(xt1)
print f._latex_(); pretty_print(f)     # redefining xt1 does not change the latex_name of f 
f = f.subs(xt1=xt1)
print f._latex_(); pretty_print(f)     # the substitution rewrites the latex_name of f
edit flag offensive delete link more
0

answered 2016-01-30 15:31:43 -0500

Volker Braun gravatar image

Pynac/ginac tracks latex_name, so its a bit tricky to get at it.

The assumptions (like domain="real") are tracked in Sage:

sage: var('xt1', domain='real') 
xt1
sage: assumptions(xt1) 
[xt1 is real]
sage: forget(xt1, 'real') 
sage: assumptions(xt1) 
[] 
sage: assume(xt1 > 0)
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

2 followers

Stats

Asked: 2016-01-28 08:38:07 -0500

Seen: 82 times

Last updated: Jan 31 '16