Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2839 > unrolled thread

FixedPoint[Cos, 1.0]

Started byJ Siehler <jsiehler@gmail.com>
First post2011-05-31 11:49 +0000
Last post2011-06-01 08:32 +0000
Articles 6 — 5 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  FixedPoint[Cos, 1.0] J Siehler <jsiehler@gmail.com> - 2011-05-31 11:49 +0000
    Re: FixedPoint[Cos, 1.0] David Reiss <dbreiss@gmail.com> - 2011-06-01 08:30 +0000
    Re: FixedPoint[Cos, 1.0] Szabolcs Horvát <szhorvat@gmail.com> - 2011-06-01 08:30 +0000
    Re: FixedPoint[Cos, 1.0] Szabolcs Horvát <szhorvat@gmail.com> - 2011-06-01 08:30 +0000
    Re: FixedPoint[Cos, 1.0] "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-06-01 08:32 +0000
    Re: FixedPoint[Cos, 1.0] Erik Max Francis <max@alcyone.com> - 2011-06-01 08:32 +0000

#2839 — FixedPoint[Cos, 1.0]

FromJ Siehler <jsiehler@gmail.com>
Date2011-05-31 11:49 +0000
SubjectFixedPoint[Cos, 1.0]
Message-ID<is2kjq$qrm$1@smc.vnet.net>
My numerical analysis students this past term pointed out to me that
the command

FixedPoint[Cos, 1.0]

which is the first example in the Information for FixedPoint doesn't
ever finish running (or, not in any reasonable amount of time).  We
tried this on serveral versions of Mathematica (6.x, 7.x, and 8.x),
all on OS X, and got the same nonresult.

It can be forced by specifying something like FixedPoint[Cos, 1.0,
SameTest -> (Abs[#1 - #2] < 10^-10 &)] or FixedPoint[Cos, 1.0, 40],
but it seems like that should be unnecessary, and the form given in
the documentation should work.  Can anybody else confirm this
behavior?  Am I missing something totally obvious here?

[toc] | [next] | [standalone]


#2846

FromDavid Reiss <dbreiss@gmail.com>
Date2011-06-01 08:30 +0000
Message-ID<is4tb3$av4$1@smc.vnet.net>
In reply to#2839
Take a look at the comment in the "Possible Issues" section of the
documentation.  This is a "teachable moment" for your students
concerning machine arithmetic and library functions.

Best,
David

On May 31, 7:49 am, J Siehler <jsieh...@gmail.com> wrote:
> My numerical analysis students this past term pointed out to me that
> the command
>
> FixedPoint[Cos, 1.0]
>
> which is the first example in the Information for FixedPoint doesn't
> ever finish running (or, not in any reasonable amount of time).  We
> tried this on serveral versions of Mathematica (6.x, 7.x, and 8.x),
> all on OS X, and got the same nonresult.
>
> It can be forced by specifying something like FixedPoint[Cos, 1.0,
> SameTest -> (Abs[#1 - #2] < 10^-10 &)] or FixedPoint[Cos, 1.0, 40],
> but it seems like that should be unnecessary, and the form given in
> the documentation should work.  Can anybody else confirm this
> behavior?  Am I missing something totally obvious here?

[toc] | [prev] | [next] | [standalone]


#2847

FromSzabolcs Horvát <szhorvat@gmail.com>
Date2011-06-01 08:30 +0000
Message-ID<is4tbo$avn$1@smc.vnet.net>
In reply to#2839
On 2011.05.31. 13:49, J Siehler wrote:
> My numerical analysis students this past term pointed out to me that
> the command
>
> FixedPoint[Cos, 1.0]
>
> which is the first example in the Information for FixedPoint doesn't
> ever finish running (or, not in any reasonable amount of time).  We
> tried this on serveral versions of Mathematica (6.x, 7.x, and 8.x),
> all on OS X, and got the same nonresult.
>
> It can be forced by specifying something like FixedPoint[Cos, 1.0,
> SameTest ->  (Abs[#1 - #2]<  10^-10&)] or FixedPoint[Cos, 1.0, 40],
> but it seems like that should be unnecessary, and the form given in
> the documentation should work.  Can anybody else confirm this
> behavior?  Am I missing something totally obvious here?
>

On Windows / Pentium M it finishes if I pass a machine number (1.0) to 
it.  It does not finish if I pass it a number with fixed precision (e.g. 
1.0`10) because the Precision of the result keeps increasing with 
successive applications of Cos.

I'm curious, on your machine will the function keep oscillating between 
two values?  What (and how many) values do you get if you do e.g.

Union@Take[Length@FixedPointList[Cos, 1.0, 1000], -10]

?

  -- Szabolcs

[toc] | [prev] | [next] | [standalone]


#2848

FromSzabolcs Horvát <szhorvat@gmail.com>
Date2011-06-01 08:30 +0000
Message-ID<is4tc3$b01$1@smc.vnet.net>
In reply to#2839
On 2011.05.31. 15:34, Szabolcs Horvát wrote:
> On 2011.05.31. 13:49, J Siehler wrote:
>> My numerical analysis students this past term pointed out to me that
>> the command
>>
>> FixedPoint[Cos, 1.0]
>>
>> which is the first example in the Information for FixedPoint doesn't
>> ever finish running (or, not in any reasonable amount of time). We
>> tried this on serveral versions of Mathematica (6.x, 7.x, and 8.x),
>> all on OS X, and got the same nonresult.
>>
>> It can be forced by specifying something like FixedPoint[Cos, 1.0,
>> SameTest -> (Abs[#1 - #2]< 10^-10&)] or FixedPoint[Cos, 1.0, 40],
>> but it seems like that should be unnecessary, and the form given in
>> the documentation should work. Can anybody else confirm this
>> behavior? Am I missing something totally obvious here?
>>
>
> On Windows / Pentium M it finishes if I pass a machine number (1.0) to
> it. It does not finish if I pass it a number with fixed precision (e.g.
> 1.0`10) because the Precision of the result keeps increasing with
> successive applications of Cos.
>
> I'm curious, on your machine will the function keep oscillating between
> two values? What (and how many) values do you get if you do e.g.
>
> Union@Take[Length@FixedPointList[Cos, 1.0, 1000], -10]
>

Sorry, of course I mean

Union@Take[FixedPointList[Cos, 1.0, 1000], -10]

!

I seem to get a similar behaviour on my machine with another function:

Cos[#]^2 &

Doing

Union@Take[FixedPointList[Cos[#]^2&, 1.0, 1000], -10]

shows that it's indeed oscillating between two values.

[toc] | [prev] | [next] | [standalone]


#2856

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2011-06-01 08:32 +0000
Message-ID<is4ten$b2d$1@smc.vnet.net>
In reply to#2839
Let`s go one step further down in version:

In[1]:=
FixedPoint[Cos, 1.0]
Out[1]=
0.739085
In[2]:=
$Version
Out[2]=
5.2 for Microsoft Windows (June 20, 2005)

Regards,
Wolfgang

"J Siehler" <jsiehler@gmail.com> schrieb im Newsbeitrag 
news:is2kjq$qrm$1@smc.vnet.net...
> My numerical analysis students this past term pointed out to me that
> the command
>
> FixedPoint[Cos, 1.0]
>
> which is the first example in the Information for FixedPoint doesn't
> ever finish running (or, not in any reasonable amount of time).  We
> tried this on serveral versions of Mathematica (6.x, 7.x, and 8.x),
> all on OS X, and got the same nonresult.
>
> It can be forced by specifying something like FixedPoint[Cos, 1.0,
> SameTest -> (Abs[#1 - #2] < 10^-10 &)] or FixedPoint[Cos, 1.0, 40],
> but it seems like that should be unnecessary, and the form given in
> the documentation should work.  Can anybody else confirm this
> behavior?  Am I missing something totally obvious here?
> 

[toc] | [prev] | [next] | [standalone]


#2859

FromErik Max Francis <max@alcyone.com>
Date2011-06-01 08:32 +0000
Message-ID<is4tfn$b3a$1@smc.vnet.net>
In reply to#2839
J Siehler wrote:
> My numerical analysis students this past term pointed out to me that
> the command
> 
> FixedPoint[Cos, 1.0]
> 
> which is the first example in the Information for FixedPoint doesn't
> ever finish running (or, not in any reasonable amount of time).  We
> tried this on serveral versions of Mathematica (6.x, 7.x, and 8.x),
> all on OS X, and got the same nonresult.

Works fine (and quickly) here (Linux 7.0.x for Linux):

In[1]:= FixedPoint[Cos, 1.0]

Out[1]= 0.739085

In[2]:= Timing[FixedPoint[Cos, 1.0]]

                    -18
Out[2]= {6.01732 10   , 0.739085}

-- 
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
   Performing in front of a live audience is like a feeling of shock.
    -- Sade Adu

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web