Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use latex. $ \int $

def my_int_print(expr, show_constant=False):  
    if show_constant:
        pretty_print(html("$ \int %s \,dx = %s + C ; \\ C \in \Bold R $" %(latex(expr),latex(integral(expr,x)))))
    else:
        pretty_print(html("$ \int %s \,dx = %s $" %(latex(expr),latex(integral(expr,x)))))

my_int_print(x*cos(x^2))

Returns something similar to:

$ \int x \cos\left(x^{2}\right) dx = \frac{1}{2} \sin\left(x^{2}\right) $

You can use latex. $ \int $ --> $ \int $

def my_int_print(expr, show_constant=False):  
    if show_constant:
        pretty_print(html("$ \int %s \,dx = %s + C ; \\ C \in \Bold R $" %(latex(expr),latex(integral(expr,x)))))
    else:
        pretty_print(html("$ \int %s \,dx = %s $" %(latex(expr),latex(integral(expr,x)))))

my_int_print(x*cos(x^2))

Returns something similar to:

$ \int x \cos\left(x^{2}\right) dx = \frac{1}{2} \sin\left(x^{2}\right) $