Convert decimal number to rational: Difference between revisions
Content added Content deleted
Line 1,184: | Line 1,184: | ||
'''Solution''' |
'''Solution''' |
||
=== Case 1. Without repeating digits=== |
|||
The Fōrmulæ '''Rationalize''' expression converts from decimal numberts to rational in lower terms. |
The Fōrmulæ '''Rationalize''' expression converts from decimal numberts to rational in lower terms. |
||
Line 1,191: | Line 1,191: | ||
[[File:Fōrmulæ - Convert decimal number to rational 02.png]] |
[[File:Fōrmulæ - Convert decimal number to rational 02.png]] |
||
[[File:Fōrmulæ - Convert decimal number to rational 03.png]] |
[[File:Fōrmulæ - Convert decimal number to rational 03.png]] |
||
Line 1,196: | Line 1,197: | ||
[[File:Fōrmulæ - Convert decimal number to rational 04.png]] |
[[File:Fōrmulæ - Convert decimal number to rational 04.png]] |
||
=== Case 2. With repeating digits === |
|||
Fōrmulæ '''Rationalize''' expression can convert from decimal numbers with infinite number of repeating digits. The second arguments specifies the number of repeating digits. |
Fōrmulæ '''Rationalize''' expression can convert from decimal numbers with infinite number of repeating digits. The second arguments specifies the number of repeating digits. |
||
Line 1,203: | Line 1,204: | ||
[[File:Fōrmulæ - Convert decimal number to rational 06.png]] |
[[File:Fōrmulæ - Convert decimal number to rational 06.png]] |
||
In the following example, a conversion of the resulting rational back to decimal is provided in order to prove that it was correct: |
In the following example, a conversion of the resulting rational back to decimal is provided in order to prove that it was correct: |
||
Line 1,213: | Line 1,215: | ||
[[File:Fōrmulæ - Convert decimal number to rational 10.png]] |
[[File:Fōrmulæ - Convert decimal number to rational 10.png]] |
||
[https://en.wikipedia.org/wiki/0.999... 0.999... is actually 1]: |
[https://en.wikipedia.org/wiki/0.999... 0.999... is actually 1]: |
||
Line 1,220: | Line 1,223: | ||
[[File:Fōrmulæ - Convert decimal number to rational 12.png]] |
[[File:Fōrmulæ - Convert decimal number to rational 12.png]] |
||
=== Programatically === |
|||
Even when rationalization expressions are intrinsic in Fōrmulæ, we can write explicit functions: |
Even when rationalization expressions are intrinsic in Fōrmulæ, we can write explicit functions: |
||
Line 1,229: | Line 1,232: | ||
[[File:Fōrmulæ - Convert decimal number to rational 15.png]] |
[[File:Fōrmulæ - Convert decimal number to rational 15.png]] |
||
[[File:Fōrmulæ - Convert decimal number to rational 16.png]] |
[[File:Fōrmulæ - Convert decimal number to rational 16.png]] |