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.