Ask Your Question
2

Where is information passed on to var() stored?

asked 9 years ago

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?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
0

answered 9 years ago

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)
Preview: (hide)
link
0

answered 9 years ago

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
Preview: (hide)
link

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: 9 years ago

Seen: 375 times

Last updated: Jan 31 '16