Author Topic: checking for infinity  (Read 1308 times)

SameBrian

  • Newbie
  • *
  • Posts: 17
  • Kudos: 0
checking for infinity
« on: 13 October 2004, 00:39 »
I was fooling around with an inflation rate calculation program in school, and I was wondering if there is a way to see when a number hits infinity.
I can't just use if (number == Infinity) because it expects infinity to be a function/variable. Is there some other way?

KernelPanic

  • VIP
  • Member
  • ***
  • Posts: 1,878
  • Kudos: 222
checking for infinity
« Reply #1 on: 13 October 2004, 02:58 »
Infinity has no numerical value, how is the program supposed to know when the variable hits 'infinity'?
Contains scenes of mild peril.

mobrien_12

  • VIP
  • Member
  • ***
  • Posts: 2,138
  • Kudos: 711
    • http://www.geocities.com/mobrien_12
checking for infinity
« Reply #2 on: 13 October 2004, 07:36 »
Some software packages like MATALB, GNU Octave, Maple, and Mathematica know how to treat Infinity as a special number.  

If you want to know how to check for a singularity (infinity) in a general function without specialized mathematical programs, you need to break the function down into the pieces that cause it to spike to infinity and check the components individually.

For example, the function f(x)
Code: [Select]
Has two singularities, at X=-2 and X=-1.  As x approaches these values, f(x) approaches -infinity or +infinity, depending on the direction.

Hope this is of some help.

[ October 12, 2004: Message edited by: M. O'Brien ]

[ October 12, 2004: Message edited by: M. O'Brien ]

In brightest day, in darkest night, no evil shall escape my sight....