Re: Algebraic Integers

*To*: mathgroup at smc.vnet.net*Subject*: [mg28516] Re: Algebraic Integers*From*: Konstantin L Kouptsov <klk206 at nyu.edu>*Date*: Tue, 24 Apr 2001 01:48:51 -0400 (EDT)*Organization*: New York University*References*: <9bvvjt$3sq@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Thanks to all who replied. Considering that P can be more complex that I mentioned (for example 23-sqrt(17)), the solution should not use N[] in the first place. Here is what I came up with: P /: N[P, n_:6] := N[23 - Sqrt[17], n]; Unprotect[Less]; Less[a_. + b_. P, c_. + d_. P] := LessZero[(a - c) + P (b - d)]; Less[a_, b_. + c_. P] := LessZero[(a - b) - c P]; Less[a_. + b_. P, c_] := LessZero[(a - c) + b P]; Protect[Less]; (* This can be simply N[] or something less trivial *) LessZero[x_] := N[x, 200] < 0 Unprotect[Min, Max]; Min[x_List] := First[Sort[x, Less]]; Max[x_List] := Last[Sort[x, Less]]; Protect[Min, Max]; Konstantin.