1 | initial version |
Not clear to me what the problem may be. To help others explore, here is a slightly edited version of the original poster's code.
<h2>Double integrator</h2>
<p>Alternative to Mathematica's double integrator. Way better!</p>
<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 is False:
result = integral(integral(function, x, lower_x_bound, upper_x_bound),
y, lower_y_bound, upper_y_bound)
q = r"$\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 = r"$\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>