MathGroup Archive 2001

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

Search the Archive

Re: newbie: computing rational numbers and decimal

  • To: mathgroup at
  • Subject: [mg30794] Re: newbie: computing rational numbers and decimal
  • From: Ignacio Rodriguez <ignacio at>
  • Date: Wed, 19 Sep 2001 00:16:33 -0400 (EDT)
  • Organization: UCM
  • References: <9naldr$np6$>
  • Sender: owner-wri-mathgroup at

Alan Tu wrote:

1. The function you are looking for is N. For example:

N[{2/3,3/7},20] gives {0.6666666666666666667,0.4285714285714285714}

> 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?

2. Union itself eliminates these duplicates:

Union[{2/3,2/3}] gives {2/3}

> Also, suppose that I have done that and now have a list of (still sorted, I
> 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


Ignacio Rodriguez Ramirez de Arellano
Unidad de RMN
Universidad Complutense
Paseo Juan XXIII, 1
Madrid 28040, Spain

Tel. 34-91-394-3288
Fax  34-91-394-3245
e-mail: ignacio at

  • Prev by Date: Two plots, two ranges with a Stress-Strain diagram
  • Next by Date: Re: Combinations
  • Previous by thread: Re: newbie: computing rational numbers and decimal
  • Next by thread: MATLAB to Mathematica 4.1