 Hello, everyone, and welcome back to some Python programming tutorials. I'm Ruder Vanull, and we're still looking at the SMPI module. We just finished installing it. And now we can actually do some stuff with it or learn a little bit more about it. I'll use this as kind of an introductory video to kind of introduce it to you and really what your appetite for what SMPI can really do. So I'm going to head back over to SMPI.org, SMPI.org. And we'll head over to the documentation now. Now, okay, here we go. Welcome to SMPI's documentation. Now SMPI is a Python library for symbolic mathematics. If you're new to SMPI, oh, hey, that's us. Start with the tutorial. Okay, let's head over to that thing, this tutorial. And it looks like there are preliminaries, installation, we're good that exercises and about this tutorial. Let's go straight to the introduction. Introduction. What is symbolic computation? Okay. This is pretty much the guy that I wanted to introduce and show you guys to show to you guys sorry, it runs through a little bit of kind of cool stuff with SMPI that you can do. And I'm kind of going to mimic some of it. And it explains why you should be using SMPI and I'll I'll try and echo this as well when I show you my demonstration and what what I'm going to be doing and stuff like that. So this is it I just want to show you where it was online. And I'll go through the first exercise with you guys. So we can kind of see what is awesome about SMPI and symbolic computation. So right now I'm going to minimize this. I'm going to fire up idle. So we've got a live kind of Python interpreter and environment for us to work with right now. So the first question it kind of proposed to us was what is symbolic computation? And the tutorial wants to tell you that symbolic computation deals with the computation mathematical objects symbolically. And this means that the mathematical objects are represented exactly and not approximately with mathematical expressions with un-evaluated variables left in symbolic forms. So if I had like three over two, you know, that's an improper fraction or something, right? It's it's evaluated to like 1.5 one and a half. But it's going to stay as three over two because that's it as its exact form 1.5 is technically an approximate evaluation. So these mathematical expressions three over two are un-evaluate because well, that's a bit more exactly. It's it's it's the exact interpretation of it. And since we're using symbols like x and y, other variables, we can actually kind of treat them, you know, like math would like real variables, not Python, not computer science variables, but mathematics variables. So here's here's where SMPI kind of show you an example. Let's say we want to use Python to compute square roots. What we might typically do is we import the math module that comes with Python and we'd use the math dot square root function. You force this is going to find the square root of the value. And we typically pass in an integer. So let's pass in nine. And we get a value in the actual square root of this number three. But notice that it's in it's a float. Now, we've given this point zero, we've made sure that it's a decimal. And the reason that it does that is because, well, what if there's something that we pass to square root, the square root function that is not a perfect square, like nine, of course, is a perfect square. But what if we gave it eight? Bam, now we got this jumbled mess, because well, that's a it's, it's not the exact value. It's, it's, of course, kind of approximated as close as we can get to the exact value between our mathematical powers and what we can do with calculations now. But we may truly never ever know what the square root of eight is. It's forever going to be just the square root of eight, left in this unevaluated exact form. Now, this is where SimPy kind of comes in handy for us, we get this approximate value when we're using the regular square root function in with the math Python, the math module in Python. But note that the square root of eight is essentially, you know, I can see if I can visualize this for you. That's the same thing as square root of four times two. And when you take the four out of the square root, because that's a perfect square, you're going to end up with Oh, I don't know, the square root of two, multiplied by two itself, because that four comes out as two, when you take it out of the square root, right? I mean, that's what you were taught in your algebra classes throughout schooling. So this is where our symbolic computation comes in with some with the symbolic computation system like SimPy, square roots are numbers that are not perfect squares are left un-evaluated. And so many other things are the same way. Let's check it out. If I use SimPy, imported first. Now, SimPy, this the function is called sqrt, the same way as math. And we wanted to use nine. Note that it gives us three, a regular integer, rather than a float up here, we pass in an integer and we're going to get an integer. But what if we tried eight, like we had done before, get this? Hey, it's two times the square root of two, which is exactly the kind of visualization and demonstration that just tried to show you guys. So this is why SimPy is awesome. It's going to give us the exact closest to real, un-evaluated truth and answer. So that's super duper cool. There's more in depth and interesting stuff for this as we get into expressions and using other variables like x and y, or truly anything else that we want to do. And keep in mind that it can do awesome things like derivatives and integrals and limits and solve equations work with matrices. And it does all of this symbolically. It does it as a computer algebra system. And that's kind of what you hear it always as a CAS, computer algebra system, that's the acronym that it works for. And that's what symbolic computation is better known as. Now, the article with the tutorial that we were looking through at SimPy and the documentation was saying that, oh, of course, there are plenty of other computer algebra systems out there. Why is SimPy a better alternative than all the others? Well, note that it's free, first of all, it's open source. And you can modify the source code. Hey, if you if you really want to this kind of contrast with Wolfram alphas and Mathematica, which costs hundreds of dollars and stuff like that. And also keep in mind this is using Python. Not all computer algebra systems have their own language that comes along with it. But SimPy is built entirely in Python, and it's executed entirely in Python. This means that if you already know Python, it makes your life so much easier when you're working with SimPy, because you for one thing already know the syntax. And for one thing, Python is a well tested, like super awesomely designed language. And on top of this, other algebra systems like maybe Sage, the toy, the tutorial online gives that example of Sage, it uses Python as its language. And Sage is large, it's the download is like over over over over a gigabyte, sorry. And SimPy is lightweight. It's small because it's essentially a toolkit and like a utility package that comes with Python. Sage actually even calls upon Python if you were to use some of its functions. SimPy is included in Sage. But SimPy is on the other hand, an independent system, because it's working with Python, alongside it. It's used as a library. Many other computer algebra systems focus on being used as an interactive environment. But Python is kind of already that in itself, when you're working with idle, or working with an interpreter. With SimPy, you can just easily use it there. And for one thing, it also has its own API. So you can extend it, write your own custom functions, and you can use it alongside other Python tools like URL lib, or regular expressions, or Pygame or GTK, plenty of cool stuff. And that's why SimPy is awesome. It's giving you a computer algebra system that works with your programming language, Python. So now we're actually going to get into more and more of the cool stuff that it does. And I'm gonna stop laboring. But I want to sell the point to you guys, that it's awesome. And I hope you'll stick with me for the next couple tutorials, as we look through why it's awesome, and essentially, why you're awesome. Thanks, everybody.