google / mathsteps

Step by step math solutions for everyone
https://socratic.org
Apache License 2.0
2.12k stars 274 forks source link

Not dividing fractions #215

Closed evykassirer closed 7 years ago

evykassirer commented 7 years ago

Gonna put this in an issue since I think it's interesting and it'd be nice to refer to this if more people ask

@Ephs05msm said:

While using this code on another project I came across the following scenario that confused me. I added it to the test suite on my local branch and got the same result:

capture2 capture

Same result on master as well (using ['x = 100 + (25^2 / 4)', 'x = 256.25']).

Is it by design that MathSteps won't simplify fractions that could be expressed as a float but not an (unrounded) integer?

evykassirer commented 7 years ago

my answer:

ooo that seems familiar but I'd have to go code hunting to be sure

I think the reason it's there is that in general we don't want to divide fractions midway through simplification (unless they're integers) because then you get like 5/3 x - 2/3 x turning into decimal subtraction which isn't what people usually want to see. I could see us adding a last step at the very end to divide the fraction but honestly I think people tend to prefer fractions over decimals anyways. It'd be neat to be able to show both the fraction and decimal at the end (I think cymath does this) but not sure how to fit that into how the code currently works, since we don't really let there be two answers right now

good question!

evykassirer commented 7 years ago

feel free to ask any followup questions here :)

if this answer makes sense and you don't have followup questions, feel free to close this issue!

Ephs05msm commented 7 years ago

Thanks for the explanation; makes sense! I can add a step on my end to get to a float when needed. I don't seem to be able to close this but please go ahead.

evykassirer commented 7 years ago

maybe we can add an option to show answers as fractions vs decimals once we have some sort of "provide options when solving" thing set up