Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify_fractions doesn't work #22

Open
turner-eng opened this issue Jan 6, 2021 · 4 comments
Open

simplify_fractions doesn't work #22

turner-eng opened this issue Jan 6, 2021 · 4 comments
Assignees
Milestone

Comments

@turner-eng
Copy link
Contributor

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}$$

@erwanp
Copy link
Owner

erwanp commented Jan 6, 2021

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!!

@alexhagen
Copy link
Contributor

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.

@turner-eng
Copy link
Contributor Author

This is a very handy feature, looking forwards to see it been added!

@erwanp erwanp added this to the 0.3.4 milestone Jan 31, 2021
@alexhagen
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants