Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Simplifying numerator

I'm writing a script to create quotient rule exercises, but I cannot coerce the fraction to simplify as desired. In particular, I'd like latex(sol) to look like the following:

\frac{2x^2+4}{(x^2+1)^2}

But evaluating

(2*x+4)/(x^2+1)^2

always seems to factor the numerator to get

2*(x + 2)/(x^2 + 1)^2

and simplify_full() seems to only expand the denominator, not the numerator:

2*(x + 2)/(x^4 + 2*x^2 + 1)

Simplifying numerator

I'm writing a script to create quotient rule exercises, but I cannot coerce the fraction to simplify as desired. In particular, I'd like latex(sol) to look like the following:

\frac{2x^2+4}{(x^2+1)^2} \frac{2x+4}{(x^2+1)^2}

But evaluating

(2*x+4)/(x^2+1)^2

always seems to factor the numerator to get

2*(x + 2)/(x^2 + 1)^2

and simplify_full() seems to only expand the denominator, not the numerator:

2*(x + 2)/(x^4 + 2*x^2 + 1)

Simplifying numerator

I'm writing a script to create quotient rule exercises, but I cannot coerce the fraction to simplify as desired. In particular, I'd like latex(sol) to look like the following:

\frac{2x+4}{(x^2+1)^2}

But evaluating

(2*x+4)/(x^2+1)^2

always seems to factor the numerator to get

2*(x + 2)/(x^2 + 1)^2

and simplify_full() seems to only expand the denominator, not the numerator:

2*(x + 2)/(x^4 + 2*x^2 + 1)


For clarity, I think the general problem is this (perhaps?) surprising phenomenon: latex(f/g) doesn't seem to respect whether the expression f is factored or not.