MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Algebraic Integers

There are certainly lots of solutions (leaving aside the question of
"elegance")  Here are the first two that came to my mind:

MyMin1[l_List, r_] := Module[{m = Min[l /. p -> r], s = l /. p -> r},
 First[Extract[l, Position[s, m]]]];MyMin1[l__, r_] := MyMin1[{l}, r];

This simply takes your list of algebraic numbers, substitutes the desired
value for p, finds the position of the minimum and takes the element in the
original list in the same position. The last argument of MyMin1 is of course
your chosen irrational.

Here are a couple of examples:
MyMin1[3 p-2,5 p-6,Sqrt[2]]
-6+5 p
MyMin1[3 p-2,5 p-6,Sqrt[5]]
-2+3 p

Here is another approach, this time based on using Sort. We first define an
ordering function in the obvious way, sort the list according to it and take
the last element:

ord[r_][a_ + b_*p, c_ + d_*p] := a + b*r >= c + d*r;
MyMin2[l_List, r_] := Last[Sort[l, ord[r]]];MyMin2[l__, r_] := MyMin2[{l},

With the same examples:

MyMin2[3 p-2,5 p-6,Sqrt[2]]
-6+5 p
MyMin2[3 p-2,5 p-6,Sqrt[5]]
-2+3 p

Andrzej Kozlowski
Toyama International University

on 4/23/01 10:03 AM, Konstantin L Kouptsov at klk206 at wrote:

> I am doing the algebraic manipulations with the numbers a+b*p, where a,b are
> integers
> and p is essentially the irrational number (say Sqrt[2]). There is a number of
> rules allowing 
> manipulation of the numbers without referring to the value of p (for example:
> p/: 1/p=p/2;)
> I want function Min[] to calculate the minimum of the set of algebraic
> integers (a+b*p) the way
> it works for ordinary numbers, but giving the answer in algebraic form:
> In:= Min[3 p - 2, 5 p - 4]
> Out:= 3 p -2 
> Is there any _elegant_ solution for this problem?

  • Prev by Date: Re: Two questions concerning ListDensityPlot ...
  • Next by Date: Re: ListPlot with row vectors
  • Previous by thread: Re: Algebraic Integers
  • Next by thread: Re: FindRoot Related Question