From d9c11c5796c06feadf7cad1e3c3f02a8b552f398 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Thu, 12 Mar 2020 19:42:10 +0100 Subject: [PATCH] Streamline presentation --- 03_conditionals_02_exercises.ipynb | 4 +- 05_numbers_00_lecture.ipynb | 2891 +++++++++++++++++----------- 05_numbers_02_exercises.ipynb | 22 +- 3 files changed, 1818 insertions(+), 1099 deletions(-) diff --git a/03_conditionals_02_exercises.ipynb b/03_conditionals_02_exercises.ipynb index 650b063..ac4acd1 100644 --- a/03_conditionals_02_exercises.ipynb +++ b/03_conditionals_02_exercises.ipynb @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Read [Chapter 3](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_00_lecture.ipynb) of the book. Then, work through the exercises below." + "Read [Chapter 3](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_00_lecture.ipynb) of the book. Then, work through the exercises below. The `...` indicate where you need to fill in your answers. You should not need to create any additional code cells." ] }, { @@ -136,7 +136,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1.4**: Looking at the `if`-`else`-logic in the function, why do you think the four example line items in **Q9.2** were chosen as they were?" + "**Q1.4**: Looking at the `if`-`else`-logic in the function, why do you think the four example line items in **Q1.2** were chosen as they were?" ] }, { diff --git a/05_numbers_00_lecture.ipynb b/05_numbers_00_lecture.ipynb index 531de04..e4bed12 100644 --- a/05_numbers_00_lecture.ipynb +++ b/05_numbers_00_lecture.ipynb @@ -66,7 +66,7 @@ }, "outputs": [], "source": [ - "i = 789" + "a = 42" ] }, { @@ -77,7 +77,7 @@ } }, "source": [ - "Just like any other object, `789` has an identity, a type, and a value." + "Just like any other object, the `42` has an identity, a type, and a value." ] }, { @@ -92,7 +92,7 @@ { "data": { "text/plain": [ - "140166838695792" + "94315929536576" ] }, "execution_count": 2, @@ -101,7 +101,7 @@ } ], "source": [ - "id(i)" + "id(a)" ] }, { @@ -109,7 +109,7 @@ "execution_count": 3, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -125,7 +125,7 @@ } ], "source": [ - "type(i)" + "type(a)" ] }, { @@ -133,14 +133,14 @@ "execution_count": 4, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "789" + "42" ] }, "execution_count": 4, @@ -149,7 +149,7 @@ } ], "source": [ - "i" + "a" ] }, { @@ -160,7 +160,7 @@ } }, "source": [ - "A nice feature is using underscores `_` as (thousands) separator in numeric literals. For example, `1_000_000` evaluates to `1000000` in memory." + "A nice feature in newer Python versions is using underscores `_` as (thousands) separators in numeric literals. For example, `1_000_000` evaluates to `1000000` in memory; the `_` is simply ignored by the interpreter." ] }, { @@ -195,7 +195,7 @@ } }, "source": [ - "Whereas mathematicians argue what the term $0^0$ means (cf., this [article](https://en.wikipedia.org/wiki/Zero_to_the_power_of_zero)), programmers are pragmatic about this and define $0^0 = 1$." + "The `int` type follows all rules we know from math, apart from one exception: Whereas mathematicians argue what the term $0^0$ means (cf., this [article](https://en.wikipedia.org/wiki/Zero_to_the_power_of_zero)), programmers are pragmatic about this and define $0^0 = 1$." ] }, { @@ -270,7 +270,7 @@ "\n", "To encode the integer $3$, for example, we need to find a combination of $0$s and $1$s such that the sum of digits marked with a $1$ is equal to the number we want to encode. In the example, we set all bits to $0$ except for the first ($i=0$) and second ($i=1$) as $2^0 + 2^1 = 1 + 2 = 3$. So the binary representation of $3$ is $00~00~00~11$. To borrow some terminology from linear algebra, the $3$ is a linear combination of the digits where the coefficients are either $0$ or $1$: $3 = 0*128 + 0*64 + 0*32 + 0*16 + 0*8 + 0*4 + 1*2 + 1*1$. It is *guaranteed* that there is exactly *one* such combination for each number between $0$ and $255$.\n", "\n", - "As each bit in the binary representation is one of two values, we say that this representation has a base of $2$. Often, the base is indicated with a subscript to avoid confusion. For example, we write $3_{10} = 00000011_2$ or $3_{10} = 11_2$ for short omitting leading $0$s. A subscript of $10$ implies a decimal number as we know it from grade school.\n", + "As each bit in the binary representation is one of two values, we say that this representation has a base of $2$. Often, the base is indicated with a subscript to avoid confusion. For example, we write $3_{10} = 00000011_2$ or $3_{10} = 11_2$ for short omitting leading $0$s. A subscript of $10$ implies a decimal number as we know it from elementary school.\n", "\n", "We use the built-in [bin()](https://docs.python.org/3/library/functions.html#bin) function to obtain an `int` object's binary representation: It returns a `str` object starting with `\"0b\"` indicating the binary format and as many $0$s and $1$s as are necessary to encode the integer omitting leading $0$s." ] @@ -280,7 +280,7 @@ "execution_count": 7, "metadata": { "slideshow": { - "slide_type": "fragment" + "slide_type": "slide" } }, "outputs": [ @@ -377,7 +377,7 @@ } }, "source": [ - "Another example is the integer `177` that is the sum of $128 + 32 + 16 + 1$: Thus, its binary representation is the sequence of bits $10~11~00~01$, or to use our new notation, $177_{10} = 10110001_2$." + "It is convenient to use the underscore `_` to separate the `\"0b\"` prefix from the bits." ] }, { @@ -385,14 +385,14 @@ "execution_count": 10, "metadata": { "slideshow": { - "slide_type": "slide" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "'0b10110001'" + "3" ] }, "execution_count": 10, @@ -401,7 +401,7 @@ } ], "source": [ - "bin(177)" + "0b_11" ] }, { @@ -412,7 +412,7 @@ } }, "source": [ - "Analogous to typing `177` into a code cell, we may write `0b10110001`, or `0b_1011_0001` to make use of the underscores, and create an `int` object with the value `177`." + "Another example is the integer `123` that is the sum of $64 + 32 + 16 + 8 + 2 + 1$: Thus, its binary representation is the sequence of bits $01~11~10~11$, or to use our new notation, $123_{10} = 1111011_2$." ] }, { @@ -420,14 +420,14 @@ "execution_count": 11, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "skip" } }, "outputs": [ { "data": { "text/plain": [ - "177" + "'0b1111011'" ] }, "execution_count": 11, @@ -436,7 +436,42 @@ } ], "source": [ - "0b_1011_0001" + "bin(123)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "Analogous to typing `123` into a code cell, we may write `0b1111011`, or `0b_111_1011` to make use of the underscores, and create an `int` object with the value `123`." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "123" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0b_111_1011" ] }, { @@ -452,7 +487,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": { "slideshow": { "slide_type": "slide" @@ -465,7 +500,7 @@ "'0b0'" ] }, - "execution_count": 12, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -476,10 +511,10 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "skip" } }, "outputs": [ @@ -489,7 +524,7 @@ "'0b1'" ] }, - "execution_count": 13, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -500,10 +535,10 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "skip" } }, "outputs": [ @@ -513,7 +548,7 @@ "'0b10'" ] }, - "execution_count": 14, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -524,10 +559,10 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -537,7 +572,7 @@ "'0b11111111'" ] }, - "execution_count": 15, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -556,12 +591,12 @@ "source": [ "Groups of eight bits are also called a **byte**. As a byte can only represent non-negative integers up to $255$, the table above is extended conceptually with greater digits to the left to model integers beyond $255$. The memory management needed to implement this is built into Python, and we do not need to worry about it.\n", "\n", - "For example, the `789` from above is encoded with ten bits and $789_{10} = 1100010101_2$." + "For example, `789` is encoded with ten bits and $789_{10} = 1100010101_2$." ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": { "slideshow": { "slide_type": "fragment" @@ -574,13 +609,13 @@ "'0b1100010101'" ] }, - "execution_count": 16, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(i) # = bin(789)" + "bin(789)" ] }, { @@ -598,7 +633,254 @@ "| Digit |$10^3$|$10^2$|$10^1$|$10^0$|\n", "| $=$ |$1000$| $100$| $10$ | $1$ |\n", "\n", - "Now, an integer is a linear combination of the digits where the coefficients are one of *ten* values, and the base is now $10$. For example, the number $123$ can be expressed as $0*1000 + 1*100 + 2*10 + 3*1$. So, the binary representation follows the same logic as the decimal system taught in grade school. The decimal system is intuitive to us humans, mostly as we learn to count with our *ten* fingers. The $0$s and $1$s in a computer's memory are therefore no rocket science; they only feel unintuitive for a beginner." + "Now, an integer is a linear combination of the digits where the coefficients are one of *ten* values, and the base is now $10$. For example, the number $123$ can be expressed as $0*1000 + 1*100 + 2*10 + 3*1$. So, the binary representation follows the same logic as the decimal system taught in elementary school. The decimal system is intuitive to us humans, mostly as we learn to count with our *ten* fingers. The $0$s and $1$s in a computer's memory are therefore no rocket science; they only feel unintuitive for a beginner." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "#### Arithmetic with Bits" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "Adding two numbers in their binary representations is straightforward and works just like we all learned addition in elementary school. Going from right to left, we add the individual digits, and ..." + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1 + 2" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b1 + 0b10 = 0b11'" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(1) + \" + \" + bin(2) + \" = \" + bin(3)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "... if any two digits add up to $2$, the resulting digit is $0$ and a $1$ carries over." + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "4" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1 + 3" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b1 + 0b11 = 0b100'" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(1) + \" + \" + bin(3) + \" = \" + bin(4)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "Multiplication is also quite easy. All we need to do is to multiply the left operand by all digits of the right operand separately and then add up the individual products, just like in elementary school." + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "12" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "4 * 3" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b100 * 0b11 = 0b1100'" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(4) + \" * \" + bin(3) + \" = \" + bin(12)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b100 * 0b1 = 0b100'" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(4) + \" * \" + bin(1) + \" = \" + bin(4) # multiply with first digit" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b100 * 0b10 = 0b1000'" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(4) + \" * \" + bin(2) + \" = \" + bin(8) # multiply with second digit" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "The \"*Further Resources*\" section at the end of this chapter provides video tutorials on addition and multiplication in binary. Subtraction and division are a bit more involved but essentially also easy to understand." ] }, { @@ -676,7 +958,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 26, "metadata": { "slideshow": { "slide_type": "slide" @@ -689,7 +971,7 @@ "'0x0'" ] }, - "execution_count": 17, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -700,10 +982,10 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 27, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -713,7 +995,7 @@ "'0x1'" ] }, - "execution_count": 18, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -735,10 +1017,10 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 28, "metadata": { "slideshow": { - "slide_type": "fragment" + "slide_type": "skip" } }, "outputs": [ @@ -748,7 +1030,7 @@ "'0x3'" ] }, - "execution_count": 19, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -770,7 +1052,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 29, "metadata": { "slideshow": { "slide_type": "fragment" @@ -783,7 +1065,7 @@ "'0xa'" ] }, - "execution_count": 20, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -794,10 +1076,10 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 30, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -807,7 +1089,7 @@ "'0xf'" ] }, - "execution_count": 21, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -824,12 +1106,12 @@ } }, "source": [ - "The binary representation of `177`, `\"0b10110001\"`, can be viewed as *two* groups of four bits, $1011$ and $0001$, that are encoded as $\\text{b}$ and $1$ in hexadecimal (cf., table above)." + "The binary representation of `123`, `0b_111_1011`, can be viewed as *two* groups of four bits, $0111$ and $1011$, that are encoded as $7$ and $\\text{b}$ in hexadecimal (cf., table above)." ] }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 31, "metadata": { "slideshow": { "slide_type": "slide" @@ -839,40 +1121,40 @@ { "data": { "text/plain": [ - "'0b10110001'" + "'0b1111011'" ] }, - "execution_count": 22, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(177)" + "bin(123)" ] }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 32, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "'0xb1'" + "'0x7b'" ] }, - "execution_count": 23, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "hex(177)" + "hex(123)" ] }, { @@ -883,12 +1165,12 @@ } }, "source": [ - "To obtain a *new* `int` object with the value `177`, we call the [int()](https://docs.python.org/3/library/functions.html#int) built-in with a properly formatted `str` object and `base=16` as arguments." + "To obtain a *new* `int` object with the value `123`, we call the [int()](https://docs.python.org/3/library/functions.html#int) built-in with a properly formatted `str` object and `base=16` as arguments." ] }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 33, "metadata": { "slideshow": { "slide_type": "fragment" @@ -898,16 +1180,16 @@ { "data": { "text/plain": [ - "177" + "123" ] }, - "execution_count": 24, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "int(\"0xb1\", base=16)" + "int(\"0x7b\", base=16)" ] }, { @@ -923,7 +1205,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 34, "metadata": { "slideshow": { "slide_type": "fragment" @@ -933,16 +1215,16 @@ { "data": { "text/plain": [ - "177" + "123" ] }, - "execution_count": 25, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "0xb1" + "0x_7b" ] }, { @@ -958,7 +1240,31 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 35, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'0x0'" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hex(0)" + ] + }, + { + "cell_type": "code", + "execution_count": 36, "metadata": { "slideshow": { "slide_type": "skip" @@ -971,7 +1277,7 @@ "'0xff'" ] }, - "execution_count": 26, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } @@ -993,7 +1299,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 37, "metadata": { "slideshow": { "slide_type": "skip" @@ -1006,13 +1312,13 @@ "'0x315'" ] }, - "execution_count": 27, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "hex(i) # = hex(789)" + "hex(789)" ] }, { @@ -1045,14 +1351,14 @@ } }, "source": [ - "While there are conventions that model negative integers with $0$s and $1$s in memory (cf., [Two's Complement](https://en.wikipedia.org/wiki/Two%27s_complement)), Python manages that for us, and we do not look into the theory here for brevity. We have learned all we need to know about how integers are modeled in a computer.\n", + "While there are conventions that model negative integers with $0$s and $1$s in memory (cf., [Two's Complement](https://en.wikipedia.org/wiki/Two%27s_complement)), Python manages that for us, and we do not look into the theory here for brevity. We have learned all that a practitioner needs to know about how integers are modeled in a computer. The \"*Further Resources*\" section at the end of this chapter provides a video tutorial on how the [Two's Complement](https://en.wikipedia.org/wiki/Two%27s_complement) idea works.\n", "\n", - "The binary and hexadecimal representations of negative integers are identical to their positive counterparts except that they start with a minus sign `-`." + "The binary and hexadecimal representations of negative integers are identical to their positive counterparts except that they start with a minus sign `-`. However, as the video tutorial at the end of the chapter reveals, that is *not* how the bits are organized in memory." ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 38, "metadata": { "slideshow": { "slide_type": "skip" @@ -1065,7 +1371,7 @@ "'-0b11'" ] }, - "execution_count": 28, + "execution_count": 38, "metadata": {}, "output_type": "execute_result" } @@ -1076,7 +1382,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 39, "metadata": { "slideshow": { "slide_type": "skip" @@ -1089,7 +1395,7 @@ "'-0x3'" ] }, - "execution_count": 29, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" } @@ -1100,7 +1406,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 40, "metadata": { "slideshow": { "slide_type": "skip" @@ -1113,7 +1419,7 @@ "'-0b11111111'" ] }, - "execution_count": 30, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -1124,7 +1430,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 41, "metadata": { "slideshow": { "slide_type": "skip" @@ -1137,7 +1443,7 @@ "'-0xff'" ] }, - "execution_count": 31, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } @@ -1170,7 +1476,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 42, "metadata": { "slideshow": { "slide_type": "slide" @@ -1183,7 +1489,7 @@ "1" ] }, - "execution_count": 32, + "execution_count": 42, "metadata": {}, "output_type": "execute_result" } @@ -1194,10 +1500,10 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 43, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -1207,7 +1513,7 @@ "42" ] }, - "execution_count": 33, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" } @@ -1218,10 +1524,10 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 44, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -1231,13 +1537,13 @@ "0.0" ] }, - "execution_count": 34, + "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "42.0 * False" + "42.87 * False" ] }, { @@ -1253,7 +1559,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 45, "metadata": { "slideshow": { "slide_type": "slide" @@ -1266,7 +1572,7 @@ "1" ] }, - "execution_count": 35, + "execution_count": 45, "metadata": {}, "output_type": "execute_result" } @@ -1277,10 +1583,10 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 46, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -1290,7 +1596,7 @@ "0" ] }, - "execution_count": 36, + "execution_count": 46, "metadata": {}, "output_type": "execute_result" } @@ -1312,7 +1618,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 47, "metadata": { "slideshow": { "slide_type": "slide" @@ -1325,7 +1631,7 @@ "'0b1'" ] }, - "execution_count": 37, + "execution_count": 47, "metadata": {}, "output_type": "execute_result" } @@ -1336,10 +1642,10 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 48, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -1349,7 +1655,7 @@ "'0b0'" ] }, - "execution_count": 38, + "execution_count": 48, "metadata": {}, "output_type": "execute_result" } @@ -1371,10 +1677,10 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 49, "metadata": { "slideshow": { - "slide_type": "slide" + "slide_type": "skip" } }, "outputs": [ @@ -1384,7 +1690,7 @@ "'0x1'" ] }, - "execution_count": 39, + "execution_count": 49, "metadata": {}, "output_type": "execute_result" } @@ -1395,10 +1701,10 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 50, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "skip" } }, "outputs": [ @@ -1408,7 +1714,7 @@ "'0x0'" ] }, - "execution_count": 40, + "execution_count": 50, "metadata": {}, "output_type": "execute_result" } @@ -1425,12 +1731,12 @@ } }, "source": [ - "As a reminder, the `None` literal is a type on its own, namely the `NoneType`, and different from `False`. It *cannot* be cast as an integer as the `TypeError` indicates." + "As a reminder, the `None` object is a type on its own, namely the `NoneType`, and different from `False`. It *cannot* be cast as an integer as the `TypeError` indicates." ] }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 51, "metadata": { "slideshow": { "slide_type": "slide" @@ -1444,7 +1750,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mTypeError\u001b[0m: int() argument must be a string, a bytes-like object or a number, not 'NoneType'" ] } @@ -1476,12 +1782,12 @@ "\n", "We keep this overview rather short as such \"low-level\" operations are not needed by the data science practitioner regularly. Yet, it is worthwhile to have heard about them as they form the basis of all of arithmetic in computers.\n", "\n", - "The first operator is the **bitwise AND** operator `&`: It looks at the bits of its two operands, `11` and `13` in the example, in a pairwise fashion and *iff* both operands have a $1$ in the same position, will the resulting integer have a $1$ in this position as well. The binary representations of `11` and `13` have $1$s in their respective first and fourth bits, which is why `bin(11 & 13)` evaluates to `\"Ob1001\"`." + "The first operator is the **bitwise AND** operator `&`: It looks at the bits of its two operands, `11` and `13` in the example, in a pairwise fashion and if *both* operands have a $1$ in the *same* position, the resulting integer will have a $1$ in this position as well. Otherwise, the resulting integer will have a $0$ in this position. The binary representations of `11` and `13` both have $1$s in their respective first and fourth bits, which is why `bin(11 & 13)` evaluates to `Ob_1001` or `9`." ] }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 52, "metadata": { "slideshow": { "slide_type": "slide" @@ -1491,24 +1797,48 @@ { "data": { "text/plain": [ - "'0b1011 & 0b1101'" + "9" ] }, - "execution_count": 47, + "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(11) + \" & \" + bin(13) # to show the operands' binary representations" + "11 & 13" ] }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 53, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b1011 & 0b1101'" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(11) + \" & \" + bin(13) # to show the operands' bits" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": { + "slideshow": { + "slide_type": "fragment" } }, "outputs": [ @@ -1518,7 +1848,7 @@ "'0b1001'" ] }, - "execution_count": 48, + "execution_count": 54, "metadata": {}, "output_type": "execute_result" } @@ -1535,12 +1865,12 @@ } }, "source": [ - "`0b1001` is the binary representation of `9`." + "`0b_1001` is the binary representation of `9`." ] }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 55, "metadata": { "slideshow": { "slide_type": "fragment" @@ -1553,37 +1883,13 @@ "9" ] }, - "execution_count": 49, + "execution_count": 55, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "0b1001" - ] - }, - { - "cell_type": "code", - "execution_count": 50, - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "9" - ] - }, - "execution_count": 50, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "11 & 13" + "0b_1001" ] }, { @@ -1594,12 +1900,12 @@ } }, "source": [ - "The **bitwise OR** operator `|` evaluates to an `int` object whose bits are set to $1$ if the corresponding bits of either *one* or *both* operands are $1$. So in the example `9 | 13` only the second bit is $0$ for both operands, which is why the expression evaluates to `\"0b1101\"`." + "The **bitwise OR** operator `|` evaluates to an `int` object whose bits are set to $1$ if the corresponding bits of either *one* or *both* operands are $1$. So in the example `9 | 13` only the second bit is $0$ for both operands, which is why the expression evaluates to `0b_1101` or `13`." ] }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 56, "metadata": { "slideshow": { "slide_type": "slide" @@ -1609,24 +1915,48 @@ { "data": { "text/plain": [ - "'0b1001 | 0b1101'" + "13" ] }, - "execution_count": 51, + "execution_count": 56, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(9) + \" | \" + bin(13) # to show the operands' binary representations" + "9 | 13" ] }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 57, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b1001 | 0b1101'" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(9) + \" | \" + bin(13) # to show the operands' bits" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": { + "slideshow": { + "slide_type": "fragment" } }, "outputs": [ @@ -1636,7 +1966,7 @@ "'0b1101'" ] }, - "execution_count": 52, + "execution_count": 58, "metadata": {}, "output_type": "execute_result" } @@ -1653,12 +1983,12 @@ } }, "source": [ - "`0b1101` evaluates to the `int` object `13`." + "`0b_1101` evaluates to an `int` object with the value `13`." ] }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 59, "metadata": { "slideshow": { "slide_type": "fragment" @@ -1671,37 +2001,13 @@ "13" ] }, - "execution_count": 53, + "execution_count": 59, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "0b1101" - ] - }, - { - "cell_type": "code", - "execution_count": 54, - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "13" - ] - }, - "execution_count": 54, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "9 | 13" + "0b_1101" ] }, { @@ -1712,12 +2018,12 @@ } }, "source": [ - "The **bitwise XOR** operator `^` is a special case of the `|` operator in that it evaluates to an `int` object whose bits are set to $1$ if the corresponding bit of *exactly one* of the two operands is $1$. Colloquially, the \"X\" stands for \"exclusive.\" The `^` operator must *not* be confused with the exponentiation operator `**`! In the example, `9 ^ 13`, only the third bit differs between the two operands, which is why it evaluates to `\"0b100\"` omitting the fourth bit." + "The **bitwise XOR** operator `^` is a special case of the `|` operator in that it evaluates to an `int` object whose bits are set to $1$ if the corresponding bit of *exactly one* of the two operands is $1$. Colloquially, the \"X\" stands for \"exclusive.\" The `^` operator must *not* be confused with the exponentiation operator `**`! In the example, `9 ^ 13`, only the third bit differs between the two operands, which is why it evaluates to `0b_100` omitting the leading $0$." ] }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 60, "metadata": { "slideshow": { "slide_type": "slide" @@ -1727,24 +2033,48 @@ { "data": { "text/plain": [ - "'0b1001 ^ 0b1101'" + "4" ] }, - "execution_count": 55, + "execution_count": 60, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(9) + \" ^ \" + bin(13) # to show the operands' binary representations" + "9 ^ 13" ] }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 61, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'0b1001 ^ 0b1101'" + ] + }, + "execution_count": 61, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(9) + \" ^ \" + bin(13) # to show the operands' bits" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": { + "slideshow": { + "slide_type": "fragment" } }, "outputs": [ @@ -1754,7 +2084,7 @@ "'0b100'" ] }, - "execution_count": 56, + "execution_count": 62, "metadata": {}, "output_type": "execute_result" } @@ -1771,12 +2101,12 @@ } }, "source": [ - "`0b100` evaluates to the `int` object `4`." + "`0b_100` evaluates to an `int` object with the value `4`." ] }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 63, "metadata": { "slideshow": { "slide_type": "fragment" @@ -1789,37 +2119,13 @@ "4" ] }, - "execution_count": 57, + "execution_count": 63, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "0b100" - ] - }, - { - "cell_type": "code", - "execution_count": 58, - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "4" - ] - }, - "execution_count": 58, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "9 ^ 13" + "0b_100" ] }, { @@ -1830,14 +2136,14 @@ } }, "source": [ - "The **bitwise NOT** operator `~`, sometimes also called **inversion** operator, is said to \"flip\" the $0$s into $1$s and the $1$s into $0$s. However, it is based on the aforementioned [Two's Complement](https://en.wikipedia.org/wiki/Two%27s_complement) convention and `~x = -(x + 1)` by definition (cf., the [reference](https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations)). The full logic behind this is considered out of scope in this book.\n", + "The **bitwise NOT** operator `~`, sometimes also called **inversion** operator, is said to \"flip\" the $0$s into $1$s and the $1$s into $0$s. However, it is based on the aforementioned [Two's Complement](https://en.wikipedia.org/wiki/Two%27s_complement) convention and `~x = -(x + 1)` by definition (cf., the [reference](https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations)). The full logic behind this, while actually quite simple, is considered out of scope in this book.\n", "\n", - "We can at least verify the definition by comparing the binary representations of `8` and `-9`: They are indeed the same." + "We can at least verify the definition by comparing the binary representations of `7` and `-8`: They are indeed the same." ] }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 64, "metadata": { "slideshow": { "slide_type": "slide" @@ -1847,40 +2153,88 @@ { "data": { "text/plain": [ - "'-0b1001'" + "-8" ] }, - "execution_count": 59, + "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(~8)" + "~7" ] }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 65, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "'-0b1001'" + "True" ] }, - "execution_count": 60, + "execution_count": 65, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(-(8 + 1))" + "~7 == -(7 + 1) # = Two's Complement" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'-0b1000'" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(~7)" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'-0b1000'" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bin(-(7 + 1))" ] }, { @@ -1896,10 +2250,10 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 68, "metadata": { "slideshow": { - "slide_type": "fragment" + "slide_type": "skip" } }, "outputs": [ @@ -1909,13 +2263,13 @@ "-1" ] }, - "execution_count": 61, + "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "~8 + 8" + "~7 + 7" ] }, { @@ -1926,14 +2280,14 @@ } }, "source": [ - "Lastly, the **bitwise left and right shift** operators, `<<` and `>>`, shift all the bits either to the left or to the right. This corresponds to multiplying or dividing an integer by powers of $2$.\n", + "Lastly, the **bitwise left and right shift** operators, `<<` and `>>`, shift all the bits either to the left or to the right. This corresponds to multiplying or dividing an integer by powers of `2`.\n", "\n", "When shifting left, $0$s are filled in." ] }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 69, "metadata": { "slideshow": { "slide_type": "slide" @@ -1943,64 +2297,88 @@ { "data": { "text/plain": [ - "'0b1001'" + "28" ] }, - "execution_count": 62, + "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(9)" + "7 << 2" ] }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 70, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "'0b100100'" + "'0b111'" ] }, - "execution_count": 63, + "execution_count": 70, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(9 << 2)" + "bin(7)" ] }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 71, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "36" + "'0b11100'" ] }, - "execution_count": 64, + "execution_count": 71, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "9 << 2" + "bin(7 << 2)" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "28" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0b_1_1100" ] }, { @@ -2016,7 +2394,31 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 73, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "7 >> 1" + ] + }, + { + "cell_type": "code", + "execution_count": 74, "metadata": { "slideshow": { "slide_type": "fragment" @@ -2026,40 +2428,64 @@ { "data": { "text/plain": [ - "'0b10'" + "'0b111'" ] }, - "execution_count": 65, + "execution_count": 74, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bin(9 >> 2)" + "bin(7)" ] }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 75, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "2" + "'0b11'" ] }, - "execution_count": 66, + "execution_count": 75, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "9 >> 2" + "bin(7 >> 1)" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 76, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0b_11" ] }, { @@ -2092,7 +2518,7 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 77, "metadata": { "slideshow": { "slide_type": "slide" @@ -2100,12 +2526,12 @@ }, "outputs": [], "source": [ - "f = 1.23" + "b = 42.0" ] }, { "cell_type": "code", - "execution_count": 68, + "execution_count": 78, "metadata": { "slideshow": { "slide_type": "fragment" @@ -2115,24 +2541,24 @@ { "data": { "text/plain": [ - "140166567715664" + "139674754277776" ] }, - "execution_count": 68, + "execution_count": 78, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "id(f)" + "id(b)" ] }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 79, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -2142,37 +2568,37 @@ "float" ] }, - "execution_count": 69, + "execution_count": 79, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "type(f)" + "type(b)" ] }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 80, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "1.23" + "42.0" ] }, - "execution_count": 70, + "execution_count": 80, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "f" + "b" ] }, { @@ -2188,7 +2614,7 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 81, "metadata": { "slideshow": { "slide_type": "skip" @@ -2201,7 +2627,7 @@ "0.123456789" ] }, - "execution_count": 71, + "execution_count": 81, "metadata": {}, "output_type": "execute_result" } @@ -2223,7 +2649,7 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 82, "metadata": { "slideshow": { "slide_type": "slide" @@ -2233,45 +2659,80 @@ { "data": { "text/plain": [ - "1.0" + "42.0" ] }, - "execution_count": 72, + "execution_count": 82, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "1. # 1 without a dot creates an int object" + "42." ] }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 83, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "1.0" + "42.0" ] }, - "execution_count": 73, + "execution_count": 83, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "float(1)" + "float(42)" ] }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 84, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "42.0" + ] + }, + "execution_count": 84, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "float(\"42\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "Leading and trailing whitespace is ignored ..." + ] + }, + { + "cell_type": "code", + "execution_count": 85, "metadata": { "slideshow": { "slide_type": "skip" @@ -2281,16 +2742,52 @@ { "data": { "text/plain": [ - "1.0" + "42.87" ] }, - "execution_count": 74, + "execution_count": 85, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "float(\"1.000\")" + "float(\" 42.87 \")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "... but not whitespace in between." + ] + }, + { + "cell_type": "code", + "execution_count": 86, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [ + { + "ename": "ValueError", + "evalue": "could not convert string to float: '42. 87'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfloat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"42. 87\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mValueError\u001b[0m: could not convert string to float: '42. 87'" + ] + } + ], + "source": [ + "float(\"42. 87\")" ] }, { @@ -2306,7 +2803,7 @@ }, { "cell_type": "code", - "execution_count": 75, + "execution_count": 87, "metadata": { "slideshow": { "slide_type": "slide" @@ -2319,7 +2816,7 @@ "0.3333333333333333" ] }, - "execution_count": 75, + "execution_count": 87, "metadata": {}, "output_type": "execute_result" } @@ -2341,7 +2838,7 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 88, "metadata": { "slideshow": { "slide_type": "fragment" @@ -2354,7 +2851,7 @@ "42.0" ] }, - "execution_count": 76, + "execution_count": 88, "metadata": {}, "output_type": "execute_result" } @@ -2365,10 +2862,10 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 89, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -2378,7 +2875,7 @@ "42.0" ] }, - "execution_count": 77, + "execution_count": 89, "metadata": {}, "output_type": "execute_result" } @@ -2411,7 +2908,7 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 90, "metadata": { "slideshow": { "slide_type": "slide" @@ -2424,7 +2921,7 @@ "1.23" ] }, - "execution_count": 78, + "execution_count": 90, "metadata": {}, "output_type": "execute_result" } @@ -2446,7 +2943,7 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": 91, "metadata": { "slideshow": { "slide_type": "skip" @@ -2455,10 +2952,10 @@ "outputs": [ { "ename": "SyntaxError", - "evalue": "invalid syntax (, line 1)", + "evalue": "invalid syntax (, line 1)", "output_type": "error", "traceback": [ - "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 1.23 e0\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 1.23 e0\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" ] } ], @@ -2468,7 +2965,7 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": 92, "metadata": { "slideshow": { "slide_type": "skip" @@ -2477,10 +2974,10 @@ "outputs": [ { "ename": "SyntaxError", - "evalue": "invalid syntax (, line 1)", + "evalue": "invalid syntax (, line 1)", "output_type": "error", "traceback": [ - "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 1.23e 0\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 1.23e 0\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" ] } ], @@ -2490,7 +2987,7 @@ }, { "cell_type": "code", - "execution_count": 81, + "execution_count": 93, "metadata": { "slideshow": { "slide_type": "skip" @@ -2499,10 +2996,10 @@ "outputs": [ { "ename": "SyntaxError", - "evalue": "invalid syntax (, line 1)", + "evalue": "invalid syntax (, line 1)", "output_type": "error", "traceback": [ - "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 1.23e0.0\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 1.23e0.0\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" ] } ], @@ -2518,32 +3015,32 @@ } }, "source": [ - "If we leave out the number to the left, Python raises a `NameError` as it unsuccessfully tries to look up a variable named `e1`." + "If we leave out the number to the left, Python raises a `NameError` as it unsuccessfully tries to look up a variable named `e0`." ] }, { "cell_type": "code", - "execution_count": 82, + "execution_count": 94, "metadata": { "slideshow": { - "slide_type": "fragment" + "slide_type": "skip" } }, "outputs": [ { "ename": "NameError", - "evalue": "name 'e1' is not defined", + "evalue": "name 'e0' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0me1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mNameError\u001b[0m: name 'e1' is not defined" + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0me0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;31mNameError\u001b[0m: name 'e0' is not defined" ] } ], "source": [ - "e1" + "e0" ] }, { @@ -2554,12 +3051,12 @@ } }, "source": [ - "So, to write $10^1$ in Python, we need to think of it as $1*10^1$ and write `1e1`." + "So, to write $10^0$ in Python, we need to think of it as $1*10^0$ and write `1e0`." ] }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 95, "metadata": { "slideshow": { "slide_type": "fragment" @@ -2569,16 +3066,86 @@ { "data": { "text/plain": [ - "10.0" + "1.0" ] }, - "execution_count": 83, + "execution_count": 95, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "1e1" + "1e0" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "To express thousands of something (i.e., $10^3$), we write `1e3`." + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "1000.0" + ] + }, + "execution_count": 96, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1e3 # = thousands" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "Similarly, to express, for example, milliseconds (i.e., $10^{-3} s$), we write `1e-3`." + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0.001" + ] + }, + "execution_count": 97, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1e-3 # = milli" ] }, { @@ -2605,7 +3172,7 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 98, "metadata": { "slideshow": { "slide_type": "slide" @@ -2618,18 +3185,18 @@ "nan" ] }, - "execution_count": 84, + "execution_count": 98, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "float(\"nan\") # also works as float(\"NaN\")" + "float(\"nan\") # also float(\"NaN\")" ] }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 99, "metadata": { "slideshow": { "slide_type": "skip" @@ -2642,21 +3209,21 @@ "inf" ] }, - "execution_count": 85, + "execution_count": 99, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "float(\"+inf\") # also works as float(\"+infinity\")" + "float(\"+inf\") # also float(\"+infinity\") or float(\"infinity\")" ] }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 100, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -2666,21 +3233,21 @@ "inf" ] }, - "execution_count": 86, + "execution_count": 100, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "float(\"inf\") # by omitting the plus sign we mean positive infinity" + "float(\"inf\") # same as float(\"+inf\")" ] }, { "cell_type": "code", - "execution_count": 87, + "execution_count": 101, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -2690,7 +3257,7 @@ "-inf" ] }, - "execution_count": 87, + "execution_count": 101, "metadata": {}, "output_type": "execute_result" } @@ -2712,7 +3279,7 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 102, "metadata": { "slideshow": { "slide_type": "slide" @@ -2725,7 +3292,7 @@ "False" ] }, - "execution_count": 88, + "execution_count": 102, "metadata": {}, "output_type": "execute_result" } @@ -2742,17 +3309,52 @@ } }, "source": [ - "On the contrary, as two values go to infinity, there is no such concept as difference and *everything* compares equal." + "Another caveat is that any arithmetic involving a `nan` object results in `nan`. In other words, the addition below **fails silently** as no error is raised. As this also happens in accordance with the [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) standard, we *need* to be aware of that and check any data we work with for any `nan` occurrences *before* doing any calculations." ] }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 103, "metadata": { "slideshow": { "slide_type": "fragment" } }, + "outputs": [ + { + "data": { + "text/plain": [ + "nan" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "42 + float(\"nan\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "On the contrary, as two values go to infinity, there is no such concept as difference and *everything* compares equal." + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, "outputs": [ { "data": { @@ -2760,7 +3362,7 @@ "True" ] }, - "execution_count": 89, + "execution_count": 104, "metadata": {}, "output_type": "execute_result" } @@ -2782,7 +3384,7 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": 105, "metadata": { "slideshow": { "slide_type": "skip" @@ -2795,7 +3397,7 @@ "inf" ] }, - "execution_count": 90, + "execution_count": 105, "metadata": {}, "output_type": "execute_result" } @@ -2806,7 +3408,7 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 106, "metadata": { "slideshow": { "slide_type": "fragment" @@ -2819,7 +3421,7 @@ "True" ] }, - "execution_count": 91, + "execution_count": 106, "metadata": {}, "output_type": "execute_result" } @@ -2841,7 +3443,7 @@ }, { "cell_type": "code", - "execution_count": 92, + "execution_count": 107, "metadata": { "slideshow": { "slide_type": "skip" @@ -2854,7 +3456,7 @@ "inf" ] }, - "execution_count": 92, + "execution_count": 107, "metadata": {}, "output_type": "execute_result" } @@ -2865,7 +3467,7 @@ }, { "cell_type": "code", - "execution_count": 93, + "execution_count": 108, "metadata": { "slideshow": { "slide_type": "skip" @@ -2878,7 +3480,7 @@ "True" ] }, - "execution_count": 93, + "execution_count": 108, "metadata": {}, "output_type": "execute_result" } @@ -2900,7 +3502,7 @@ }, { "cell_type": "code", - "execution_count": 94, + "execution_count": 109, "metadata": { "slideshow": { "slide_type": "skip" @@ -2913,7 +3515,7 @@ "inf" ] }, - "execution_count": 94, + "execution_count": 109, "metadata": {}, "output_type": "execute_result" } @@ -2924,7 +3526,7 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 110, "metadata": { "slideshow": { "slide_type": "skip" @@ -2937,7 +3539,7 @@ "True" ] }, - "execution_count": 95, + "execution_count": 110, "metadata": {}, "output_type": "execute_result" } @@ -2959,7 +3561,7 @@ }, { "cell_type": "code", - "execution_count": 96, + "execution_count": 111, "metadata": { "slideshow": { "slide_type": "skip" @@ -2972,7 +3574,7 @@ "inf" ] }, - "execution_count": 96, + "execution_count": 111, "metadata": {}, "output_type": "execute_result" } @@ -2983,7 +3585,7 @@ }, { "cell_type": "code", - "execution_count": 97, + "execution_count": 112, "metadata": { "slideshow": { "slide_type": "fragment" @@ -2996,7 +3598,7 @@ "True" ] }, - "execution_count": 97, + "execution_count": 112, "metadata": {}, "output_type": "execute_result" } @@ -3013,12 +3615,12 @@ } }, "source": [ - "As a caveat, adding infinities of different signs is an *undefined operation* in math and results in a `nan` object. So, if we (accidentally or unknowingly) do this on a real dataset, we do *not* see any error messages, and our program may continue to run with non-meaningful results! This is an example of a piece of code **failing silently**." + "As a caveat, adding infinities of different signs is an *undefined operation* in math and results in a `nan` object. So, if we (accidentally or unknowingly) do this on a real dataset, we do *not* see any error messages, and our program may continue to run with non-meaningful results! This is another example of a piece of code **failing silently**." ] }, { "cell_type": "code", - "execution_count": 98, + "execution_count": 113, "metadata": { "slideshow": { "slide_type": "slide" @@ -3031,7 +3633,7 @@ "nan" ] }, - "execution_count": 98, + "execution_count": 113, "metadata": {}, "output_type": "execute_result" } @@ -3042,10 +3644,10 @@ }, { "cell_type": "code", - "execution_count": 99, + "execution_count": 114, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3055,7 +3657,7 @@ "nan" ] }, - "execution_count": 99, + "execution_count": 114, "metadata": {}, "output_type": "execute_result" } @@ -3085,71 +3687,12 @@ "source": [ "`float` objects are *inherently* imprecise, and there is *nothing* we can do about it! In particular, arithmetic operations with two `float` objects may result in \"weird\" rounding \"errors\" that are strictly deterministic and occur in accordance with the [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) standard.\n", "\n", - "For example, let's add `1e0` to `1e15` and `1e16`, respectively. In the latter case, the `1e0` somehow gets \"lost.\"" + "For example, let's add `1` to `1e15` and `1e16`, respectively. In the latter case, the `1` somehow gets \"lost.\"" ] }, { "cell_type": "code", - "execution_count": 100, - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "1000000000000001.0" - ] - }, - "execution_count": 100, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "1e15 + 1e0" - ] - }, - { - "cell_type": "code", - "execution_count": 101, - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "1e+16" - ] - }, - "execution_count": 101, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "1e16 + 1e0" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "source": [ - "Of course, we may also add the `int` object `1` to the `float` objects in the literal `e` notation with the same outcome." - ] - }, - { - "cell_type": "code", - "execution_count": 102, + "execution_count": 115, "metadata": { "slideshow": { "slide_type": "slide" @@ -3162,7 +3705,7 @@ "1000000000000001.0" ] }, - "execution_count": 102, + "execution_count": 115, "metadata": {}, "output_type": "execute_result" } @@ -3173,10 +3716,10 @@ }, { "cell_type": "code", - "execution_count": 103, + "execution_count": 116, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3186,7 +3729,7 @@ "1e+16" ] }, - "execution_count": 103, + "execution_count": 116, "metadata": {}, "output_type": "execute_result" } @@ -3208,7 +3751,7 @@ }, { "cell_type": "code", - "execution_count": 104, + "execution_count": 117, "metadata": { "slideshow": { "slide_type": "slide" @@ -3221,10 +3764,10 @@ }, { "cell_type": "code", - "execution_count": 105, + "execution_count": 118, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3234,7 +3777,7 @@ "2.0000000000000004" ] }, - "execution_count": 105, + "execution_count": 118, "metadata": {}, "output_type": "execute_result" } @@ -3245,7 +3788,7 @@ }, { "cell_type": "code", - "execution_count": 106, + "execution_count": 119, "metadata": { "slideshow": { "slide_type": "fragment" @@ -3258,7 +3801,7 @@ "0.30000000000000004" ] }, - "execution_count": 106, + "execution_count": 119, "metadata": {}, "output_type": "execute_result" } @@ -3280,7 +3823,7 @@ }, { "cell_type": "code", - "execution_count": 107, + "execution_count": 120, "metadata": { "slideshow": { "slide_type": "fragment" @@ -3293,7 +3836,7 @@ "False" ] }, - "execution_count": 107, + "execution_count": 120, "metadata": {}, "output_type": "execute_result" } @@ -3304,10 +3847,10 @@ }, { "cell_type": "code", - "execution_count": 108, + "execution_count": 121, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3317,7 +3860,7 @@ "False" ] }, - "execution_count": 108, + "execution_count": 121, "metadata": {}, "output_type": "execute_result" } @@ -3339,7 +3882,7 @@ }, { "cell_type": "code", - "execution_count": 109, + "execution_count": 122, "metadata": { "slideshow": { "slide_type": "slide" @@ -3352,7 +3895,7 @@ }, { "cell_type": "code", - "execution_count": 110, + "execution_count": 123, "metadata": { "slideshow": { "slide_type": "fragment" @@ -3365,7 +3908,7 @@ "True" ] }, - "execution_count": 110, + "execution_count": 123, "metadata": {}, "output_type": "execute_result" } @@ -3376,10 +3919,10 @@ }, { "cell_type": "code", - "execution_count": 111, + "execution_count": 124, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3389,7 +3932,7 @@ "True" ] }, - "execution_count": 111, + "execution_count": 124, "metadata": {}, "output_type": "execute_result" } @@ -3413,7 +3956,7 @@ }, { "cell_type": "code", - "execution_count": 112, + "execution_count": 125, "metadata": { "slideshow": { "slide_type": "slide" @@ -3426,7 +3969,7 @@ "'0.10000000000000000555111512312578270211815834045410'" ] }, - "execution_count": 112, + "execution_count": 125, "metadata": {}, "output_type": "execute_result" } @@ -3437,10 +3980,10 @@ }, { "cell_type": "code", - "execution_count": 113, + "execution_count": 126, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3450,7 +3993,7 @@ "'0.20000000000000001110223024625156540423631668090820'" ] }, - "execution_count": 113, + "execution_count": 126, "metadata": {}, "output_type": "execute_result" } @@ -3461,10 +4004,10 @@ }, { "cell_type": "code", - "execution_count": 114, + "execution_count": 127, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3474,7 +4017,7 @@ "'0.29999999999999998889776975374843459576368331909180'" ] }, - "execution_count": 114, + "execution_count": 127, "metadata": {}, "output_type": "execute_result" } @@ -3485,7 +4028,7 @@ }, { "cell_type": "code", - "execution_count": 115, + "execution_count": 128, "metadata": { "slideshow": { "slide_type": "slide" @@ -3498,7 +4041,7 @@ "'0.33333333333333331482961625624739099293947219848633'" ] }, - "execution_count": 115, + "execution_count": 128, "metadata": {}, "output_type": "execute_result" } @@ -3524,7 +4067,7 @@ }, { "cell_type": "code", - "execution_count": 116, + "execution_count": 129, "metadata": { "slideshow": { "slide_type": "fragment" @@ -3537,10 +4080,10 @@ }, { "cell_type": "code", - "execution_count": 117, + "execution_count": 130, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3550,7 +4093,7 @@ "0.33333" ] }, - "execution_count": 117, + "execution_count": 130, "metadata": {}, "output_type": "execute_result" } @@ -3561,10 +4104,10 @@ }, { "cell_type": "code", - "execution_count": 118, + "execution_count": 131, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3574,7 +4117,7 @@ "'0.33333000000000001517008740847813896834850311279297'" ] }, - "execution_count": 118, + "execution_count": 131, "metadata": {}, "output_type": "execute_result" } @@ -3596,7 +4139,7 @@ }, { "cell_type": "code", - "execution_count": 119, + "execution_count": 132, "metadata": { "slideshow": { "slide_type": "slide" @@ -3609,7 +4152,7 @@ "'0.12500000000000000000000000000000000000000000000000'" ] }, - "execution_count": 119, + "execution_count": 132, "metadata": {}, "output_type": "execute_result" } @@ -3620,10 +4163,10 @@ }, { "cell_type": "code", - "execution_count": 120, + "execution_count": 133, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3633,7 +4176,7 @@ "'0.25000000000000000000000000000000000000000000000000'" ] }, - "execution_count": 120, + "execution_count": 133, "metadata": {}, "output_type": "execute_result" } @@ -3644,10 +4187,10 @@ }, { "cell_type": "code", - "execution_count": 121, + "execution_count": 134, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3657,7 +4200,7 @@ "True" ] }, - "execution_count": 121, + "execution_count": 134, "metadata": {}, "output_type": "execute_result" } @@ -3685,10 +4228,28 @@ } }, "source": [ - "To understand these subtleties, we need to look at the **[binary representation of floats](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)** and review the basics of the **[IEEE 754](https://en.wikipedia.org/wiki/IEEE_754)** standard. On modern machines, floats are modeled in so-called double precision with $64$ bits that are grouped as in the figure below. The first bit determines the sign ($0$ for plus, $1$ for minus), the next $11$ bits represent an $exponent$ term, and the last $52$ bits resemble the actual significant digits, the so-called $fraction$ part. The three groups are put together like so:\n", - "\n", - "$$float = (-1)^{sign} * 1.fraction * 2^{exponent-1023}$$\n", - "\n", + "To understand these subtleties, we need to look at the **[binary representation of floats](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)** and review the basics of the **[IEEE 754](https://en.wikipedia.org/wiki/IEEE_754)** standard. On modern machines, floats are modeled in so-called double precision with $64$ bits that are grouped as in the figure below. The first bit determines the sign ($0$ for plus, $1$ for minus), the next $11$ bits represent an $exponent$ term, and the last $52$ bits resemble the actual significant digits, the so-called $fraction$ part. The three groups are put together like so:" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "$$float = (-1)^{sign} * 1.fraction * 2^{exponent-1023}$$" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ "A $1.$ is implicitly prepended as the first digit, and both, $fraction$ and $exponent$, are stored in base $2$ representation (i.e., they both are interpreted like integers above). As $exponent$ is consequently non-negative, between $0_{10}$ and $2047_{10}$ to be precise, the $-1023$, called the exponent bias, centers the entire $2^{exponent-1023}$ term around $1$ and allows the period within the $1.fraction$ part be shifted into either direction by the same amount. Floating-point numbers received their name as the period, formally called the **[radix point](https://en.wikipedia.org/wiki/Radix_point)**, \"floats\" along the significant digits. As an aside, an $exponent$ of all $0$s or all $1$s is used to model the special values `nan` or `inf`.\n", "\n", "As the standard defines the exponent part to come as a power of $2$, we now see why `0.125` is a *precise* float: It can be represented as a power of $2$, i.e., $0.125 = (-1)^0 * 1.0 * 2^{1020-1023} = 2^{-3} = \\frac{1}{8}$. In other words, the floating-point representation of $0.125_{10}$ is $0_2$, $1111111100_2 = 1020_{10}$, and $0_2$ for the three groups, respectively." @@ -3698,7 +4259,7 @@ "cell_type": "markdown", "metadata": { "slideshow": { - "slide_type": "slide" + "slide_type": "-" } }, "source": [ @@ -3726,7 +4287,7 @@ }, { "cell_type": "code", - "execution_count": 122, + "execution_count": 135, "metadata": { "slideshow": { "slide_type": "slide" @@ -3739,10 +4300,10 @@ }, { "cell_type": "code", - "execution_count": 123, + "execution_count": 136, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3752,13 +4313,13 @@ "'0x1.0000000000000p-3'" ] }, - "execution_count": 123, + "execution_count": 136, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "one_eighth.hex() # this basically says 2 ** (-3)" + "one_eighth.hex()" ] }, { @@ -3774,10 +4335,10 @@ }, { "cell_type": "code", - "execution_count": 124, + "execution_count": 137, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3787,7 +4348,7 @@ "(1, 8)" ] }, - "execution_count": 124, + "execution_count": 137, "metadata": {}, "output_type": "execute_result" } @@ -3798,10 +4359,10 @@ }, { "cell_type": "code", - "execution_count": 125, + "execution_count": 138, "metadata": { "slideshow": { - "slide_type": "fragment" + "slide_type": "slide" } }, "outputs": [ @@ -3811,7 +4372,7 @@ "'0x1.555475a31a4bep-2'" ] }, - "execution_count": 125, + "execution_count": 138, "metadata": {}, "output_type": "execute_result" } @@ -3822,10 +4383,10 @@ }, { "cell_type": "code", - "execution_count": 126, + "execution_count": 139, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -3835,7 +4396,7 @@ "(3002369727582815, 9007199254740992)" ] }, - "execution_count": 126, + "execution_count": 139, "metadata": {}, "output_type": "execute_result" } @@ -3857,10 +4418,10 @@ }, { "cell_type": "code", - "execution_count": 127, + "execution_count": 140, "metadata": { "slideshow": { - "slide_type": "slide" + "slide_type": "skip" } }, "outputs": [], @@ -3870,10 +4431,10 @@ }, { "cell_type": "code", - "execution_count": 128, + "execution_count": 141, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "skip" } }, "outputs": [ @@ -3883,7 +4444,7 @@ "'0x0.0p+0'" ] }, - "execution_count": 128, + "execution_count": 141, "metadata": {}, "output_type": "execute_result" } @@ -3894,10 +4455,10 @@ }, { "cell_type": "code", - "execution_count": 129, + "execution_count": 142, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "skip" } }, "outputs": [ @@ -3907,7 +4468,7 @@ "(0, 1)" ] }, - "execution_count": 129, + "execution_count": 142, "metadata": {}, "output_type": "execute_result" } @@ -3929,7 +4490,7 @@ }, { "cell_type": "code", - "execution_count": 130, + "execution_count": 143, "metadata": { "slideshow": { "slide_type": "skip" @@ -3942,7 +4503,7 @@ "False" ] }, - "execution_count": 130, + "execution_count": 143, "metadata": {}, "output_type": "execute_result" } @@ -3953,7 +4514,7 @@ }, { "cell_type": "code", - "execution_count": 131, + "execution_count": 144, "metadata": { "slideshow": { "slide_type": "skip" @@ -3966,7 +4527,7 @@ "True" ] }, - "execution_count": 131, + "execution_count": 144, "metadata": {}, "output_type": "execute_result" } @@ -3990,7 +4551,7 @@ }, { "cell_type": "code", - "execution_count": 132, + "execution_count": 145, "metadata": { "slideshow": { "slide_type": "skip" @@ -4003,7 +4564,7 @@ }, { "cell_type": "code", - "execution_count": 133, + "execution_count": 146, "metadata": { "slideshow": { "slide_type": "skip" @@ -4016,7 +4577,7 @@ "sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)" ] }, - "execution_count": 133, + "execution_count": 146, "metadata": {}, "output_type": "execute_result" } @@ -4044,14 +4605,14 @@ } }, "source": [ - "The [decimal](https://docs.python.org/3/library/decimal.html) module in the [standard library](https://docs.python.org/3/library/index.html) provides a [Decimal](https://docs.python.org/3/library/decimal.html#decimal.Decimal) type that may be used to represent any real number to a user-defined level of precision: \"User-defined\" does *not* mean an infinite or \"exact\" precision! The `Decimal` type merely allows us to work with a number of bits *different* from the $64$ as specified for the `float` type and also to customize the rounding rules and some other settings.\n", + "The [decimal](https://docs.python.org/3/library/decimal.html) module in the [standard library](https://docs.python.org/3/library/index.html) provides a [Decimal](https://docs.python.org/3/library/decimal.html#decimal.Decimal) type that may be used to represent any real number to a user-defined level of precision: \"User-defined\" does *not* mean an infinite or exact precision! The `Decimal` type merely allows us to work with a number of bits *different* from the $64$ as specified for the `float` type and also to customize the rounding rules and some other settings.\n", "\n", "We import the `Decimal` type and also the [getcontext()](https://docs.python.org/3/library/decimal.html#decimal.getcontext) function from the [decimal](https://docs.python.org/3/library/decimal.html) module." ] }, { "cell_type": "code", - "execution_count": 134, + "execution_count": 147, "metadata": { "slideshow": { "slide_type": "slide" @@ -4075,7 +4636,7 @@ }, { "cell_type": "code", - "execution_count": 135, + "execution_count": 148, "metadata": { "slideshow": { "slide_type": "fragment" @@ -4088,7 +4649,7 @@ "Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])" ] }, - "execution_count": 135, + "execution_count": 148, "metadata": {}, "output_type": "execute_result" } @@ -4110,7 +4671,7 @@ }, { "cell_type": "code", - "execution_count": 136, + "execution_count": 149, "metadata": { "slideshow": { "slide_type": "slide" @@ -4123,7 +4684,7 @@ "Decimal('42')" ] }, - "execution_count": 136, + "execution_count": 149, "metadata": {}, "output_type": "execute_result" } @@ -4134,10 +4695,10 @@ }, { "cell_type": "code", - "execution_count": 137, + "execution_count": 150, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -4147,7 +4708,7 @@ "Decimal('0.1')" ] }, - "execution_count": 137, + "execution_count": 150, "metadata": {}, "output_type": "execute_result" } @@ -4158,26 +4719,26 @@ }, { "cell_type": "code", - "execution_count": 138, + "execution_count": 151, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "Decimal('1E+5')" + "Decimal('0.001')" ] }, - "execution_count": 138, + "execution_count": 151, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Decimal(\"1e5\")" + "Decimal(\"1e-3\")" ] }, { @@ -4193,7 +4754,7 @@ }, { "cell_type": "code", - "execution_count": 139, + "execution_count": 152, "metadata": { "slideshow": { "slide_type": "fragment" @@ -4206,13 +4767,13 @@ "Decimal('0.1000000000000000055511151231257827021181583404541015625')" ] }, - "execution_count": 139, + "execution_count": 152, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Decimal(0.1) # do not create a Decimal from a float" + "Decimal(0.1) # do not do this" ] }, { @@ -4228,7 +4789,7 @@ }, { "cell_type": "code", - "execution_count": 140, + "execution_count": 153, "metadata": { "slideshow": { "slide_type": "slide" @@ -4241,7 +4802,7 @@ "Decimal('0.3')" ] }, - "execution_count": 140, + "execution_count": 153, "metadata": {}, "output_type": "execute_result" } @@ -4252,10 +4813,10 @@ }, { "cell_type": "code", - "execution_count": 141, + "execution_count": 154, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -4265,7 +4826,7 @@ "True" ] }, - "execution_count": 141, + "execution_count": 154, "metadata": {}, "output_type": "execute_result" } @@ -4287,7 +4848,7 @@ }, { "cell_type": "code", - "execution_count": 142, + "execution_count": 155, "metadata": { "slideshow": { "slide_type": "fragment" @@ -4300,7 +4861,7 @@ "Decimal('0.30000')" ] }, - "execution_count": 142, + "execution_count": 155, "metadata": {}, "output_type": "execute_result" } @@ -4311,10 +4872,10 @@ }, { "cell_type": "code", - "execution_count": 143, + "execution_count": 156, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "skip" } }, "outputs": [ @@ -4324,7 +4885,7 @@ "True" ] }, - "execution_count": 143, + "execution_count": 156, "metadata": {}, "output_type": "execute_result" } @@ -4346,7 +4907,7 @@ }, { "cell_type": "code", - "execution_count": 144, + "execution_count": 157, "metadata": { "slideshow": { "slide_type": "slide" @@ -4359,42 +4920,42 @@ "Decimal('42')" ] }, - "execution_count": 144, + "execution_count": 157, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "42 + Decimal(42) - 42" + "21 + Decimal(21)" ] }, { "cell_type": "code", - "execution_count": 145, + "execution_count": 158, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "Decimal('42')" + "Decimal('42.0')" ] }, - "execution_count": 145, + "execution_count": 158, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "10 * Decimal(42) / 10" + "10 * Decimal(\"4.2\")" ] }, { "cell_type": "code", - "execution_count": 146, + "execution_count": 159, "metadata": { "slideshow": { "slide_type": "slide" @@ -4407,7 +4968,7 @@ "Decimal('0.1')" ] }, - "execution_count": 146, + "execution_count": 159, "metadata": {}, "output_type": "execute_result" } @@ -4429,7 +4990,7 @@ }, { "cell_type": "code", - "execution_count": 147, + "execution_count": 160, "metadata": { "slideshow": { "slide_type": "fragment" @@ -4442,7 +5003,7 @@ "'0.10000000000000000000000000000000000000000000000000'" ] }, - "execution_count": 147, + "execution_count": 160, "metadata": {}, "output_type": "execute_result" } @@ -4453,10 +5014,10 @@ }, { "cell_type": "code", - "execution_count": 148, + "execution_count": 161, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -4466,7 +5027,7 @@ "'0.10000000000000000555111512312578270211815834045410'" ] }, - "execution_count": 148, + "execution_count": 161, "metadata": {}, "output_type": "execute_result" } @@ -4488,7 +5049,7 @@ }, { "cell_type": "code", - "execution_count": 149, + "execution_count": 162, "metadata": { "slideshow": { "slide_type": "slide" @@ -4502,7 +5063,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m1.0\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m42\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m1.0\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m42\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for *: 'float' and 'decimal.Decimal'" ] } @@ -4519,15 +5080,15 @@ } }, "source": [ - "To preserve the precision for more advanced mathematical functions, `Decimal` objects come with many **methods bound** on them. For example, [ln()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.ln) and [log10()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.log10) take the logarithm while [sqrt()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.sqrt) calculates the square root. In general, the functions in the [math](https://docs.python.org/3/library/math.html) module in the [standard library](https://docs.python.org/3/library/index.html) should only be used with `float` objects as they do *not* preserve precision." + "To preserve the precision for more advanced mathematical functions, `Decimal` objects come with many **methods bound** on them. For example, [ln()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.ln) and [log10()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.log10) take the logarithm while [sqrt()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.sqrt) calculates the square root. The methods always return a *new* `Decimal` object. We must never use the functions in the [math](https://docs.python.org/3/library/math.html) module in the [standard library](https://docs.python.org/3/library/index.html) with `Decimal` objects as they do *not* preserve precision." ] }, { "cell_type": "code", - "execution_count": 150, + "execution_count": 163, "metadata": { "slideshow": { - "slide_type": "slide" + "slide_type": "skip" } }, "outputs": [ @@ -4537,7 +5098,7 @@ "Decimal('2')" ] }, - "execution_count": 150, + "execution_count": 163, "metadata": {}, "output_type": "execute_result" } @@ -4548,10 +5109,10 @@ }, { "cell_type": "code", - "execution_count": 151, + "execution_count": 164, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "slide" } }, "outputs": [ @@ -4561,7 +5122,7 @@ "Decimal('1.414213562373095048801688724')" ] }, - "execution_count": 151, + "execution_count": 164, "metadata": {}, "output_type": "execute_result" } @@ -4585,7 +5146,7 @@ }, { "cell_type": "code", - "execution_count": 152, + "execution_count": 165, "metadata": { "slideshow": { "slide_type": "fragment" @@ -4598,7 +5159,7 @@ "Decimal('1.999999999999999999999999999')" ] }, - "execution_count": 152, + "execution_count": 165, "metadata": {}, "output_type": "execute_result" } @@ -4617,17 +5178,17 @@ } }, "source": [ - "The [quantize()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.quantize) method allows us to [quantize](https://www.dictionary.com/browse/quantize) (i.e., \"round\") a `Decimal` number at any precision that is *smaller* than the set precision. It looks at the number of decimals (i.e., to the right of the period) of the numeric argument we pass in.\n", + "However, the [quantize()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.quantize) method allows us to [quantize](https://www.dictionary.com/browse/quantize) (i.e., \"round\") a `Decimal` number at any precision that is *smaller* than the set precision. It takes the number of decimals to the right of the period of the `Decimal` argument we pass in and rounds accordingly.\n", "\n", - "For example, as the overall imprecise value of `two` still has an internal precision of `28` digits, we can correctly round it to *four* decimals (i.e., `Decimal(\"0.0001\")` has four decimals)." + "For example, as the overall imprecise value of `two` still has an internal precision of `28` digits, we can correctly round it to *four* decimals (i.e., `Decimal(\"0.0000\")` has four decimals)." ] }, { "cell_type": "code", - "execution_count": 153, + "execution_count": 166, "metadata": { "slideshow": { - "slide_type": "fragment" + "slide_type": "slide" } }, "outputs": [ @@ -4637,26 +5198,34 @@ "Decimal('2.0000')" ] }, - "execution_count": 153, + "execution_count": 166, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "two.quantize(Decimal(\"0.0001\"))" + "two.quantize(Decimal(\"0.0000\"))" ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, "source": [ "We can never round a `Decimal` number and obtain a greater precision than before: The `InvalidOperation` exception tells us that *loudly*." ] }, { "cell_type": "code", - "execution_count": 154, - "metadata": {}, + "execution_count": 167, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, "outputs": [ { "ename": "InvalidOperation", @@ -4665,13 +5234,13 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mInvalidOperation\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtwo\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mquantize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"0.1\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m**\u001b[0m \u001b[0;36m28\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtwo\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mquantize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"1e-28\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mInvalidOperation\u001b[0m: []" ] } ], "source": [ - "two.quantize(Decimal(\"0.1\") ** 28)" + "two.quantize(Decimal(\"1e-28\"))" ] }, { @@ -4687,7 +5256,7 @@ }, { "cell_type": "code", - "execution_count": 155, + "execution_count": 168, "metadata": { "slideshow": { "slide_type": "skip" @@ -4700,13 +5269,13 @@ "True" ] }, - "execution_count": 155, + "execution_count": 168, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "two.quantize(Decimal(\"0.0001\")) == 2" + "two.quantize(Decimal(\"0.0000\")) == 2" ] }, { @@ -4722,10 +5291,10 @@ }, { "cell_type": "code", - "execution_count": 156, + "execution_count": 169, "metadata": { "slideshow": { - "slide_type": "fragment" + "slide_type": "skip" } }, "outputs": [ @@ -4735,13 +5304,13 @@ "True" ] }, - "execution_count": 156, + "execution_count": 169, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "(Decimal(2).sqrt() ** 2).quantize(Decimal(\"0.0001\")) == 2" + "(Decimal(2).sqrt() ** 2).quantize(Decimal(\"0.0000\")) == 2" ] }, { @@ -4757,7 +5326,7 @@ }, { "cell_type": "code", - "execution_count": 157, + "execution_count": 170, "metadata": { "slideshow": { "slide_type": "skip" @@ -4770,7 +5339,7 @@ "Decimal('NaN')" ] }, - "execution_count": 157, + "execution_count": 170, "metadata": {}, "output_type": "execute_result" } @@ -4779,9 +5348,20 @@ "Decimal(\"nan\")" ] }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "`Decimal(\"nan\")`s never compare equal to anything, not even to themselves." + ] + }, { "cell_type": "code", - "execution_count": 158, + "execution_count": 171, "metadata": { "slideshow": { "slide_type": "skip" @@ -4794,18 +5374,29 @@ "False" ] }, - "execution_count": 158, + "execution_count": 171, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Decimal(\"nan\") == Decimal(\"nan\") # nan's never compare equal to anything, not even to themselves" + "Decimal(\"nan\") == Decimal(\"nan\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "Infinity is larger than any concrete number." ] }, { "cell_type": "code", - "execution_count": 159, + "execution_count": 172, "metadata": { "slideshow": { "slide_type": "skip" @@ -4818,7 +5409,7 @@ "Decimal('Infinity')" ] }, - "execution_count": 159, + "execution_count": 172, "metadata": {}, "output_type": "execute_result" } @@ -4829,7 +5420,7 @@ }, { "cell_type": "code", - "execution_count": 160, + "execution_count": 173, "metadata": { "slideshow": { "slide_type": "skip" @@ -4842,7 +5433,7 @@ "Decimal('-Infinity')" ] }, - "execution_count": 160, + "execution_count": 173, "metadata": {}, "output_type": "execute_result" } @@ -4853,7 +5444,7 @@ }, { "cell_type": "code", - "execution_count": 161, + "execution_count": 174, "metadata": { "slideshow": { "slide_type": "skip" @@ -4866,18 +5457,18 @@ "Decimal('Infinity')" ] }, - "execution_count": 161, + "execution_count": 174, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Decimal(\"inf\") + 42 # Infinity is infinity, concrete numbers loose its meaning" + "Decimal(\"inf\") + 42" ] }, { "cell_type": "code", - "execution_count": 162, + "execution_count": 175, "metadata": { "slideshow": { "slide_type": "skip" @@ -4890,7 +5481,7 @@ "True" ] }, - "execution_count": 162, + "execution_count": 175, "metadata": {}, "output_type": "execute_result" } @@ -4907,12 +5498,12 @@ } }, "source": [ - "As with `float` objects, we cannot add infinities of different signs: Now get a module-specific `InvalidOperation` exception instead of a `nan` value. Here, **failing loudly** is a good thing as it prevents us from working with invalid results." + "As with `float` objects, we cannot add infinities of different signs: Now, get a module-specific `InvalidOperation` exception instead of a `nan` value. Here, **failing loudly** is a good thing as it prevents us from working with invalid results." ] }, { "cell_type": "code", - "execution_count": 163, + "execution_count": 176, "metadata": { "slideshow": { "slide_type": "skip" @@ -4926,7 +5517,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mInvalidOperation\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"inf\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"-inf\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"inf\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"-inf\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mInvalidOperation\u001b[0m: []" ] } @@ -4937,7 +5528,7 @@ }, { "cell_type": "code", - "execution_count": 164, + "execution_count": 177, "metadata": { "slideshow": { "slide_type": "skip" @@ -4951,7 +5542,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mInvalidOperation\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"inf\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"inf\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"inf\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"inf\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mInvalidOperation\u001b[0m: []" ] } @@ -4997,7 +5588,7 @@ }, { "cell_type": "code", - "execution_count": 165, + "execution_count": 178, "metadata": { "slideshow": { "slide_type": "slide" @@ -5021,7 +5612,7 @@ }, { "cell_type": "code", - "execution_count": 166, + "execution_count": 179, "metadata": { "slideshow": { "slide_type": "fragment" @@ -5034,21 +5625,21 @@ "Fraction(1, 3)" ] }, - "execution_count": 166, + "execution_count": 179, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Fraction(1, 3) # this is now 1/3 with \"full\" precision" + "Fraction(1, 3) # 1/3 with \"full\" precision" ] }, { "cell_type": "code", - "execution_count": 167, + "execution_count": 180, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5058,21 +5649,21 @@ "Fraction(1, 3)" ] }, - "execution_count": 167, + "execution_count": 180, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Fraction(\"1/3\") # this is 1/3 with \"full\" precision again" + "Fraction(\"1/3\") # 1/3 with \"full\" precision" ] }, { "cell_type": "code", - "execution_count": 168, + "execution_count": 181, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5082,21 +5673,21 @@ "Fraction(3333333333, 10000000000)" ] }, - "execution_count": 168, + "execution_count": 181, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Fraction(\"0.3333333333\") # this is 1/3 with a precision of 10 significant digits" + "Fraction(\"0.3333333333\") # 1/3 with a precision of 10 significant digits" ] }, { "cell_type": "code", - "execution_count": 169, + "execution_count": 182, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "skip" } }, "outputs": [ @@ -5106,13 +5697,13 @@ "Fraction(3333333333, 10000000000)" ] }, - "execution_count": 169, + "execution_count": 182, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Fraction(\"3333333333e-10\") # the same in scientific notation" + "Fraction(\"3333333333e-10\") # scientific notation is also allowed" ] }, { @@ -5128,7 +5719,7 @@ }, { "cell_type": "code", - "execution_count": 170, + "execution_count": 183, "metadata": { "slideshow": { "slide_type": "slide" @@ -5141,7 +5732,7 @@ "Fraction(3, 2)" ] }, - "execution_count": 170, + "execution_count": 183, "metadata": {}, "output_type": "execute_result" } @@ -5152,10 +5743,10 @@ }, { "cell_type": "code", - "execution_count": 171, + "execution_count": 184, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5165,7 +5756,7 @@ "Fraction(3, 2)" ] }, - "execution_count": 171, + "execution_count": 184, "metadata": {}, "output_type": "execute_result" } @@ -5187,7 +5778,7 @@ }, { "cell_type": "code", - "execution_count": 172, + "execution_count": 185, "metadata": { "slideshow": { "slide_type": "slide" @@ -5200,7 +5791,7 @@ "Fraction(1, 10)" ] }, - "execution_count": 172, + "execution_count": 185, "metadata": {}, "output_type": "execute_result" } @@ -5222,10 +5813,10 @@ }, { "cell_type": "code", - "execution_count": 173, + "execution_count": 186, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5235,7 +5826,7 @@ "Fraction(3602879701896397, 36028797018963968)" ] }, - "execution_count": 173, + "execution_count": 186, "metadata": {}, "output_type": "execute_result" } @@ -5257,7 +5848,7 @@ }, { "cell_type": "code", - "execution_count": 174, + "execution_count": 187, "metadata": { "slideshow": { "slide_type": "slide" @@ -5270,7 +5861,7 @@ "Fraction(7, 4)" ] }, - "execution_count": 174, + "execution_count": 187, "metadata": {}, "output_type": "execute_result" } @@ -5281,10 +5872,10 @@ }, { "cell_type": "code", - "execution_count": 175, + "execution_count": 188, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5294,7 +5885,7 @@ "Fraction(1, 2)" ] }, - "execution_count": 175, + "execution_count": 188, "metadata": {}, "output_type": "execute_result" } @@ -5305,10 +5896,10 @@ }, { "cell_type": "code", - "execution_count": 176, + "execution_count": 189, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5318,7 +5909,7 @@ "Fraction(1, 1)" ] }, - "execution_count": 176, + "execution_count": 189, "metadata": {}, "output_type": "execute_result" } @@ -5329,10 +5920,10 @@ }, { "cell_type": "code", - "execution_count": 177, + "execution_count": 190, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5342,7 +5933,7 @@ "Fraction(1, 1)" ] }, - "execution_count": 177, + "execution_count": 190, "metadata": {}, "output_type": "execute_result" } @@ -5364,7 +5955,7 @@ }, { "cell_type": "code", - "execution_count": 178, + "execution_count": 191, "metadata": { "slideshow": { "slide_type": "slide" @@ -5377,18 +5968,18 @@ "0.1" ] }, - "execution_count": 178, + "execution_count": 191, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "10.0 * Fraction(1, 100)" + "10.0 * Fraction(1, 100) # do not do this" ] }, { "cell_type": "code", - "execution_count": 179, + "execution_count": 192, "metadata": { "slideshow": { "slide_type": "fragment" @@ -5401,7 +5992,7 @@ "'0.10000000000000000555111512312578270211815834045410'" ] }, - "execution_count": 179, + "execution_count": 192, "metadata": {}, "output_type": "execute_result" } @@ -5432,6 +6023,17 @@ "## The `complex` Type" ] }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "#### What is the solution to $x^2 = -1$ ?" + ] + }, { "cell_type": "markdown", "metadata": { @@ -5453,7 +6055,7 @@ "cell_type": "markdown", "metadata": { "slideshow": { - "slide_type": "slide" + "slide_type": "-" } }, "source": [ @@ -5475,7 +6077,7 @@ }, { "cell_type": "code", - "execution_count": 180, + "execution_count": 193, "metadata": { "slideshow": { "slide_type": "slide" @@ -5488,7 +6090,7 @@ }, { "cell_type": "code", - "execution_count": 181, + "execution_count": 194, "metadata": { "slideshow": { "slide_type": "fragment" @@ -5498,10 +6100,10 @@ { "data": { "text/plain": [ - "140166567772848" + "139674754426928" ] }, - "execution_count": 181, + "execution_count": 194, "metadata": {}, "output_type": "execute_result" } @@ -5512,10 +6114,10 @@ }, { "cell_type": "code", - "execution_count": 182, + "execution_count": 195, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5525,7 +6127,7 @@ "complex" ] }, - "execution_count": 182, + "execution_count": 195, "metadata": {}, "output_type": "execute_result" } @@ -5536,10 +6138,10 @@ }, { "cell_type": "code", - "execution_count": 183, + "execution_count": 196, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5549,7 +6151,7 @@ "1j" ] }, - "execution_count": 183, + "execution_count": 196, "metadata": {}, "output_type": "execute_result" } @@ -5571,7 +6173,7 @@ }, { "cell_type": "code", - "execution_count": 184, + "execution_count": 197, "metadata": { "slideshow": { "slide_type": "slide" @@ -5584,7 +6186,7 @@ "True" ] }, - "execution_count": 184, + "execution_count": 197, "metadata": {}, "output_type": "execute_result" } @@ -5606,7 +6208,7 @@ }, { "cell_type": "code", - "execution_count": 185, + "execution_count": 198, "metadata": { "slideshow": { "slide_type": "slide" @@ -5619,7 +6221,7 @@ "(2+0.5j)" ] }, - "execution_count": 185, + "execution_count": 198, "metadata": {}, "output_type": "execute_result" } @@ -5641,10 +6243,10 @@ }, { "cell_type": "code", - "execution_count": 186, + "execution_count": 199, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5654,21 +6256,32 @@ "(2+0.5j)" ] }, - "execution_count": 186, + "execution_count": 199, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "complex(2, 0.5) # an integer and a float work just fine as arguments" + "complex(2, 0.5)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "By omitting the second argument, we set the imaginary part to $0$." ] }, { "cell_type": "code", - "execution_count": 187, + "execution_count": 200, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "skip" } }, "outputs": [ @@ -5678,18 +6291,29 @@ "(2+0j)" ] }, - "execution_count": 187, + "execution_count": 200, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "complex(2) # omitting the second argument sets the imaginary part to 0" + "complex(2) " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + " The arguments to [complex()](https://docs.python.org/3/library/functions.html#complex) may be any numeric type." ] }, { "cell_type": "code", - "execution_count": 188, + "execution_count": 201, "metadata": { "slideshow": { "slide_type": "skip" @@ -5702,18 +6326,18 @@ "(2+0.5j)" ] }, - "execution_count": 188, + "execution_count": 201, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "complex(Decimal(\"2.0\"), Fraction(1, 2)) # the arguments may be any numeric type" + "complex(Decimal(\"2.0\"), Fraction(1, 2))" ] }, { "cell_type": "code", - "execution_count": 189, + "execution_count": 202, "metadata": { "slideshow": { "slide_type": "skip" @@ -5726,7 +6350,7 @@ "(2+0.5j)" ] }, - "execution_count": 189, + "execution_count": 202, "metadata": {}, "output_type": "execute_result" } @@ -5748,7 +6372,7 @@ }, { "cell_type": "code", - "execution_count": 190, + "execution_count": 203, "metadata": { "slideshow": { "slide_type": "slide" @@ -5762,7 +6386,7 @@ }, { "cell_type": "code", - "execution_count": 191, + "execution_count": 204, "metadata": { "slideshow": { "slide_type": "fragment" @@ -5775,7 +6399,7 @@ "(4+6j)" ] }, - "execution_count": 191, + "execution_count": 204, "metadata": {}, "output_type": "execute_result" } @@ -5786,10 +6410,10 @@ }, { "cell_type": "code", - "execution_count": 192, + "execution_count": 205, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5799,7 +6423,7 @@ "(-2-2j)" ] }, - "execution_count": 192, + "execution_count": 205, "metadata": {}, "output_type": "execute_result" } @@ -5810,7 +6434,7 @@ }, { "cell_type": "code", - "execution_count": 193, + "execution_count": 206, "metadata": { "slideshow": { "slide_type": "skip" @@ -5820,21 +6444,21 @@ { "data": { "text/plain": [ - "(40+2j)" + "(2+2j)" ] }, - "execution_count": 193, + "execution_count": 206, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "c1 + 39" + "c1 + 1" ] }, { "cell_type": "code", - "execution_count": 194, + "execution_count": 207, "metadata": { "slideshow": { "slide_type": "skip" @@ -5844,21 +6468,21 @@ { "data": { "text/plain": [ - "-4j" + "(0.5-4j)" ] }, - "execution_count": 194, + "execution_count": 207, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "3.0 - c2" + "3.5 - c2" ] }, { "cell_type": "code", - "execution_count": 195, + "execution_count": 208, "metadata": { "slideshow": { "slide_type": "skip" @@ -5871,7 +6495,7 @@ "(5+10j)" ] }, - "execution_count": 195, + "execution_count": 208, "metadata": {}, "output_type": "execute_result" } @@ -5882,7 +6506,7 @@ }, { "cell_type": "code", - "execution_count": 196, + "execution_count": 209, "metadata": { "slideshow": { "slide_type": "skip" @@ -5895,7 +6519,7 @@ "(0.5+0.6666666666666666j)" ] }, - "execution_count": 196, + "execution_count": 209, "metadata": {}, "output_type": "execute_result" } @@ -5906,7 +6530,7 @@ }, { "cell_type": "code", - "execution_count": 197, + "execution_count": 210, "metadata": { "slideshow": { "slide_type": "fragment" @@ -5919,7 +6543,7 @@ "(-5+10j)" ] }, - "execution_count": 197, + "execution_count": 210, "metadata": {}, "output_type": "execute_result" } @@ -5930,10 +6554,10 @@ }, { "cell_type": "code", - "execution_count": 198, + "execution_count": 211, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -5943,7 +6567,7 @@ "(0.44+0.08j)" ] }, - "execution_count": 198, + "execution_count": 211, "metadata": {}, "output_type": "execute_result" } @@ -5965,7 +6589,7 @@ }, { "cell_type": "code", - "execution_count": 199, + "execution_count": 212, "metadata": { "slideshow": { "slide_type": "slide" @@ -5978,7 +6602,7 @@ "5.0" ] }, - "execution_count": 199, + "execution_count": 212, "metadata": {}, "output_type": "execute_result" } @@ -6000,7 +6624,7 @@ }, { "cell_type": "code", - "execution_count": 200, + "execution_count": 213, "metadata": { "slideshow": { "slide_type": "fragment" @@ -6013,7 +6637,7 @@ "1.0" ] }, - "execution_count": 200, + "execution_count": 213, "metadata": {}, "output_type": "execute_result" } @@ -6024,10 +6648,10 @@ }, { "cell_type": "code", - "execution_count": 201, + "execution_count": 214, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -6037,7 +6661,7 @@ "2.0" ] }, - "execution_count": 201, + "execution_count": 214, "metadata": {}, "output_type": "execute_result" } @@ -6059,7 +6683,7 @@ }, { "cell_type": "code", - "execution_count": 202, + "execution_count": 215, "metadata": { "slideshow": { "slide_type": "fragment" @@ -6072,7 +6696,7 @@ "(1-2j)" ] }, - "execution_count": 202, + "execution_count": 215, "metadata": {}, "output_type": "execute_result" } @@ -6160,7 +6784,7 @@ }, { "cell_type": "code", - "execution_count": 203, + "execution_count": 216, "metadata": { "slideshow": { "slide_type": "slide" @@ -6173,10 +6797,10 @@ }, { "cell_type": "code", - "execution_count": 204, + "execution_count": 217, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "slide" } }, "outputs": [ @@ -6201,7 +6825,7 @@ " 'abstractmethod']" ] }, - "execution_count": 204, + "execution_count": 217, "metadata": {}, "output_type": "execute_result" } @@ -6227,7 +6851,7 @@ }, { "cell_type": "code", - "execution_count": 205, + "execution_count": 218, "metadata": { "scrolled": true, "slideshow": { @@ -6338,7 +6962,7 @@ }, { "cell_type": "code", - "execution_count": 206, + "execution_count": 219, "metadata": { "slideshow": { "slide_type": "skip" @@ -6490,6 +7114,17 @@ "help(complex)" ] }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "### Duck Typing" + ] + }, { "cell_type": "markdown", "metadata": { @@ -6498,14 +7133,16 @@ } }, "source": [ - "The primary purpose of ABCs is to classify the *concrete* data types and standardize how they behave.\n", + "The primary purpose of ABCs is to classify the *concrete* data types and standardize how they behave. This guides us as the programmers in what kind of behavior we should expect from objects of a given data type. In this context, ABCs are not reflected in code but only in our heads.\n", "\n", - "For, example, as all numeric data types are `Complex` numbers in the abstract sense, they all work with the built-in [abs()](https://docs.python.org/3/library/functions.html#abs) function (cf., [documentation](https://docs.python.org/3/library/numbers.html#numbers.Complex)). While it is intuitively clear what the [absolute value](https://en.wikipedia.org/wiki/Absolute_value) (i.e., \"distance\" to $0$) of an integer, a fraction, or any real number is, [abs()](https://docs.python.org/3/library/functions.html#abs) calculates the equivalent of that for complex numbers. That concept is called the [magnitude](https://en.wikipedia.org/wiki/Magnitude_%28mathematics%29) of a number, and is really a *generalization* of the absolute value." + "For, example, as all numeric data types are `Complex` numbers in the abstract sense, they all work with the built-in [abs()](https://docs.python.org/3/library/functions.html#abs) function (cf., [documentation](https://docs.python.org/3/library/numbers.html#numbers.Complex)). While it is intuitively clear what the [absolute value](https://en.wikipedia.org/wiki/Absolute_value) (i.e., \"distance\" to $0$) of an integer, a fraction, or any real number is, [abs()](https://docs.python.org/3/library/functions.html#abs) calculates the equivalent of that for complex numbers. That concept is called the [magnitude](https://en.wikipedia.org/wiki/Magnitude_%28mathematics%29) of a number, and is really a *generalization* of the absolute value.\n", + "\n", + "Relating back to the concept of **duck typing** mentioned in [Chapter 4](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/04_iteration_00_lecture.ipynb#Type-Checking-&-Input-Validation), `int`, `float`, and `complex` objects \"walk\" and \"quack\" alike in context of the [abs()](https://docs.python.org/3/library/functions.html#abs) function." ] }, { "cell_type": "code", - "execution_count": 207, + "execution_count": 220, "metadata": { "slideshow": { "slide_type": "slide" @@ -6515,48 +7152,48 @@ { "data": { "text/plain": [ - "42" + "1" ] }, - "execution_count": 207, + "execution_count": 220, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "abs(-42)" + "abs(-1)" ] }, { "cell_type": "code", - "execution_count": 208, + "execution_count": 221, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ { "data": { "text/plain": [ - "Decimal('0.1')" + "42.87" ] }, - "execution_count": 208, + "execution_count": 221, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "abs(Decimal(\"-0.1\"))" + "abs(-42.87)" ] }, { "cell_type": "code", - "execution_count": 209, + "execution_count": 222, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -6566,7 +7203,7 @@ "5.0" ] }, - "execution_count": 209, + "execution_count": 222, "metadata": {}, "output_type": "execute_result" } @@ -6588,7 +7225,31 @@ }, { "cell_type": "code", - "execution_count": 210, + "execution_count": 223, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "100" + ] + }, + "execution_count": 223, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "round(123, -2)" + ] + }, + { + "cell_type": "code", + "execution_count": 224, "metadata": { "slideshow": { "slide_type": "fragment" @@ -6601,7 +7262,7 @@ "42" ] }, - "execution_count": 210, + "execution_count": 224, "metadata": {}, "output_type": "execute_result" } @@ -6610,30 +7271,6 @@ "round(42.1)" ] }, - { - "cell_type": "code", - "execution_count": 211, - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "0" - ] - }, - "execution_count": 211, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "round(Decimal(\"0.1\"))" - ] - }, { "cell_type": "markdown", "metadata": { @@ -6642,15 +7279,15 @@ } }, "source": [ - "`Complex` numbers are two-dimensional. So, rounding makes no sense and raises a `TypeError`." + "`Complex` numbers are two-dimensional. So, rounding makes no sense here and leads to a `TypeError`. So, in the context of the [round()](https://docs.python.org/3/library/functions.html#round) function, `int` and `float` objects \"walk\" and \"quack\" alike whereas `complex` objects do not." ] }, { "cell_type": "code", - "execution_count": 212, + "execution_count": 225, "metadata": { "slideshow": { - "slide_type": "-" + "slide_type": "fragment" } }, "outputs": [ @@ -6661,311 +7298,13 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mround\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m4\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m3j\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mround\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m2j\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mTypeError\u001b[0m: type complex doesn't define __round__ method" ] } ], "source": [ - "round(4 + 3j)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "source": [ - "Knowing what ABCs a numeric type adheres to, is not only important in the context of built-ins. The [trunc()](https://docs.python.org/3/library/math.html#math.trunc) function from the [math](https://docs.python.org/3/library/math.html) module in the [standard library](https://docs.python.org/3/library/index.html), for example, only works with `Real` types (cf., [documentation](https://docs.python.org/3/library/numbers.html#numbers.Real))." - ] - }, - { - "cell_type": "code", - "execution_count": 213, - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "outputs": [], - "source": [ - "import math" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "source": [ - "[trunc()](https://docs.python.org/3/library/math.html#math.trunc) cuts off a number's decimals." - ] - }, - { - "cell_type": "code", - "execution_count": 214, - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "0" - ] - }, - "execution_count": 214, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "math.trunc(9 / 10)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "source": [ - "A `Complex` number leads to a `TypeError`." - ] - }, - { - "cell_type": "code", - "execution_count": 215, - "metadata": { - "slideshow": { - "slide_type": "fragment" - } - }, - "outputs": [ - { - "ename": "TypeError", - "evalue": "type complex doesn't define __trunc__ method", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0.9\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m1j\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m: type complex doesn't define __trunc__ method" - ] - } - ], - "source": [ - "math.trunc(0.9 + 1j)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "source": [ - "Another way to use ABCs is in place of a *concrete* data type.\n", - "\n", - "For example, we may pass them as arguments to the built-in [isinstance()](https://docs.python.org/3/library/functions.html#isinstance) function and check in which of the five mathematical sets the object `1 / 10` is." - ] - }, - { - "cell_type": "code", - "execution_count": 216, - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 216, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "isinstance(1 / 10, float) # we know that from before" - ] - }, - { - "cell_type": "code", - "execution_count": 217, - "metadata": { - "slideshow": { - "slide_type": "fragment" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 217, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "isinstance(1 / 10, numbers.Number) # a float object is a Number in the abstract sense" - ] - }, - { - "cell_type": "code", - "execution_count": 218, - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 218, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "isinstance(1 / 10, numbers.Complex) # float objects are always also Complex numbers" - ] - }, - { - "cell_type": "code", - "execution_count": 219, - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 219, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "isinstance(1 / 10, numbers.Real) # a float object's purpose is to model a Real number" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "source": [ - "Due to the `float` type's inherent imprecision, `1 / 10` is *not* a rational number." - ] - }, - { - "cell_type": "code", - "execution_count": 220, - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "False" - ] - }, - "execution_count": 220, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "isinstance(1 / 10, numbers.Rational) # the type of `1 / 10` is what is important, not its value" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "skip" - } - }, - "source": [ - "The `Fraction` type qualifies as a rational number; however, the `Decimal` type does not." - ] - }, - { - "cell_type": "code", - "execution_count": 221, - "metadata": { - "slideshow": { - "slide_type": "fragment" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 221, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "isinstance(Fraction(1, 10), numbers.Rational)" - ] - }, - { - "cell_type": "code", - "execution_count": 222, - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "False" - ] - }, - "execution_count": 222, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "isinstance(Decimal(\"0.1\"), numbers.Rational)" + "round(1 + 2j)" ] }, { @@ -6987,7 +7326,197 @@ } }, "source": [ - "Replacing *concrete* data types with ABCs is particularly valuable in the context of input validation: The revised version of the `factorial()` function below allows its user to take advantage of *duck typing*: If a real but non-integer argument `n` is passed in, `factorial()` tries to cast `n` as an `int` object with [math.trunc()](https://docs.python.org/3/library/math.html#math.trunc).\n", + "Another way to use ABCs is in place of a *concrete* data type.\n", + "\n", + "For example, we may pass them as arguments to the built-in [isinstance()](https://docs.python.org/3/library/functions.html#isinstance) function and check in which of the five mathematical sets the object `1 / 10` is." + ] + }, + { + "cell_type": "code", + "execution_count": 226, + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 226, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "isinstance(1 / 10, float)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "A `float` object is a generic `Number` in the abstract sense but may also be seen as a `Complex` or `Real` number." + ] + }, + { + "cell_type": "code", + "execution_count": 227, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 227, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "isinstance(1 / 10, numbers.Number)" + ] + }, + { + "cell_type": "code", + "execution_count": 228, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 228, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "isinstance(1 / 10, numbers.Complex)" + ] + }, + { + "cell_type": "code", + "execution_count": 229, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 229, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "isinstance(1 / 10, numbers.Real)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "Due to the `float` type's inherent imprecision, `1 / 10` is *not* a `Rational` number." + ] + }, + { + "cell_type": "code", + "execution_count": 230, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 230, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "isinstance(1 / 10, numbers.Rational)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "However, if we model `1 / 10` as a `Fraction`, it is recognized as a `Rational` number." + ] + }, + { + "cell_type": "code", + "execution_count": 231, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 231, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "isinstance(Fraction(\"1/10\"), numbers.Rational)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "Replacing *concrete* data types with ABCs is particularly valuable in the context of input validation: The revised version of the `factorial()` function below allows its user to take advantage of *duck typing*: If a real but non-integer argument `n` is passed in, `factorial()` tries to cast `n` as an `int` object with the [int()](https://docs.python.org/3/library/functions.html#int) built-in.\n", "\n", "Two popular and distinguished Pythonistas, [Luciano Ramalho](https://github.com/ramalho) and [Alex Martelli](https://en.wikipedia.org/wiki/Alex_Martelli), coin the term **goose typing** to specifically mean using the built-in [isinstance()](https://docs.python.org/3/library/functions.html#isinstance) function with an ABC (cf., Chapter 11 in this [book](https://www.amazon.com/Fluent-Python-Concise-Effective-Programming/dp/1491946008) or this [summary](https://dgkim5360.github.io/blog/python/2017/07/duck-typing-vs-goose-typing-pythonic-interfaces/) thereof)." ] @@ -7005,7 +7534,7 @@ }, { "cell_type": "code", - "execution_count": 223, + "execution_count": 232, "metadata": { "slideshow": { "slide_type": "slide" @@ -7018,7 +7547,8 @@ "\n", " Args:\n", " n (int): number to calculate the factorial for; must be positive\n", - " strict (bool): if n must not contain decimals; defaults to True\n", + " strict (bool): if n must not contain decimals; defaults to True;\n", + " if set to False, the decimals in n are ignored\n", "\n", " Returns:\n", " factorial (int)\n", @@ -7029,15 +7559,15 @@ " \"\"\"\n", " if not isinstance(n, numbers.Integral):\n", " if isinstance(n, numbers.Real):\n", - " if n != math.trunc(n) and strict:\n", - " raise TypeError(\"n is not an integer-like value; it has decimals\")\n", - " n = math.trunc(n)\n", + " if n != int(n) and strict:\n", + " raise TypeError(\"n is not integer-like; it has decimals\")\n", + " n = int(n)\n", " else:\n", " raise TypeError(\"Factorial is only defined for integers\")\n", "\n", " if n < 0:\n", " raise ValueError(\"Factorial is not defined for negative integers\")\n", - " elif n == 0: # = base case\n", + " elif n == 0:\n", " return 1\n", " return n * factorial(n - 1)" ] @@ -7055,7 +7585,7 @@ }, { "cell_type": "code", - "execution_count": 224, + "execution_count": 233, "metadata": { "slideshow": { "slide_type": "slide" @@ -7068,7 +7598,7 @@ "1" ] }, - "execution_count": 224, + "execution_count": 233, "metadata": {}, "output_type": "execute_result" } @@ -7079,31 +7609,7 @@ }, { "cell_type": "code", - "execution_count": 225, - "metadata": { - "slideshow": { - "slide_type": "-" - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "6" - ] - }, - "execution_count": 225, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "factorial(3)" - ] - }, - { - "cell_type": "code", - "execution_count": 226, + "execution_count": 234, "metadata": { "slideshow": { "slide_type": "fragment" @@ -7116,7 +7622,31 @@ "6" ] }, - "execution_count": 226, + "execution_count": 234, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "factorial(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 235, + "metadata": { + "slideshow": { + "slide_type": "fragment" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "6" + ] + }, + "execution_count": 235, "metadata": {}, "output_type": "execute_result" } @@ -7138,7 +7668,7 @@ }, { "cell_type": "code", - "execution_count": 227, + "execution_count": 236, "metadata": { "slideshow": { "slide_type": "slide" @@ -7147,14 +7677,14 @@ "outputs": [ { "ename": "TypeError", - "evalue": "n is not an integer-like value; it has decimals", + "evalue": "n is not integer-like; it has decimals", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfactorial\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3.1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m\u001b[0m in \u001b[0;36mfactorial\u001b[0;34m(n, strict)\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnumbers\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReal\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mmath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mstrict\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 18\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"n is not an integer-like value; it has decimals\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 19\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mTypeError\u001b[0m: n is not an integer-like value; it has decimals" + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfactorial\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3.1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36mfactorial\u001b[0;34m(n, strict)\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnumbers\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mReal\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mstrict\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 19\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"n is not integer-like; it has decimals\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 20\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 21\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mTypeError\u001b[0m: n is not integer-like; it has decimals" ] } ], @@ -7175,7 +7705,7 @@ }, { "cell_type": "code", - "execution_count": 228, + "execution_count": 237, "metadata": { "slideshow": { "slide_type": "fragment" @@ -7188,7 +7718,7 @@ "6" ] }, - "execution_count": 228, + "execution_count": 237, "metadata": {}, "output_type": "execute_result" } @@ -7210,7 +7740,7 @@ }, { "cell_type": "code", - "execution_count": 229, + "execution_count": 238, "metadata": { "slideshow": { "slide_type": "slide" @@ -7224,8 +7754,8 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfactorial\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m2j\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m\u001b[0m in \u001b[0;36mfactorial\u001b[0;34m(n, strict)\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 21\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Factorial is only defined for integers\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 22\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfactorial\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m2j\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36mfactorial\u001b[0;34m(n, strict)\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 21\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 22\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Factorial is only defined for integers\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 23\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mn\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mTypeError\u001b[0m: Factorial is only defined for integers" ] } @@ -7269,6 +7799,195 @@ "\n", "The **numerical tower** is Python's way of implementing various **abstract** ideas of what numbers are in mathematics." ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "## Further Resources" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "The two videos below show how addition and multiplication works with numbers in their binary representations. Subtraction is a bit more involved as we need to understand how negative numbers are represented in binary with the concept of [Two's Complement](https://en.wikipedia.org/wiki/Two%27s_complement) first. A video on that is shown further below. Division in binary is actually also quite simple." + ] + }, + { + "cell_type": "code", + "execution_count": 239, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [ + { + "data": { + "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUDBAcICAgICAgJCAgIBwgICAgICAgICAgICAgICAgICAgIChALCAgOCQgIDRUODhERExMTCAsXGBYSGBASExIBBQUFBwYHDwkJDxcVEhUXFRMVFxUYFRUVFRUVFRcYFRUVGBUXFRIVFhUXFxcVFRUXGBYVFxUVFRUVFRYVFRUSFf/AABEIAWgB4AMBIgACEQEDEQH/xAAdAAEAAQUBAQEAAAAAAAAAAAAAAQQFBgcIAwIJ/8QAVxAAAQQBAwIDBAQHCQsJCQEAAQACAwQRBQYSEyEHCDEUIkFRCTJhcRUjNkJSgZEzYnJzdHWhtLUWJDQ1Y3aCorGzwjdDRFNVh5LBxCaDk5SjssPR1Bj/xAAbAQEBAQEAAwEAAAAAAAAAAAAAAQIDBAYHBf/EAC8RAQEAAgAEBAIJBQAAAAAAAAABAhEDEiExBAVBUTJxBiJhgZGhsdHwFCNSweH/2gAMAwEAAhEDEQA/AOMkREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCEU4TCCUREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQFUdEdHqd89Thj4Y48h/5qnVZAc1pR+hLE79ThI0/08VrGb/NvCb38qoyiIssCIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAAiq6E7mnixjHSPcA1zm8iM9sNDuwz88Jq3DrP444h2PdxjIADsY+HIFb5fq7b5fq7UiKqsRBjGD1e4c3fvWn6jcD4kd/wBYUSVHBrCASZOWG494FruJGPj8D+tTlpcKpkXsyrIXFnB3IDJbjBA+ZB9Avuuxj8Md7rvzXfAk/mu+X3/tUmNSY2qZF9hmHYdkYJB+Yx69vmvaxHCG5Y6QnPo9rQMfHuHHukx6HKplLgR6qCq3V2Ynf94P7WgqzHps5em/56/sow0n0TiVXSSmFkfT91z2c3P/ADu5Ia0EegwP2lffWfLDIZDyLOJY845ZLg0sLsZcC0k4P6K1yTt6t8k7evdbQp4qr0uNvJzyM9ON8mD6EtHug/ZyISv75mc7uek52T+kXNyfv7lZmO4zMOm1LHG5xDWgkn0ABJP3AKZonMOHAtI+BGD+wqqhqO9x3IAPkEfIH0Lv9vbK+q+mySF/cDhJweSezR7xLyf0R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8IKkVUt544ciYy79eFqFEG1/FffEu7d3wajpMEtOzasaZVoxyvY6VtuMwwwP5NHEZm4kevouk/pB99vp6PR0BkgNnVJG2LvDsPY6haQOJOWtlt8SPXtWeFyB4S7zdt7V6ursqQ3JafVdFDYc9sfUkifE2Q9M55N6hI+0D7CPfxk8Q7u6NWm1a4xkT3xwwxQRFzoq8MLOLY4y/wB4gvMkhz+dK77kGGoiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIoymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEooymUEIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIg/9k=\n", + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 239, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from IPython.display import YouTubeVideo\n", + "YouTubeVideo(\"RgklPQ8rbkg\", width=\"60%\")" + ] + }, + { + "cell_type": "code", + "execution_count": 240, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [ + { + "data": { + "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUDBAcICAgICAgJCAgGBwgIBwcHCAgICAgICAgICAgICAgICxALCAgOCQgIDRUNDhERExMTCAsWGBYSGBASExIBBQUFBwYHDwgIDx8VEhUdHh4YHRcWHxgdHh0XHRcdHR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w6rRDUr1zz6bnN3LoXHsT2IWDogKw3kCw2Rn1W21VeY6uMpWHZN227ZYrDDFDVP9Z04jlH/lXH4KvKs95ZPHrS2kMNNWlo5Szk71mSzcmhhpCu4tHTq145X2GydBsY5buYSHTS7AjYIOx+US197TkaWnoZN4sQz2y+1pBBu2WbV2P+IdHVcXf/en12G1UF2+s9QWMrkbuStO5T5K3NZl7ucGmZ5eI2cu4jY0hjR8GsaPguoQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQERAgKeP+Sy/Rfh7kMlxk4+zVj62ZmnZw/8GPs6X8vZvr3W7dKaKx2ObtDCJZXNIfYsNbJK7f6TR22Yz7mgffv6rkw4WWXd571T8S8n6fej+LP2x/zfl979FYiEW+daeFVO2HTUS2pOdz0tj7LIfzW7mH8rdx/VWmtQ4C3Ql6NuF0TvxSdiyQD1dHIPde309D8e+ymeGWHl2/S/W+U9Sx/c5fF88b5/3PrHVoiLD9YRNvgiAiIgIiICIiAiljSewBJAJ2Hc7NBc4/kABJ/IoQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQF2mko2vv0WPaHMkvVWva4btc107A5rgexBBIXVrttG/6xx/6QqfvEas8uHmLrg5We1/st3SwV+aB1iCpPLXjcWOlhifI1rmtaSHCMEtADm99tgCtweXGTHCrZG8TbxsHq9QsEprcGdPhv3MXLqb/AH+vwXy8teajDLePc4CTqe1wNP47XNZFKG/e0xxn/wBQ/Yvp49aHidGMnViAmEscdqONoAm672xRy8f+96jmNJ+IfufTv2s8t3or516T6f8AsnLY+q8v8dkvVjfvq+886s8ffX/ihBWnzdmPFx9VryzeOmwyNfOGjrGJkQPL3vXj+NyWqPHnFS18TditQOimgFeRrJm8XsL5oe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hVA8JdZu09l6uXZUhuS0Oq6GCy57Y+pJE+Jsh6Z35N6hI+8D7iPv4yeId3VGWmy1xjInyxwww1oi50VeGFnFscZf7xBeZJDv+NK78iDDUREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEUbpuglFG6boJRRum6CUUbpuglFG6boJRRum6CUUbpuglFG6boJRRum6CUUbpuglFG6boJRRum6CUUbpuglFG6boJRRum6CUUbpuglFG6boJRRum6CUUbpuglFG6boJRRum6CUUbpuglFG6boJRRum6CUUbpuglFG6boJRRum6CUUbpuglFG6boJRRum6CEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQf/9k=\n", + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 240, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "YouTubeVideo(\"xHWKYFhhtJQ\", width=\"60%\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "The video below explains the idea behind [Two's Complement](https://en.wikipedia.org/wiki/Two%27s_complement). This is how most modern programming languages implement negative integers. The video also shows how subtraction in binary works." + ] + }, + { + "cell_type": "code", + "execution_count": 241, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [ + { + "data": { + "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2MBERISGBUYLxoaL2NCOEJjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY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ueLT+mX6mMv2g1UueLB6X+pm861OsfdTLqR539+an+TF+D/AFH781P8mL8H+pj0rfvHpVImzzX791X8mH8H+o/f2q8vD+D/AFJ6Vr3j0rZWzzj6e1T/AIMP4P8AUfv3VfyYfwf6j0p7x6JiJ539+6r+TF+D/ULp7VL/AE8P4P8AUnpT+yPSoiXzZ5z9/wCr8vD+D/Uj9/ary8P4P9R6U949A0Qz4H7+1Xl4fwf6h9O6p/6eH8H+pfSp7x9+ymTij4X781P8mH8H+pH771L/ANPD+D/UelPePmgA7OIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/9k=\n", + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 241, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "YouTubeVideo(\"4qH4unVtJkE\", width=\"60%\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "source": [ + "Below is a short introduction to [complex numbers](https://en.wikipedia.org/wiki/Complex_number) by [MIT](https://www.mit.edu) professor [Gilbert Strang](https://en.wikipedia.org/wiki/Gilbert_Strang) aimed at high school students." + ] + }, + { + "cell_type": "code", + "execution_count": 242, + "metadata": { + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [ + { + "data": { + "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2MBERISGBUYLxoaL2NCOEJjY2NjY2NjY2NjY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IQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQCEIQf/9k=\n", + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 242, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "YouTubeVideo(\"Jkv-55ndVYY\", width=\"60%\")" + ] } ], "metadata": { diff --git a/05_numbers_02_exercises.ipynb b/05_numbers_02_exercises.ipynb index ab2499d..ff5e9a8 100644 --- a/05_numbers_02_exercises.ipynb +++ b/05_numbers_02_exercises.ipynb @@ -19,7 +19,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Read [Chapter 5](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/05_numbers_00_lecture.ipynb) of the book. Then, work through the exercises below." + "Read [Chapter 5](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/05_numbers_00_lecture.ipynb) of the book. Then, work through the exercises below. The `...` indicate where you need to fill in your answers. You should not need to create any additional code cells." ] }, { @@ -33,20 +33,20 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1** in [Chapter 2's Exercises](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/02_functions_02_exercises.ipynb#Volume-of-a-Sphere) section already revealed that we must consider the effects of the `float` type's imprecision.\n", + "The \"*Volume of a Sphere*\" problem in [Chapter 2's Exercises](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/02_functions_02_exercises.ipynb#Volume-of-a-Sphere) section revealed that we must consider the effects of the `float` type's imprecision.\n", "\n", "This becomes even more important when we deal with numeric data modeling accounting or finance data (cf., [this comment](https://stackoverflow.com/a/24976426) on \"falsehoods programmers believe about money\").\n", "\n", "In addition to the *inherent imprecision* of numbers in general, the topic of **[rounding numbers](https://en.wikipedia.org/wiki/Rounding)** is also not as trivial as we might expect! [This article](https://realpython.com/python-rounding/) summarizes everything the data science practitioner needs to know.\n", "\n", - "In this exercise, we revisit **Q1** from [Chapter 3's Exercises](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_02_exercises.ipynb#Discounting-Customer-Orders) section, and make the `discounted_price()` function work *correctly* for real-life sales data." + "In this exercise, we revisit the \"*Discounting Customer Orders*\" problem from [Chapter 3's Exercises](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_02_exercises.ipynb#Discounting-Customer-Orders) section and make the `discounted_price()` function work *correctly* for real-life sales data." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1.1**: Execute the code cells below! What results would you have *expected*, and why?" + "**Q1**: Execute the code cells below! What results would you have *expected*, and why?" ] }, { @@ -87,7 +87,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1.2**: The built-in [round()](https://docs.python.org/3/library/functions.html#round) function implements the \"**[round half to even](https://en.wikipedia.org/wiki/Rounding#Round_half_to_even)**\" strategy. Describe in one or two sentences what that means!" + "**Q2**: The built-in [round()](https://docs.python.org/3/library/functions.html#round) function implements the \"**[round half to even](https://en.wikipedia.org/wiki/Rounding#Round_half_to_even)**\" strategy. Describe in one or two sentences what that means!" ] }, { @@ -101,7 +101,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1.3**: For the revised `discounted_price()` function, we have to tackle *two* issues: First, we have to replace the built-in `float` type with a data type that allows us to control the precision. Second, the discounted price should be rounded according to a more human-friendly rounding strategy, namely \"**[round half away from zero](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)**.\"\n", + "**Q3**: For the revised `discounted_price()` function, we have to tackle *two* issues: First, we have to replace the built-in `float` type with a data type that allows us to control the precision. Second, the discounted price should be rounded according to a more human-friendly rounding strategy, namely \"**[round half away from zero](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)**.\"\n", "\n", "Describe in one or two sentences how \"**[round half away from zero](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)**\" is more in line with how humans think of rounding!" ] @@ -117,7 +117,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1.4**: We use the `Decimal` type from the [decimal](https://docs.python.org/3/library/decimal.html) module in the [standard library](https://docs.python.org/3/library/index.html) to tackle *both* issues simultaneously.\n", + "**Q4**: We use the `Decimal` type from the [decimal](https://docs.python.org/3/library/decimal.html) module in the [standard library](https://docs.python.org/3/library/index.html) to tackle *both* issues simultaneously.\n", "\n", "Assign `euro` a numeric object such that both `Decimal(\"1.5\")` and `Decimal(\"2.5\")` are rounded to `Decimal(\"2\")` (i.e., no decimal) with the [quantize()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.quantize) method!" ] @@ -162,7 +162,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1.5**: Obviously, the two preceding code cells still [round half to even](https://en.wikipedia.org/wiki/Rounding#Round_half_to_even).\n", + "**Q5**: Obviously, the two preceding code cells still [round half to even](https://en.wikipedia.org/wiki/Rounding#Round_half_to_even).\n", "\n", "The [decimal](https://docs.python.org/3/library/decimal.html) module defines a `ROUND_HALF_UP` flag that we can pass as the second argument to the [quantize()](https://docs.python.org/3/library/decimal.html#decimal.Decimal.quantize) method. Then, it [rounds half away from zero](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).\n", "\n", @@ -200,7 +200,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1.6**: Instead of `euro`, define `cents` such that rounding occurs to *two* decimals! `Decimal(\"2.675\")` should now be rounded to `Decimal(\"2.68\")`. Do *not* forget to include the `ROUND_HALF_UP` flag!" + "**Q6**: Instead of `euro`, define `cents` such that rounding occurs to *two* decimals! `Decimal(\"2.675\")` should now be rounded to `Decimal(\"2.68\")`. Do *not* forget to include the `ROUND_HALF_UP` flag!" ] }, { @@ -225,7 +225,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1.7**: Rewrite the function `discounted_price()` from [Chapter 3's Exercises](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_02_exercises.ipynb#Discounting-Customer-Orders) section!\n", + "**Q7**: Rewrite the function `discounted_price()` from [Chapter 3's Exercises](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/03_conditionals_02_exercises.ipynb#Discounting-Customer-Orders) section!\n", "\n", "It takes the *positional* arguments `unit_price` and `quantity` and implements a discount scheme for a line item in a customer order as follows:\n", "\n", @@ -264,7 +264,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "**Q1.8**: Execute the code cells below and verify the final price for the following four test cases:\n", + "**Q8**: Execute the code cells below and verify the final price for the following four test cases:\n", "\n", "- $7$ smartphones @ $99.00$ USD\n", "- $3$ workstations @ $999.00$ USD\n",