MathGroup Archive 2001

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

Search the Archive

Re: Algebraic Integers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28511] Re: [mg28504] Algebraic Integers
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Tue, 24 Apr 2001 01:48:48 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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

In[1]:=
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:
In[3]:=
MyMin1[3 p-2,5 p-6,Sqrt[2]]
Out[3]=
-6+5 p
In[4]:=
MyMin1[3 p-2,5 p-6,Sqrt[5]]
Out[4]=
-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:

In[5]:=
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},
r]

With the same examples:

In[7]:=
MyMin2[3 p-2,5 p-6,Sqrt[2]]
Out[7]=
-6+5 p
In[8]:=
MyMin2[3 p-2,5 p-6,Sqrt[5]]
Out[8]=
-2+3 p


-- 
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/


on 4/23/01 10:03 AM, Konstantin L Kouptsov at klk206 at nyu.edu 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