Open turner-eng opened 3 years ago
Thank you for spotting it !
I think that simplify_fractions
could only deal with small decimals and write them as function, i.e. turn 0.5 to 1/2. The "simplify_fraction" may be a little misleading. @alexhagen can you confirm ?
It would be a nice featur e!!
I'll look further into this on the weekend, but simplify_fractions
uses looks_like_int
on both the denominator and numerator to check if it can be simplified - and doesn't simplify if both the numerator and denominator don't "look like integers". So at first blush, that looks like expected behavior - I'll verify that. This could be a feature request, however.
This is a very handy feature, looking forwards to see it been added!
All, I've opened a fork and a new feature branch to add this in. My plan is to use sympy
to do the simplification.
print(py2tex('theta = w_k * a 4 / t 4 / E',simplify_fractions=True)) prints out:
$$\theta=\frac{\frac{w_k a^4}{t^4}}{E}$$
instead of:
$$\theta=\frac{w_k a^4}{t^4E}$$