Ask Your Question

Revision history [back]

I think you need to upgrade your version of Sage. Many of the commands in your script work for me, either with Sage on my own computer or with sagenb on line. For example,

def show_all():
  y = var('y')
  x = 2.0*y**2
  view(x)
  pretty_print(x)
  show(x)
  print MathJax()(x)

prints x nicely four times.

For decimal expansions, you can force the coefficient to have lower precision:

def show_all():
  y = var('y')
  x = 2.0*y**2
  view(x)
  a = RDF(2.0)
  a = a.n(digits=3)
  x = a*y**2
  view(x)

For me, this prints "2.00000000000000y^2" and "2.00y^2" (formatted nicely).