SlideShare a Scribd company logo
Can you count on your computer?
Hamed Zakerzadeh
Hamed Zakerzadeh Can you count on your computer? 1 / 4
Fibonacci numbers 1,1,2,3,5,8,⋯
describe rabbit’s population:
They can be written as a recursive sequence:
for k ≥ 2 fk = fk−1 + fk−2, f0 = f1 = 0
Johannes Kepler (17th
century) showed that the ratio of consecutive
Fibonacci numbers converges to the golden ratio
rk =
fk+1
fk
= {1,2,1.5,1.67,1.63,1.62,⋯} or lim
k→∞
rk = ϕ ≈ 1.618
Hamed Zakerzadeh Can you count on your computer? 2 / 4
Can your computer confirm that rk → ϕ?
import numpy as np
N = 50
f = np.zeros(N,dtype=np.int32)
r = np.zeros(N-1)
f[0] = 1
f[1] = 1
r[0] = f[1] / f[0]
for k in range(2,N):
f[k] = f[k-1] + f[k-2]
r[k-1] = f[k] / f[k-1]
The division of positive numbers gets negative!
Your computer allocates 32 bits of memory to each Fibonacci number. So
they cannot be saved properly if they get bigger than 231
.
Around k = 40, they pass this limit. Ô⇒ everything collapses! /
Hamed Zakerzadeh Can you count on your computer? 3 / 4
Lesson of the day
Computers don’t perceive the numbers like us. They save them with
a limited precision (like floating-point format).
You may count on your computer but check possible sources of error.
Look here to see more practical examples:
Hamed Zakerzadeh Can you count on your computer? 4 / 4

More Related Content

What's hot

Writing Equations of Trig Graphs
Writing Equations of Trig GraphsWriting Equations of Trig Graphs
Writing Equations of Trig Graphs
Kate Nowak
 
Demystifying Software Interviews
Demystifying Software InterviewsDemystifying Software Interviews
Demystifying Software Interviews
Michael Viveros
 
B Trees
B TreesB Trees
B Trees
Aisu
 
Alg1 ch0407example23
Alg1 ch0407example23Alg1 ch0407example23
Alg1 ch0407example23amymallory
 
Analisis matematico
Analisis matematicoAnalisis matematico
Analisis matematico
andres fernando mosquera diaz
 
6th Math (C2) - L51--Jan27
6th Math (C2) - L51--Jan276th Math (C2) - L51--Jan27
6th Math (C2) - L51--Jan27jdurst65
 
Logic Design - Chapter 4: Karnaugh Maps
Logic Design - Chapter 4: Karnaugh MapsLogic Design - Chapter 4: Karnaugh Maps
Logic Design - Chapter 4: Karnaugh Maps
Gouda Mando
 
maXbox Regular Expression in PI
maXbox Regular Expression in PImaXbox Regular Expression in PI
maXbox Regular Expression in PI
Max Kleiner
 
6.4 Graphing Polynomials (Relative Max/Min)
6.4 Graphing Polynomials (Relative Max/Min)6.4 Graphing Polynomials (Relative Max/Min)
6.4 Graphing Polynomials (Relative Max/Min)swartzje
 
Slides to RSA Presentation
Slides to RSA PresentationSlides to RSA Presentation
Slides to RSA Presentation
David Boyhan, JD, CIPP
 
Darkonoid
DarkonoidDarkonoid
Darkonoid
graphitech
 
Chapter 01 – Section 01
Chapter 01 – Section 01Chapter 01 – Section 01
Chapter 01 – Section 01
WCalhoun
 

What's hot (13)

Writing Equations of Trig Graphs
Writing Equations of Trig GraphsWriting Equations of Trig Graphs
Writing Equations of Trig Graphs
 
Demystifying Software Interviews
Demystifying Software InterviewsDemystifying Software Interviews
Demystifying Software Interviews
 
B Trees
B TreesB Trees
B Trees
 
Alg1 ch0407example23
Alg1 ch0407example23Alg1 ch0407example23
Alg1 ch0407example23
 
Analisis matematico
Analisis matematicoAnalisis matematico
Analisis matematico
 
6th Math (C2) - L51--Jan27
6th Math (C2) - L51--Jan276th Math (C2) - L51--Jan27
6th Math (C2) - L51--Jan27
 
1st 1
1st 11st 1
1st 1
 
Logic Design - Chapter 4: Karnaugh Maps
Logic Design - Chapter 4: Karnaugh MapsLogic Design - Chapter 4: Karnaugh Maps
Logic Design - Chapter 4: Karnaugh Maps
 
maXbox Regular Expression in PI
maXbox Regular Expression in PImaXbox Regular Expression in PI
maXbox Regular Expression in PI
 
6.4 Graphing Polynomials (Relative Max/Min)
6.4 Graphing Polynomials (Relative Max/Min)6.4 Graphing Polynomials (Relative Max/Min)
6.4 Graphing Polynomials (Relative Max/Min)
 
Slides to RSA Presentation
Slides to RSA PresentationSlides to RSA Presentation
Slides to RSA Presentation
 
Darkonoid
DarkonoidDarkonoid
Darkonoid
 
Chapter 01 – Section 01
Chapter 01 – Section 01Chapter 01 – Section 01
Chapter 01 – Section 01
 

Similar to Can you count on your computer?

Skiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programmingSkiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programmingzukun
 
tutorial5.ppt
tutorial5.ppttutorial5.ppt
tutorial5.ppt
jvjfvvoa
 
Fibonacci and Related Sequences
Fibonacci and Related SequencesFibonacci and Related Sequences
Fibonacci and Related Sequences
InsMartins35394
 
Reed Solomon encoder and decoder \ ريد سلمون
Reed Solomon encoder and decoder \ ريد سلمونReed Solomon encoder and decoder \ ريد سلمون
Reed Solomon encoder and decoder \ ريد سلمون
Muhammed Abdulmahdi
 
摂動完全均衡 -1- 【ナッシュ均衡の精緻化】
摂動完全均衡 -1- 【ナッシュ均衡の精緻化】摂動完全均衡 -1- 【ナッシュ均衡の精緻化】
摂動完全均衡 -1- 【ナッシュ均衡の精緻化】
ssusere0a682
 
maths ppt.pdf
maths ppt.pdfmaths ppt.pdf
maths ppt.pdf
nihaiqbal1
 
maths ppt.pdf
maths ppt.pdfmaths ppt.pdf
maths ppt.pdf
nihaiqbal1
 
Topic modeling with Poisson factorization (2)
Topic modeling with Poisson factorization (2)Topic modeling with Poisson factorization (2)
Topic modeling with Poisson factorization (2)
Tomonari Masada
 
Lesson 1 Solving Quadratic Equations by Factoring.pptx
Lesson 1 Solving Quadratic Equations by Factoring.pptxLesson 1 Solving Quadratic Equations by Factoring.pptx
Lesson 1 Solving Quadratic Equations by Factoring.pptx
HazelJoySoriano
 
Goldie chapter 4 function
Goldie chapter 4 functionGoldie chapter 4 function
Goldie chapter 4 function
Sarah Sue Calbio
 
Reed solomon Encoder and Decoder
Reed solomon Encoder and DecoderReed solomon Encoder and Decoder
Reed solomon Encoder and Decoder
Ameer H Ali
 
Darmon Points for fields of mixed signature
Darmon Points for fields of mixed signatureDarmon Points for fields of mixed signature
Darmon Points for fields of mixed signature
mmasdeu
 
Taller de Mecanica Calsica
Taller de Mecanica CalsicaTaller de Mecanica Calsica
Taller de Mecanica Calsica
Pedro Martin Ibarbo Perlaza
 
k-MLE: A fast algorithm for learning statistical mixture models
k-MLE: A fast algorithm for learning statistical mixture modelsk-MLE: A fast algorithm for learning statistical mixture models
k-MLE: A fast algorithm for learning statistical mixture models
Frank Nielsen
 
Fractal Rendering in Developer C++ - 2012-11-06
Fractal Rendering in Developer C++ - 2012-11-06Fractal Rendering in Developer C++ - 2012-11-06
Fractal Rendering in Developer C++ - 2012-11-06
Aritra Sarkar
 
Activ.aprendiz. 3a y 3b
Activ.aprendiz. 3a y 3bActiv.aprendiz. 3a y 3b
Activ.aprendiz. 3a y 3b
Cristian Vaca
 
Darmon Points for fields of mixed signature
Darmon Points for fields of mixed signatureDarmon Points for fields of mixed signature
Darmon Points for fields of mixed signature
mmasdeu
 
Tucker tensor analysis of Matern functions in spatial statistics
Tucker tensor analysis of Matern functions in spatial statistics Tucker tensor analysis of Matern functions in spatial statistics
Tucker tensor analysis of Matern functions in spatial statistics
Alexander Litvinenko
 

Similar to Can you count on your computer? (20)

Skiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programmingSkiena algorithm 2007 lecture16 introduction to dynamic programming
Skiena algorithm 2007 lecture16 introduction to dynamic programming
 
tutorial5.ppt
tutorial5.ppttutorial5.ppt
tutorial5.ppt
 
Fibonacci and Related Sequences
Fibonacci and Related SequencesFibonacci and Related Sequences
Fibonacci and Related Sequences
 
Reed Solomon encoder and decoder \ ريد سلمون
Reed Solomon encoder and decoder \ ريد سلمونReed Solomon encoder and decoder \ ريد سلمون
Reed Solomon encoder and decoder \ ريد سلمون
 
摂動完全均衡 -1- 【ナッシュ均衡の精緻化】
摂動完全均衡 -1- 【ナッシュ均衡の精緻化】摂動完全均衡 -1- 【ナッシュ均衡の精緻化】
摂動完全均衡 -1- 【ナッシュ均衡の精緻化】
 
maths ppt.pdf
maths ppt.pdfmaths ppt.pdf
maths ppt.pdf
 
maths ppt.pdf
maths ppt.pdfmaths ppt.pdf
maths ppt.pdf
 
Topic modeling with Poisson factorization (2)
Topic modeling with Poisson factorization (2)Topic modeling with Poisson factorization (2)
Topic modeling with Poisson factorization (2)
 
final19
final19final19
final19
 
Lesson 1 Solving Quadratic Equations by Factoring.pptx
Lesson 1 Solving Quadratic Equations by Factoring.pptxLesson 1 Solving Quadratic Equations by Factoring.pptx
Lesson 1 Solving Quadratic Equations by Factoring.pptx
 
Goldie chapter 4 function
Goldie chapter 4 functionGoldie chapter 4 function
Goldie chapter 4 function
 
Reed solomon Encoder and Decoder
Reed solomon Encoder and DecoderReed solomon Encoder and Decoder
Reed solomon Encoder and Decoder
 
Darmon Points for fields of mixed signature
Darmon Points for fields of mixed signatureDarmon Points for fields of mixed signature
Darmon Points for fields of mixed signature
 
Taller de Mecanica Calsica
Taller de Mecanica CalsicaTaller de Mecanica Calsica
Taller de Mecanica Calsica
 
k-MLE: A fast algorithm for learning statistical mixture models
k-MLE: A fast algorithm for learning statistical mixture modelsk-MLE: A fast algorithm for learning statistical mixture models
k-MLE: A fast algorithm for learning statistical mixture models
 
Fractal Rendering in Developer C++ - 2012-11-06
Fractal Rendering in Developer C++ - 2012-11-06Fractal Rendering in Developer C++ - 2012-11-06
Fractal Rendering in Developer C++ - 2012-11-06
 
Text s1 21
Text s1 21Text s1 21
Text s1 21
 
Activ.aprendiz. 3a y 3b
Activ.aprendiz. 3a y 3bActiv.aprendiz. 3a y 3b
Activ.aprendiz. 3a y 3b
 
Darmon Points for fields of mixed signature
Darmon Points for fields of mixed signatureDarmon Points for fields of mixed signature
Darmon Points for fields of mixed signature
 
Tucker tensor analysis of Matern functions in spatial statistics
Tucker tensor analysis of Matern functions in spatial statistics Tucker tensor analysis of Matern functions in spatial statistics
Tucker tensor analysis of Matern functions in spatial statistics
 

More from Hamed Zakerzadeh

Asymptotic Preserving Schemes
Asymptotic Preserving SchemesAsymptotic Preserving Schemes
Asymptotic Preserving Schemes
Hamed Zakerzadeh
 
Is “Principal Component Analysis” different from SVD?
Is “Principal Component Analysis” different from SVD?Is “Principal Component Analysis” different from SVD?
Is “Principal Component Analysis” different from SVD?
Hamed Zakerzadeh
 
Normal equations for linear regression?
Normal equations for linear regression?Normal equations for linear regression?
Normal equations for linear regression?
Hamed Zakerzadeh
 
Can you count on your computer for the Gaussian elimination?
Can you count on your computer for the Gaussian elimination?Can you count on your computer for the Gaussian elimination?
Can you count on your computer for the Gaussian elimination?
Hamed Zakerzadeh
 
Congrès SMAI 2019
Congrès SMAI 2019Congrès SMAI 2019
Congrès SMAI 2019
Hamed Zakerzadeh
 
ENTROPY STABLE ENO SCHEMES
ENTROPY STABLE ENO SCHEMESENTROPY STABLE ENO SCHEMES
ENTROPY STABLE ENO SCHEMESHamed Zakerzadeh
 

More from Hamed Zakerzadeh (7)

Asymptotic Preserving Schemes
Asymptotic Preserving SchemesAsymptotic Preserving Schemes
Asymptotic Preserving Schemes
 
Is “Principal Component Analysis” different from SVD?
Is “Principal Component Analysis” different from SVD?Is “Principal Component Analysis” different from SVD?
Is “Principal Component Analysis” different from SVD?
 
Normal equations for linear regression?
Normal equations for linear regression?Normal equations for linear regression?
Normal equations for linear regression?
 
Can you count on your computer for the Gaussian elimination?
Can you count on your computer for the Gaussian elimination?Can you count on your computer for the Gaussian elimination?
Can you count on your computer for the Gaussian elimination?
 
Congrès SMAI 2019
Congrès SMAI 2019Congrès SMAI 2019
Congrès SMAI 2019
 
Higham
HighamHigham
Higham
 
ENTROPY STABLE ENO SCHEMES
ENTROPY STABLE ENO SCHEMESENTROPY STABLE ENO SCHEMES
ENTROPY STABLE ENO SCHEMES
 

Recently uploaded

How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 

Recently uploaded (20)

How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 

Can you count on your computer?

  • 1. Can you count on your computer? Hamed Zakerzadeh Hamed Zakerzadeh Can you count on your computer? 1 / 4
  • 2. Fibonacci numbers 1,1,2,3,5,8,⋯ describe rabbit’s population: They can be written as a recursive sequence: for k ≥ 2 fk = fk−1 + fk−2, f0 = f1 = 0 Johannes Kepler (17th century) showed that the ratio of consecutive Fibonacci numbers converges to the golden ratio rk = fk+1 fk = {1,2,1.5,1.67,1.63,1.62,⋯} or lim k→∞ rk = ϕ ≈ 1.618 Hamed Zakerzadeh Can you count on your computer? 2 / 4
  • 3. Can your computer confirm that rk → ϕ? import numpy as np N = 50 f = np.zeros(N,dtype=np.int32) r = np.zeros(N-1) f[0] = 1 f[1] = 1 r[0] = f[1] / f[0] for k in range(2,N): f[k] = f[k-1] + f[k-2] r[k-1] = f[k] / f[k-1] The division of positive numbers gets negative! Your computer allocates 32 bits of memory to each Fibonacci number. So they cannot be saved properly if they get bigger than 231 . Around k = 40, they pass this limit. Ô⇒ everything collapses! / Hamed Zakerzadeh Can you count on your computer? 3 / 4
  • 4. Lesson of the day Computers don’t perceive the numbers like us. They save them with a limited precision (like floating-point format). You may count on your computer but check possible sources of error. Look here to see more practical examples: Hamed Zakerzadeh Can you count on your computer? 4 / 4