New numbering system

new topic     » topic index » view thread      » older message » newer message

-------------------------------------------------------------------------
 I greet all euphorians,
 David, thank you for helping me with my first program.
 This is the program I am now working on.
 It is a new numbering system that regards the symbol 0, as being false,
 and instead adds " X "(ten) as the tenth digit of the decimal system.
 In the system there is only one whole number; "1", the whole number
 contains as many rational numbers as a person requires for what needs
 to be done, it is an abstraction, "ONE" is complete and indivisible.
 It seems that the best way to go would be to write an e-file that
 establishes a new numbering system that excludes 0 as a 'number'.
 The ten digits of the numbering system will then be: 1,2,3,4,5,6,7,8,9,X.
 The 'number' 100 will then be: 9X, and 305 will be: 2X5 ect.
 The program below is crude, it is my second program, and has not yet
 eliminated 0, and the rational numbers print as decimal numbers.
 Any suggestions how to go about it ?
 Regards,
 Duke
---------------------------------------------------------------------------
---------------------------------------------------------------------------
-- The present numbering system is irrational and has many inconsistencies,
-- ex. a person can multiply by zero, however you cannot divide by zero.
-- This program demonstrates that zero is not required as a numerical
-- digit (symbol) and that an alternative numbering system is possible.
-- It shows that there is only one whole number, and that all other numbers
-- are rational numbers which form part of "ONE", the whole number.
-- This means that there cannot be more, or less, than one, only part of one.
-- The system is referred to as a Rational Numeric System (RNS)
-- and there are no inconsistencies in the system. Later on I hope to show
-- that irrational numbers are indeed irrational, they are the result of
-- accepting zero as a valid digit(symbol).
----------------------------------------------------------------------------
-- The program will ask you into how many parts you wish to make
-- ONE (the whole number), a maximum of 144 parts is allowed.
-- The program will then display the rational numbers incorporated
-- in ONE, in sequence. The symbol for ten is " X ".
---------------------------------------------------------------------------

with trace
--trace(2)


include get.e

constant KEYBOARD = 0 , SCREEN = 1

type user_input(object x)
    return x[2] >=2 and x[2] <=144
end type

function get_denominator()
        user_input denominator
        position(10,5)
        puts(SCREEN,"\tHow many parts do you request for the whole?\n\n")
        puts(SCREEN,"\t( The maximum for this demo is 144.) \n")
        position(10,60)
    denominator = get(KEYBOARD)
    return denominator
end function


function create_numerators()--change an atom to a sequence
    sequence numerators, x
    x = {}
    for i = 1 to 144 do  -- how can I limit this to the input atom
    x = append(x, i)      -- which is already limited by type(user_input)?
    end for
    numerators = x
    return numerators
end function

function create_rational_numbers()
    sequence rational_numbers, numerators, denominator

    denominator = get_denominator()
    numerators = create_numerators()
    denominator = repeat(denominator[2],144)
    rational_numbers = {}
    for i = 1 to length (numerators) do
        rational_numbers = numerators / denominator[i]
    end for
    return rational_numbers --these are now decimals instead
end function                -- of rational numbers

function purge_rational_numbers()-- to prevent the part from becoming
                                  -- more than the whole
    sequence valid_numbers, rational_numbers
    rational_numbers = create_rational_numbers()
    valid_numbers = rational_numbers
    for i  = 1  to length (valid_numbers) do
        if valid_numbers[i] >1  then
            valid_numbers[i] = 1
            end if
    end for
    return valid_numbers
end function

procedure display_rational_numbers() -- main procedure
    sequence valid_numbers
    valid_numbers = purge_rational_numbers()
    position(20,20)
    print(1,valid_numbers)
    end procedure

display_rational_numbers()  -- displaying decimal numbers

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu