Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'time to convergence within e' topicStudent Support Forum > General > "time to convergence within e"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Peter Pein
10/27/08 07:00am

Hi,
please do not use N as variable. It is a kernel-function.

NestWhileList is the 'natural' way to do this:
n0 = (1/2)*(3 + Sqrt[5]);
f[e_] := Length[NestWhileList[Sqrt[#1] + 1 & , 2., Abs[n0 - #1] >= e & ]] - 1

for example: f /@ (10^Range[-8, 0])
gives
{16, 14, 12, 10, 8, 6, 4, 2, 0}

URL: ,

Subject (listing for 'time to convergence within e')
Author Date Posted
time to convergence within e Andy 10/27/08 01:02am
Re: time to convergence within e Peter Pein 10/27/08 07:00am
Re: time to convergence within e yehuda ben-s... 10/28/08 01:24am
Re: time to convergence within e yehuda ben-s... 10/28/08 03:35am
Re: time to convergence within e Xavier 10/29/08 07:56am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic