MathGroup Archive 2001

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

Search the Archive

Re: newbie: computing rational numbers and decimal

  • To: mathgroup at
  • Subject: [mg30726] Re: newbie: computing rational numbers and decimal
  • From: "Allan Hayes" <hay at>
  • Date: Sat, 8 Sep 2001 02:56:09 -0400 (EDT)
  • References: <9naldr$np6$>
  • Sender: owner-wri-mathgroup at


lst= Union[{ 1/2, 1/3, 1/2, 1/5}];



These are machine precision numbers

N[lst, 30]


These are to precision 30.

Here is Carl Woll's code for removing repeats,

RemoveRepeats[x_]:=Block[{i},i[n_]:=(i[n]=Sequence[]; n); i/@x];



Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Alan Tu" <alantu at> wrote in message
news:9naldr$np6$1 at
> Thanks Bob and Allan for answering my question on summing lists. I have
> another question. Suppose I have a sorted list (using union) of rational
> numbers. Is there a function that calculates those rational numbers to a
> given decimal position, preferably a listable function so I don't have to
> operate in a loop?
> Also, suppose that I have done that and now have a list of (still sorted,
> think) decimal representations. Is there a quick way to remove any
> duplicates in this list, or do I have to use a loop and test equality each
> part of the list to the next part?
> Thanks again! I really appreciate it!
> Alan

  • Prev by Date: Re: Extract coefs. and exponents from a list . Package problem
  • Next by Date: Re: Fitting to complex values
  • Previous by thread: newbie: computing rational numbers and decimal
  • Next by thread: Re: newbie: computing rational numbers and decimal