Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

sage interactive not working the same in website as mathcloud

I made a sage interactive. It works great on math cloud. However when I copy paste and format into html and make it online. The interactive says that it does not have enough arguments to format string. Why would this happen if it is the same code? Here is my code:

<h2>Double integrater</h2>
  Alternative to Mathematica double integrater. Way Better!
<div id="mycell">
x,y = var('x,y')
html("<h1>Double Integrator<h1>")
@interact
def  interplay(function= input_box(x*y),lower_x_bound= input_box(0),upper_x_bound = input_box(x),lower_y_bound=input_box(0),upper_y_bound=input_box(1),dydx = checkbox(default = False)):
  try:
    if dydx == False:
      result = integral(integral(function,x,lower_x_bound,upper_x_bound),y,lower_y_bound,upper_y_bound)

      q ="$\int_{%s}^{%s} \int_{%s}^{%s} %s \,dx\,dy = %s $" % (lower_y_bound, upper_y_bound,lower_x_bound,upper_x_bound,function,result)

    else:
      result = integral(integral(function,y,lower_y_bound,upper_y_bound),x,lower_x_bound,upper_x_bound)
      q ="$\int_{%s}^{%s} \int_{%s}^{%s} %s \,dx\,dy = %s $" % (lower_y_bound, upper_y_bound,lower_x_bound,upper_x_bound,function,result)
    pretty_print(html("%s" %q))
  except Exception as e :
    print("Please enter better inputs")
    print(e)
html("<p> done</p>")


</div>