Ask Your Question
0

This HTML formats correctly in Sage, but not so in Sage Cloud

asked 2014-12-03 01:43:46 +0200

Miguel gravatar image

updated 2015-01-17 17:47:22 +0200

FrédéricC gravatar image

Hello,

I am trying to use this code in sage math cloud, but down where it says html(...), the lines f(x) = ... and p(x) = ... are on the same line, and I would like them on different lines.

var('x')
x0  = 0
f   = cos(x)
p   = plot(f,-10pi,10pi, thickness=2)
dot = point((x0,f(x=x0)),pointsize=80,rgbcolor=(1,0,0))
@interact
def _(order=(1..200)):
  ft = f.taylor(x,x0,order)
  pt = plot(ft,-10pi,10pi, color='green', thickness=2)
  html('$f(x)\;=\;%s$'%latex(f))
  html('$p(x)\;=\;%s$'%latex(ft))
  show(dot + p + pt, ymin = -5, ymax = 5)

Ideas?

edit retag flag offensive close merge delete

Comments

Quick hack: put print ' ' after each of your html lines.

calc314 gravatar imagecalc314 ( 2014-12-03 01:58:26 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2014-12-03 02:33:21 +0200

calc314 gravatar image

You can add the <p> or <br> tags to the html command to get the spacing you want.

var('x')
x0  = 0
f   = cos(x)
p   = plot(f,-10*pi,10*pi, thickness=2)
dot = point((x0,f(x=x0)),pointsize=80,rgbcolor=(1,0,0))
@interact
def _(order=(1..200)):
  ft = f.taylor(x,x0,order)
  pt = plot(ft,-10*pi,10*pi, color='green', thickness=2)
  html('$f(x)\;=\;%s$ <br>'%latex(f))
  html('<p>$p(x)\;=\;%s$</p>'%latex(ft))
  show(dot + p + pt, ymin = -5, ymax = 5)
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

Stats

Asked: 2014-12-03 01:43:46 +0200

Seen: 213 times

Last updated: Dec 03 '14