Epsilon: simplify fraction

Created on 27 Dec 2017  路  7Comments  路  Source: numworks/epsilon

12/8.4 = 10/7

Numworks only displays approximations with decimal fractions, it could be interesting to return simplification

release: 1.2.0

enhancement

Most helpful comment

Great news: we've eventually solved this! We decided to do the following:

  • Keep the previous behavior, since most of the time when a user types in a decimal value it was meant as an approximation
  • If the user selects the approximated result, we offer the option to use the exact fractional result as well 馃槃

select exact fractional result

All 7 comments

This is an interesting problem. While simplifying integer fractions is trivial (but computationally expensive) I'm not aware of an algorithm for simplifying non integer fractions.

Could you maybe provide hints into the required math?

I fail to see how decimal fractions would be fundamentally different from integer ones. Just convert both the numerator and the denominator to the corresponding integer fraction (e.g. 12/8.4 becomes (12/1)/(84/10), and voil脿, you're back in integer fractions world :-)

The reason we return approximations is an UX choice: we assume users want to manipulate approximative number as soon as they use a decimal marker.

We could have a function (maybe in the tools box) to convert a decimal into a fraction when possible. For example the 0.4 result could be written 2/5 = 0.4 after applying such a function ? This seems very useful for many students !

I think that indeed most of my (french, if that matters) fellow math teachers expected 0.3 to yield 3/10 = 0.3 when typed. One would have to take care about some approximate result being promoted to a fraction with a 10^16 denominator, but when typing a decimal number with a few places one almost always mean some x / 10^n fraction and not "I am typing by hand some approximation of a value".
Of course, if you are computing probabilities and type (0.38)^6, you might not care about the fact that it is (38/100)^6, but it does not hurt either to have a fractional result displayed.

Note that promoting a decimal to the corresponding fraction would show 芦 333333 / 1000000 = 0.333333 禄 for the input 芦 0.333333 禄, which I聽think is actually a good thing to help students understand why 1/3聽is not 0.333333 and writing the approximate value in some sign table is not pleasing the teacher.

Great news: we've eventually solved this! We decided to do the following:

  • Keep the previous behavior, since most of the time when a user types in a decimal value it was meant as an approximation
  • If the user selects the approximated result, we offer the option to use the exact fractional result as well 馃槃

select exact fractional result

Out of interest, why was it decided to display the exact fractional result only when selecting it, as opposed to always displaying it?

The idea is that, most of the time, when the user types in a decimal number, he/she is only interested in the approximate result. This happens all the time in physics: for instance, compute the current flowing through a 42.7 ohm resistor at 4.2 volts. 0.098 amps is what you're after, not 6/61.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

UDXS picture UDXS  路  5Comments

0b101 picture 0b101  路  5Comments

tjhorner picture tjhorner  路  5Comments

lastfuture picture lastfuture  路  5Comments

loretoparisi picture loretoparisi  路  3Comments