Ask Your Question
0

Messy typesetting problem

asked 2012-06-04 20:06:45 +0100

bobcat gravatar image

updated 2012-06-04 21:44:08 +0100

kcrisman gravatar image

If I enter the followng in a sage notebook, the typeset output is correct but for h(r) is unreadable, is there someway to coerce sage to output a reasonable representation?

The desired expression is $$h(r) = {1\over{r^2 \sqrt{ \frac{1}{b^2} - (1 - \frac{d}{r}) \frac{1}{r^2}}}}$$

f(r) looks good, g(r) is poor and confusing, h(r) is unreadable.

var ('r, b, d')
f(r) = r^2 * sqrt(1/b^2)    
print(f)    
f.show()
g(r) = r^2 * sqrt(1/b^2 - 1)
print(g)
g.show()
h(r) = 1 / (r^2 * sqrt (1/b^2 - (1 - d/r)*1/r^2))
print (h)
h.show()
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-06-04 20:32:23 +0100

Eviatar Bach gravatar image

I don't think there's any real way to do it now (ticket 10035 could work, if it is ever implemented). If you know the LaTeX code, however, you can do

show(LatexExpr(r'h(r) = {1\over{r^2 \sqrt{ \frac{1}{b^2} - (1 - \frac{d}{r}) \frac{1}{r^2}}}}'))

in the terminal, or

html(r'$h(r) = {1\over{r^2 \sqrt{ \frac{1}{b^2} - (1 - \frac{d}{r}) \frac{1}{r^2}}}}$')

in the notebook.

edit flag offensive delete link more

Comments

Even using things like `h(r) = 1/((r^2).mul(sqrt (1/b^2 - (1 - d/r).mul(1/r^2,hold=True)),hold=True))` doesn't really help (we've had hold, just not hold contexts, for quite a while now) because the symbolics automatically reorder things according to its own ordering. I'm not sure how to get it to print in the order one wants (e.g., with the r^2 first).

kcrisman gravatar imagekcrisman ( 2012-06-04 21:51:53 +0100 )edit

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: 2012-06-04 20:06:45 +0100

Seen: 362 times

Last updated: Jun 04 '12