Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

symbolic and numeric double integration method

fidbc corrected some of my previous code for double integration. However I am only able to good a good numerical double integral. Is their a sage method that can do both symbolic ie variables as bounds and numeric integration if not what is the symbolic integration method. Using the current integrate method I have I get back the wrong results in bracketed around the word integrate.

Here is my double integration code corrected by fidbc for numerical integration does anyone know a better integration method or methods for symbolic double integration.

from sage.plot.plot3d.shapes import Box
x,y = var('x,y')

@interact
def  interplay(function= input_box(sin(x*y)),lower_x_bound= input_box(0),upper_x_bound = input_box(1),lower_y_bound=input_box(0),upper_y_bound=input_box(1),dydx = checkbox(default = False)):
    if dydx==False :              
        prev = integral(function,x,lower_x_bound,upper_x_bound)
        result = n(integral(prev,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 = n(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 \,dy\,dx = %s $" % (lower_x_bound,upper_x_bound,lower_y_bound,upper_y_bound,function,result)
    html("%s" %q)