--- Video Title: Python vs. Mathematics Description: Theory of Computation https://uvatoc.github.io 4.1: Python vs. Mathematics - How are real computers different from mathematics - Modeling natural numbers with computers - Sum-of-Three-Cubes: https://phys.org/news/2019-09-sum-cubes-solvedusing-real-life.html - Q: Alien mathematics David Evans and Nathan Brunelle University of Virginia --- What are the differences between Python and math? And this is the one biggest one that I hope to see, but I saw in maybe less than a third of them. Everything that we do with a computer is finite. Almost everything we do with math is infinite. There are no arbitrary limits. There are only a few kinds of objects we do math with, like Booleans, that are small finite sets. Almost everything else we do math on, like the natural numbers, we're talking about unbounded values. And the amount of memory you have in a computer may seem kind of infinite. When this disk drive came out and people first were getting it, having 28 million bytes seemed pretty close to infinite for people in 1961. I should mention this price, that was per month. That's not the price to get the whole drive. You couldn't buy the whole drive. This is what you had to pay per month to get your 28 megabytes. At the time, it felt like nearly infinite storage, like probably in many ways what you have on your computer feels like nearly infinite. But it's definitely not infinite. This has real implications. I will show one example. This is perfectly good math. It's a little funny notation because I'm using. Python notation, but we're cubing three numbers. Does anyone know what they add up to? You can do that in your head. It's 42. Excellent. Someone's been paying attention to that. Number theory news. Or is really good at calculating. What do you think Google thinks it adds up to? If we try that in Google, it does not add up to 42. Google can do a lot of math, and it's certainly got lots of memory, plenty of memory to represent these numbers. But it's using a representation of natural numbers, which is also the case if you're using C or Java in most programming languages, that is a pretty poor approximation. So it's not only things like real numbers that we know and that the book talks about computers can't represent exactly. They can't even represent natural numbers and do simple operations like cubing and addition. Luckily, we're not using Google for our math mostly. Python is actually able to do it correctly. But there are some numbers big enough that Python will not add them correctly. It will eventually run out of space. Our mathematical representations don't have that problem. When we talk about math, talk about the natural numbers, we don't run out of storage. All computers eventually do. Some earlier than others. The other difference I want to highlight between math and computers is about correctness. Everything that we compute on a real computer, anything that we're computing using physical stuff, has some non-zero probability of being incorrect. Even if it's within the range of things we can store correctly and we're not running into memory, there are cosmic rays. Cosmic rays are hitting the Earth all the time. If they hit memory of your processor in the wrong place at the wrong time, they flip a bit. Any physical computer is vulnerable potentially to these kinds of things and they can make it wrong. That doesn't happen too often. And when people design computing systems, especially if they're operating in spacecraft in high radiation environments, they actually are careful to try to design them to have some tolerance for being hit by cosmic rays. So maybe you shouldn't be worried about that. But there are other things that cause bits to flip. The first picture is a light bulb. Heat will cause bits to flip. The more interesting one, you can generate heat remotely if you access memory. If you access modern RAM in particular ways, you can cause failures. And there are all sorts of interesting attacks that are taking advantage of being able to change values in memory. So when you think you're adding two numbers, you actually get something different. Or you think you stored one number and it doesn't represent that. Math doesn't have to worry about things like that. We know what addition means in math. It's always correct. It might be miscomputed by a human doing it or a computer doing it. But mathematical addition is perfect. It's defined and it always means the same thing. And it's always correct. And related to that, the final one I'll mention, there's no way to do computation with physical devices like computers without consuming energy, without generating heat, without doing things that have external consequences on the real physical world. Math does not have that problem. We can do infinitely many math additions without consuming any heat. Of course, if we're actually doing them or we're thinking about them, using your brain as consuming lots of energy, maybe generating heat as well. But that's not the abstract world of mathematics. The abstract world of mathematics, none of these things use any energy or heat. So there are real big differences. And often when we talk about computers and when you program computers or use software, you are assuming everything's perfect and abstracting from the reality of physical computation to a much more mathematical model and assuming your. Python interpreter always does arithmetic correctly. And that's usually a good assumption. When students in CS 1110 think their program is wrong because there's a bug in the compiler or a cosmic ray hit their processor and got the wrong result, that is probably not the actual reason that it's wrong. But it could be. Doesn't that assume that math is separate from humans? Humans have invented math, but math exists in some abstract notion that is totally independent from humans. This is why when they sent the Voyager spacecraft, and I don't know the detail. I know some of the things we send in outer space are like representations of pi, things that we think are totally universal, even though, yes, it was sort of understood by humans, but it's some property about the universe that is not tied to humans. We don't have any examples of the kind of mathematics non-human intelligent beings would invent and whether they would end up with a notion similar to the one we have in natural numbers or something different. If they live in a world that's very different from ours. But there's nothing about these abstract mathematical concepts that should depend on humans. It is human invented, so it certainly reflects human biases. Taylor немецcionâmology. Peace! Be all about the possibilities. Peace. Uh, known obstacle to take advantage of its studies生活 inspector or SolarComb員.