|   | 1 |  initial version  | 
I'm not getting the error you have, but I do get something that doesn't look right. Perhaps you should first take your input box inputs and make them LaTeXed, e.g.
      q = r"$\int_{0}^{1}\int_{2}^{3} {4} \,dx\,dy = {5}$".format(lower_y_bound, upper_y_bound,lower_x_bound, upper_x_bound,latex(function), latex(result))
You were missing an underscore, anyway. How do you get the error you mention?
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.