8
$\begingroup$

Hyperreals are an extension to the real numbers; they formalise the concepts of infinities and infinitestimals as numbers, rather than the named limit points outside of the system of reals and form the basis of non-standard analysis.

Hyperreals are analogous to Complex numbers in that a hyperreal can be be expressed as a pair {r, h} where r is the Real part and h the hyperreal part, e.g. {1, $\epsilon$}, {1, $\omega$}, {1, 2 $\omega$}, {1, $\omega^2$}, etc.

A search suggests that there is currently no support for hyperreals in Mathematica, either from Wolfram directly or as a user demonstration or other package.

How would one go about defining the hyperreals, arithmetic operations, relations (<, >, =, !=, etc.), etc. so that they could be handled like any other number kind, and in particular sorted, so that given the list $\{1, \epsilon, \epsilon^2, \omega -1, \omega -2 \}$ the result of sorting it would be $\{0, \epsilon^2, \epsilon, 1, \omega -2, \omega -1 \}$?

I believe that any function of the reals can be extended straightforwardly to the hyperreals (in which context Łoś' theorem and the transfer principle are referenced, but I am not mathematically sophisticated enough to assert their relevance).

To be specific:

  • How would one define the symbols $\epsilon$ and $\omega$?
  • How would one extend the definitions of basic arithmetic functions (+, -, *, /, ^) to handle hyperreals?
  • How would one extend magnitude and equality relationships accordingly?

(I would ask whether, alternatively, the scope of application is so great, e.g. as arguments in exponentials, polynomials, calculus, etc. that only Wolfram could do such a thing - but that would be largely a matter of option, so I won't.)

Update I have now looked at both B3m2a1 and Jason B's approaches to custom objects in custom-atomic-expressions-modern-tutoria and whilst I am perhaps now infinitesimally wiser I am also infinitely sadder at the impenetrability of Mathematica for tasks other than simple arithmetic, algebra, solving, graphical, etc. tasks. I thought I was making progress but now realise I have only managed to walk from the car park to the base of what turns out to be El Capitan. I've seen - nay, studied! - the examples and I still have no confidence about how I might proceed.

Update 2 re basic quantities, principles in response to comments etc.

Re @DanielLicthblau & @yawnoc's point about preferred/basic quantities: as soon as I started working on it myself I realised the same and adopted a principled position.

Calling the parts of the hyperreal the Standard and NonStandard parts: in validation etc. the Standard part may not contain any infinit* quantity, and - initially at least - I decided that the NonStandard part could be a polynomial in $\epsilon$ and/or $\omega$ without purely numeric terms, but given $\epsilon = 1/\omega$, monomials with -ve exponents should be re-expressed in terms of the other quanity, hence (code fragments)

ClearAll[\[Epsilon], \[Omega]];
ClearAll[HyperrealSimplify, HyperrealSymbolQ, HyperrealPolynomialQ, HyperrealValidQ];
HyperrealSymbolQ[sym_]:= MemberQ[{\[Epsilon], \[Omega]}, sym];
HyperrealPolynomialQ[expr_]:= (PolynomialQ[expr, \[Epsilon]] || PolynomialQ[expr, \[Omega]]) && !MemberQ[MonomialList[expr], _?NumberQ];
HyperrealSimplify[expr_]:= (expr /. Power[\[Epsilon], p_?Negative] -> Power[\[Omega], Abs@p]) /. Power[\[Omega], p_?Negative] -> Power[\[Epsilon], Abs@p];
HyperrealValidQ[pair_List]:=!HyperrealPolynomialQ[pair[[1]]] && HyperrealPolynomialQ[pair[[2]]]; (* 1st item must not involve Hyperreal symbols and 2nd item must - without isolated non-hyperreals, e.g. numbers*)

(I would also include this in the simplification process...

Block[{\[Epsilon], \[Omega]}, Simplify[hrs, TransformationFunctions -> {\[Epsilon] := 1/\[Omega]}]] 

)

Symbols in the NonStandard part would be dealt with at the time of evaluation and re-validation of the Hyperreal object.

The hyperreals were already shaping up like Complex, & @SjoerdSmit's package would be an excellent place to start... if I were better at MMA.

$\endgroup$
10
  • 2
    $\begingroup$ This is somewhat open-ended, which is more due to the nature of the topic than the wording of the question. What beyond arithmetic is in scope? Does one "basic" infinitesimal (and its powers) suffice? Is omega going to be 1/epsilon (sorry, I still don't know how to format those as Greek letters for MSE). Even with answers to these I'm not sure what would be a good way to attack it. Triples of the form {infinite,finite,infinitesimal}? Maybe. $\endgroup$ May 9, 2021 at 14:56
  • $\begingroup$ @DanielLichtblau - try switching your keyboard settings to a Greek keyboard when entering the Greek letters. You could also show the keyboard viewer for reference. $\endgroup$
    – Bob Hanlon
    May 9, 2021 at 15:20
  • $\begingroup$ @BobHanlon Thanks. I think I now have this working one one laptop. No guarantees for other machines I use though (different OS/ΟΣ). $\endgroup$ May 9, 2021 at 15:45
  • $\begingroup$ @DanielLichtblau I would have to agree that the ramifications are potentially deep, but the limited scope would be enough for me for now; and yes I do believe that $1/\epsilon = \omega$. For example; I would define a hyperreal like Complex in parts, but don't know how to create a new Head like this, or overload the operators (though I can see what the overloading content would probably look like) - I suspect Upvalues are involved... but up, down, (own, sub) values are things I have not previously grappled with. (PS: I use inline TeX like this: \$ 1/\epsilon = \omega \$) $\endgroup$ May 10, 2021 at 6:47
  • $\begingroup$ @DanielLichtblau (continued) and relationships I can also see how to approach by substituting specific Real values (<1, >1) for evaluation, but again... overloading. $\endgroup$ May 10, 2021 at 6:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.