Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Rescale

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65451] Re: Rescale
  • From: "Ray Koopman" <koopman at sfu.ca>
  • Date: Sun, 2 Apr 2006 05:00:11 -0400 (EDT)
  • References: <e0llug$79h$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Bill Rowe wrote:
> On 3/31/06 at 6:09 AM, koopman at sfu.ca (Ray Koopman) wrote:
>
>> InputForm@{#,Rescale@#}&@Sort@Table[Random[],{3}]
>
>> {{0.1495146427525807, 0.9032356867418898, 0.9803938132050517},
>> {2.7755575615628914*^-17, 0.9071367664432557, 1.0000000000000002}}
>
>> What is Rescale doing, that it does not always give N@0 and N@1 for
>> the first and last elements?
>
> I would *guess* it is doing exactly as advertised using floating
> point arithmetic and what you are seeing for some inputs is due to
> the usual vagaries of floating point arithmetic.

{u = {0.1495146427525807, 0.9032356867418898, 0.9803938132050517},
 v = Rescale@u,
 w = (u-First@u)/(Last@u-First@u),
 v-w} //InputForm

{{0.1495146427525807, 0.9032356867418898, 0.9803938132050517},
 {2.7755575615628914*^-17, 0.9071367664432557, 1.0000000000000002},
 {0., 0.9071367664432558, 1.},
 {2.7755575615628914*^-17, -1.1102230246251565*^-16,
  2.220446049250313*^-16}}

Rescale must be doing something extra, to make v and w differ.


  • Prev by Date: SpeakTextPacket in 5.2
  • Next by Date: Strange Det function behavior.
  • Previous by thread: Re: Rescale
  • Next by thread: Re: simplify a trig expression