Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How would you mathematically describe an integer?

  1. Sep 27, 2008 #1
    For example a number whose domain would be all positive would be described as a number k, where k > 0.

    How would you describe a number that is an integer, ie not 1.4, 7.666 et cetera. I can't think of a way to define this mathematically (or a way that includes any number of digits). I know there is a way though, considering the data type "int" that would be used i a computer programming language.


    thanks for any input!
     
  2. jcsd
  3. Sep 27, 2008 #2

    Gib Z

    User Avatar
    Homework Helper

    Well the most common way to do so would be to say:

    A number k is an integer if [tex] k \in \mathbb{Z}[/tex].


    The set of the Integers is most commonly denoted in mathematical documents by Z, so people will know what you are trying to say if you say that.
     
  4. Sep 28, 2008 #3

    arildno

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    Well, for example, these properties should hold:
    1. 1 is an integer, and so is 0
    2. For any integer n, n+1 and n-1 are also integers.
    3. For any integer m, there exists an integer n so that m=n+1, or m=n-1
     
  5. Sep 28, 2008 #4

    Mentallic

    User Avatar
    Homework Helper

    All positive integers are the set of natural numbers.

    To describe an integer mathematically?
    The best I can think of is:

    In the form [tex]\frac{m}{n}[/tex] where n is a factor of m.
     
  6. Sep 28, 2008 #5

    Gib Z

    User Avatar
    Homework Helper

    That doesn't work - What are m and n ?
     
  7. Sep 28, 2008 #6

    arildno

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    ????

    67.15 is a factor of -0.23. So their fraction is an integer?
     
  8. Sep 28, 2008 #7

    Gib Z

    User Avatar
    Homework Helper

    I thought the term "factor" was only defined for integers? Hence my last post, which points out the definition he posted is circular as it assumed m and n were integers in the first place.
     
  9. Sep 28, 2008 #8

    arildno

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    Well, if you insist...
     
  10. Sep 28, 2008 #9

    Mentallic

    User Avatar
    Homework Helper

    Well the way I understand factors is that the if m is divided by n, the end result is an integer. A recurring loop as Gib Z said.

    Somehow I fail to see how 67.15 is a factor of -0.23, maybe I need to clarify for myself the definition of a factor?
     
  11. Sep 28, 2008 #10

    arildno

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    Well, of course, you might construct a definition of the "factor" so that it is independent of "integerness", so that you can utilize this to define integers in a non-circular way.

    How do you plan to define factors, then, in a manner that does not refer to integers, and at the same time ensures you to avoid falling into the trap I set up?
     
  12. Sep 28, 2008 #11

    Mentallic

    User Avatar
    Homework Helper

    The trap would seem quite fruitless since I've already agreed with Gib Z's argument that my comment is circular in nature.

     
  13. Sep 28, 2008 #12

    arildno

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    Well, since you agree that your definition is circular, and hence worthless, this point has been done to death, haven't it?
     
  14. Sep 28, 2008 #13
    It depends on the starting point. If the starting point is the real numbers; I would say "all members of the smallest inductive set, together with their additive inverses together with the additive identity". If the starting point are the rational numbers, same thing. If the starting point are the integers... well any member of the set in question. If the starting point are the natural numbers, "any ordered pair {a,b} of natural numbers" with an equivalence relation {a,b} ~ {x,y} iff a + y = x + b.
     
    Last edited: Sep 28, 2008
  15. Sep 28, 2008 #14
    This is a lot of good information.


    I was more leaning towards how a computer would make something an integer (int), and these methods look like they would take too much time.

    I'm guessing if you had some number coming in, 1.44456 you could take it in in IEEE floating point standard and then just cut off the decimal part, but other than that I have no idea the inner workings behind that stuff.
     
  16. Sep 28, 2008 #15
    Possibly you posted in the wrong forum; there's one under Other Sciences / Computer Science for these issues.

    As for your question, I assume your language has an INT() function (if it doesn't, just assign your IEEE variable to an int if your number is positive; if it's negative, ask again). Let's call N = INT(X), where X was your original IEEE number.

    Also I assume you know that "rounding the number to the closest integer" is provided by INT(X + 0.5), So let R = INT(X + 0.5).

    With these assumptions, you have two options:

    a) The quick and insecure:
    Assign the IEEE X to the integer N, and then N back to another IEEE variable, say F, and compare X and F to see if they are equal.
    The problem with this method is that, if X was the result of some calculation, then if might contain 9.9999 instead of 10; when you truncate 9.9999, you'll be comparing 9 to 10 and finding they are not equal. If your number X comes from a user interface, this "might" be safe, at least for small integers. If it comes from a calculation, better use method b.

    b) Choose a "comparison tolerance" (for example, T = 0.00001), and now determine if R (the rounded one) and your original X are too far apart, farther than the tolerance T. Something like this: IF ABS(X-R) < T THEN ... X is very close to an integer.
     
  17. Sep 28, 2008 #16
    Integers are fairly fundamental. You can define them in terms of other things, such as sets or functions or whatever, but it's probably easier for most people to accept integers as a basic concept than those other kinds of objects.

    You may also want to check out Peano's Axioms for the integers.

    In computer languages, the datatype "int" usually denotes a bounded integer type, and NOT the full set of integers. But the subset of integers it can represent is large enough that most people don't care.
     
  18. Sep 28, 2008 #17
    For any set A, you define a sucessor set A' by:

    A' = Union of A and {A}

    Here {A} is the set that has A as its sole element. If you take the union of this set with A, then you are adding one element (the set A considered as an element) to A.

    To define the integers, you can define zero to be the empty set:

    0 = {}

    Next you define 1 as the successor of 0:

    1 = 0' = Union of 0 with {0} = {0}

    2 is the successor of 1:

    2 = 1' = Union of 1 with {1} = Union of {0} with {1} = {0,1}


    So, if you proceed in this way, you end up with:


    n = {0,1,2,...,n-1}
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?