Metadata-Version: 2.1
Name: dvtDecimal
Version: 1.1.0
Summary: Repeating digits of rational numbers
Home-page: https://twitter.com/davidequantique
Author: David COBAC
Author-email: david.cobac@gmail.com
License: CC-BY-NC-SA
Description: *Due to slow computation of Egyptian Fraction (see end of this
        doc.), some variables have been transformed to methods since
        previous versions.*
        
        This package provides a way to access repeating decimals in the
        decimal representation of rational numbers.
        
        ### class object
        
        ``` python3
        >>> from dvtDecimal import *
        
        ```
        
        
        Once package importation completed, you have to create a rational
        number using:
        
        * a fraction representation
        
        
        ``` python3
        >>> f = dvtDecimal(-604, 260)
        
        ```
        
        for the fraction whose numerator is -604 and denominator is 260.
        
        
        * or a decimal representation
        
        ``` python3
        >>> f = dvtDecimal(2.5)
        
        ```
        
        * or repeating decimals as a string
        
        ``` python3
        >>> f = dvtDecimal('00765')
        
        ```
        
        thus creating a number (w/o irregular part) between 0 and 1.
        In the example, 0.007650076500765... and so on.
        
        
        ### object methods and variables
        
        Once you created the object, you can access to those variables:
        
        
        ``` python3
        >>> f.initValues
        [-604, 260]
        >>> f.simpValues
        [-151, 65]
        >>> f.intPart
        -2
        >>> f.repPart
        [2, 3, 0, 7, 6, 9]
        >>> f.sign
        -1
        >>> f.gcd
        4
        
        ```
        
        and to those methods:
        
        
        ``` python3
        >>> f.fraction
        -604/260
        >>> f.irrPart()
        0.3
        >>> f.repPartC()
        230769
        >>> f.periodLen()
        6
        >>> f.mixedF()
        [-2, 21, 65]
        >>> f.isDecimal()
        False
        >>> f.dotWrite(20)
        -2.32307692307692307692
        >>> f.dispResults()
        For fraction: -604/260
            integer   part : -2
            irregular part : 0.3
            periodic  part : [2, 3, 0, 7, 6, 9]
            mixed fraction : [-2, 21, 65]
            simp. fraction : [-151, 65]
                       gcd : 4
            Python outputs : -2.3230769230769233
        
        ```
        
        Entering via repeating decimals string allows:
        
        ``` python3
        >>> f = dvtDecimal('0123456789')
        >>> f.simpValues
        [13717421, 1111111111]
        
        ```
        
        
        dvtDecimal also supports minimal operations (+,-,*,/) in between
        elements of the class but also with integers:
        
        
        ``` python3
        >>> f = dvtDecimal(1, 5)
        >>> g = dvtDecimal(10, 3)
        >>> h = f + g
        >>> h.mixedF
        [3, 8, 15]
        >>> i = f / g
        >>> i.mixedF
        [0, 3, 50]
        
        ```
        
        ``` python3
        >>> f = dvtDecimal(1, 5)
        >>> g = 5
        >>> h = f * g
        >>> h.isDecimal()
        True
        
        ```
        
        
        ``` python3
        >>> f = dvtDecimal(1, 5)
        >>> g = dvtDecimal(7, 5)
        >>> h = f - g
        >>> h.simpValues
        [-6, 5]
        
        ```
        
        
        ### egyptian fractions
        
        IMPORTANT 1: Egyptian fractions features are quite slow (could be
        VERY slow) because it uses dvtDecimal representation of numbers
        (unlike previous versions).  As it doenst' use algebraic
        computation, you have to untrust some results or at least to verify
        them with another method...
        
        IMPORTANT 2: This part gives you results for the fractionnal part of
        the rational number you work with i.e. the last two numbers in the
        `mixedF` list, so that you only get results for <=1 fractions.
        
        
        dvtDecimal provides the method `egyptFractions` to get `all` the
        egyptian fractions equal to your current fraction.
        
        `egyptFractions` outputs a list of lists. Each of these lists are
        denominators (increasing) for unitary fractions whose sum equals to
        your fraction.
        
        Two optional arguments:
        * `eF` number of fractions in the sums, default is `3`
        * `lim` max. number of solutions in the results, default is `10`
        * `lim` can be `0` for **all** fractions!
        
        
        
        ``` python3
        >>> f = dvtDecimal(18,5)
        >>> f.mixedF
        [3, 3, 5]
        >>> f.egyptFractions()
        [[2, 11, 110], [2, 12, 60], [2, 14, 35], [2, 15, 30], [2, 20, 20], [3, 4, 60], [3, 5, 15], [3, 6, 10]]
        >>> f.egyptFractions(lim=5)
        [[2, 11, 110], [2, 12, 60], [2, 14, 35], [2, 15, 30], [3, 4, 60]]
        >>> f.egyptFractions(eF=4, lim=1)
        [[2, 11, 111, 12210]]
        >>> f.egyptFractions(eF=4, lim=0)
        [[2, 11, 111, 12210], [2, 11, 112, 6160], [2, 11, 114, 3135], [2, 11, 115, 2530], [2, 11, 120, 1320], [2, 11, 121, 1210], [2, 11, 130, 715], [2, 11, 132, 660], [2, 11, 135, 594], [2, 11, 154, 385], [2, 11, 160, 352], [2, 11, 165, 330], [2, 11, 210, 231], [2, 12, 61, 3660], [2, 12, 62, 1860], [2, 12, 63, 1260], [2, 12, 64, 960], [2, 12, 65, 780], [2, 12, 66, 660], [2, 12, 68, 510], [2, 12, 69, 460], [2, 12, 70, 420], [2, 12, 72, 360], [2, 12, 75, 300], [2, 12, 76, 285], [2, 12, 78, 260], [2, 12, 80, 240], [2, 12, 84, 210], [2, 12, 85, 204], [2, 12, 90, 180], [2, 12, 96, 160], [2, 12, 100, 150], [2, 12, 105, 140], [2, 12, 108, 135], [2, 12, 110, 132], [2, 13, 44, 2860], [2, 13, 45, 1170], [2, 13, 50, 325], [2, 13, 52, 260], [2, 13, 60, 156], [2, 13, 65, 130], [2, 14, 36, 1260], [2, 14, 40, 280], [2, 14, 42, 210], [2, 14, 60, 84], [2, 15, 31, 930], [2, 15, 32, 480], [2, 15, 33, 330], [2, 15, 34, 255], [2, 15, 35, 210], [2, 15, 36, 180], [2, 15, 39, 130], [2, 15, 40, 120], [2, 15, 42, 105], [2, 15, 45, 90], [2, 15, 48, 80], [2, 15, 50, 75], [2, 15, 55, 66], [2, 16, 27, 2160], [2, 16, 28, 560], [2, 16, 30, 240], [2, 16, 32, 160], [2, 16, 35, 112], [2, 16, 40, 80], [2, 16, 48, 60], [2, 17, 25, 850], [2, 17, 34, 85], [2, 18, 23, 1035], [2, 18, 24, 360], [2, 18, 25, 225], [2, 18, 27, 135], [2, 18, 30, 90], [2, 18, 35, 63], [2, 18, 36, 60], [2, 20, 21, 420], [2, 20, 22, 220], [2, 20, 24, 120], [2, 20, 25, 100], [2, 20, 28, 70], [2, 20, 30, 60], [2, 20, 36, 45], [2, 21, 28, 60], [2, 21, 35, 42], [2, 24, 30, 40], [3, 4, 61, 3660], [3, 4, 62, 1860], [3, 4, 63, 1260], [3, 4, 64, 960], [3, 4, 65, 780], [3, 4, 66, 660], [3, 4, 68, 510], [3, 4, 69, 460], [3, 4, 70, 420], [3, 4, 72, 360], [3, 4, 75, 300], [3, 4, 76, 285], [3, 4, 78, 260], [3, 4, 80, 240], [3, 4, 84, 210], [3, 4, 85, 204], [3, 4, 90, 180], [3, 4, 96, 160], [3, 4, 100, 150], [3, 4, 105, 140], [3, 4, 108, 135], [3, 4, 110, 132], [3, 5, 16, 240], [3, 5, 18, 90], [3, 5, 20, 60], [3, 5, 24, 40], [3, 6, 11, 110], [3, 6, 12, 60], [3, 6, 14, 35], [3, 6, 15, 30], [3, 7, 10, 42], [3, 8, 10, 24], [3, 9, 10, 18], [4, 5, 7, 140], [4, 5, 8, 40], [4, 5, 10, 20], [4, 5, 12, 15], [4, 6, 10, 12]]
        
        ```
        
        In the above example, egyptian fractions are thus calculated with
        fraction 3/5.
        
        First solution `[2, 11, 111, 12210]` (in the last command result)
        has to be interpreted as: 3/5 = 1/2 + 1/11 + 1/111 + 1/12210
        
        
        dvtDecimal also provides `egyptG2` method. This gives you a list
        of two denominators of unitary fractions whose sum equals your
        fraction.
        
        This is an implementation of **the greedy algorithm**. It gives you
        naturally **matching pairs** for unitary fractions input.
        
        The result may be an empty list since all numbers cannot be written
        as so.
        
        ``` python3
        >>> f = dvtDecimal(18,5)
        >>> f.intPart
        3
        >>> f.egyptG2
        [2, 10]
        
        ```
        
        So: 18/5 = 3 + 1/2 + 1/10
        
        
        ### further
        
        More operations!
        
        
        ### about
        
        dvtDecimal is rather an attempt to publish on the `PyPi` packages
        index than a fully completed python project, I do not recommend
        dvtDecimal usage for professionnal use. You have to consider this
        package as an experiment.
        
Platform: UNKNOWN
Description-Content-Type: text/markdown
