by Eugeniy E. Mikhailov and Greg Bentsen
Primary purpose
What can be done in 1 second?
ENIAC
Intel i7 3000+ (5GHz) circa of 2025
Speed measured in FLOPS (the number of floating point operations per second) which usually proportional to the clock frequency.
Different computer architectures (AMD, Mac, Intel, ARM …) have different proportionality coefficient.
My 2 GHz AMD Phenon PC (circa 2011) can do about 50 MegaFLOPS
Brain
Desktop or Notebook
AI capable computer
Data center
Note: Data centers annual energy use is % of U.S. annual electricity consumption according to congress.gov (2023 report)
Computers are incredibly fast, accurate, and stupid. Humans beings are incredibly slow, inaccurate, and brilliant. Together they are powerful beyond imagination.
Leo Cherne (1969)
There are hundreds of programming languages.
Unfortunately none of them serve all needs.
Compiled
just-in-time compilation
Interpreted
Pros
Cons
Python was conceived by Guido van Rossum with the first release in 1991.
Please, do it before this Friday class, also do not forget to bring your notebooks/laptops with you for Friday classes.
For example:
But computer has limited amount of memory. Thus it cannot hold infinite amount of digits and has to truncate somewhere.
Let’s say it can hold only 4 significant digits.
This called round off error due to truncation/rounding. Then for computer
or
or even more interesting
Modern general purpose computers use binary representation
Bit is too small so we use byte
Byte is clearly too small to be used for real life computation.
Note that in stock Python integers are unbound
10**500 produces number with 500 zeros1 + 10**500 or 2 * 10 **500 works10*500 / 2 failsbut in practical (fast) math Python uses up to 8 bytes or 64 bits for number representation (this is CPU dependent)
sys.maxsizeWhat to do if you need to store a float number?
For example
First convert it to scientific notation
truncate it to certain number of significant digits
resulting number should have a form
Computers internally use binary base
maximum
(provided by sys.float_info.max in Python)
smallest non zero
(provided by sys.float_info.min in Python)