06-03-2016, 02:21 AM
Post: #282
 Claudio L. Senior Member Posts: 1,771 Joined: Dec 2013
(06-02-2016 07:58 AM)JoJo1973 Wrote:  Ok, I'll start some torture tests on built-in functions... results will surface on this thread ASAP.

If I've correctly understood the implementation in your code, infinities are just normal numbers with an INFINITY flag set. This could open interesting possibilities:

1. ±∞ are represented just by ±1 with INFINITY flag set
2. Complex ∞ is represented by (0,0) with real and imaginary parts having INFINITY flag set
3. Similarly a point at infinity on the complex plane is represented as a generic complex number (normalized to unitary modulus?) with real and imaginary parts having INFINITY flag set. In this way the calc could return meaningful results to programs such as « -∞ 4 XROOT ».

Wolfram Alpha has just taught me that this program is meaningful, and the answer is (sqrt(2)/2,sqrt(2)/2)*∞. Quite logical, if I think about it!

I see two advantages: everything seems to be already in place for implementation, and numeric type will be automatically been taken care of by the system. What do you think?

It could work, though I haven't thought about it in depth. So a complex infinity would be shown on the stack as (∞,∞)? Or perhaps it should be (∞, NaN), in other words: infinite magnitude, but unknown direction. Or perhaps it should be a polar complex? (∞, ∡0.5r).
In your example -∞ 4 XROOT the result is still infinity, but the result should actually be (∞, ∡45°).
Treating real -∞ as (-1,0)*∞ is a neat trick, but I'm not sure it has any real use. You could do the same by using a variable instead of infinity, operate to get the result you need, then take limit when it tends to infinity.
 « Next Oldest | Next Newest »