 Good morning evening and everything in between as you can tell what we're going to be talking about today is polynomials and more specifically how we can take a polynomial function and Put it into Python so as a super quick refresher if you're trying to remember how what a polynomial is and whatnot if we think about a polynomial If I did something as simple as if I did something as simple as x squared plus One right. This is a polynomial function. It's not a crazy one. It's not anything fancy But if we think about it, how would I represent this inside of Python now? Yes, we could go in and we could say for example Utilize something like the math library or just simply x squared or x times x plus one And that's one way to do it, but when we start getting into more complex polynomial functions That variation that I have there can you know become very difficult and so how can I? Represent all of my different polynomials in some way. That's easy to manage and easy to represent Specifically easy to represent Well, the way I want you to think about it is let's Reimagine this function for a second. Well, if we think about it that x squared what we could imagine that as is That's technically one times x squared Now before I move and jump into that one technically speaking, you know We also might want to represent say what's happening at the x to the 1th power And the way we could think about that is technically speaking. That's zero times x to the one power again as Anything times zero it's gonna be zero So you know in our mind what we do when we make x squared plus one is we're just you know removing That from our visualization of the formula and so as you can kind of imagine we're starting to go down all of our different powers and so Technically speaking this last little bit would be one times x to the zero power and again x to the zero would be one so one times one Now the question is and more specifically what I've just done How can I now take this and sort of represent it inside of Python? Well, there's a way we could do that if we think about it. What if I took each one of these Values that I just added in the the one the zero and the one and I used that to represent my polynomial So maybe say for example, I come in and say something like One to represent that x squared comma zero to represent that x one one to represent exit the zero spot and So what I've just done is I've created a list now It's just a list right now So how could I possibly turn that into say for example an actual polynomial function? That's where numPy gets to sort of come into play. So in our case Let's say for example, I did exactly that. I took my numbers And I made a one zero and a one Again, I've just created a numbered list. There's nothing fancy about this There is no polynomial going on right now But as you can see I've clearly imported numPy to start this application And so what I'm able to do and I'll actually just kind of print it out if I did print in P dot poly 1d poly 1d for poly one dimensional Is effectively going to take in some parameter. So in my case, I happen to have a parameter I have numbers and So what this is going to do is it'll actually display in our case if we You took a look we were looking at say for example this x squared one This will actually go about doing it. So if I hit play That's exactly what we see now if you notice it is still adding in say in our case the one At the start, but you can sort of see that from a visualization perspective Oh, well, you know, it's doing its best to show that this first one is Raised to the second power and it's skipping over the zero because it's a zero and it's even doing a nice little visual Visualization that's not doing x raise to the zero power. It's just going ahead and saying I'm gonna use the one in this case and you can do this with any type of polynomial So if I came in and just did something like a one two three four five and I hit play The exact same thing is going to happen So one times x to the fourth power plus two times x to the third Three times x to the second four times x to the first and five times x to the zero power Now the reason why this is pretty beneficial is Now that I have my polynomial function or I have a way to represent my polynomial function one of the things that poly 1d also allows us to do is we can Treat it as if it was an actual function. So let's say for example, I came back to the 101 variation. So again, this is simply just x squared times x plus 1 Well, again, if I wanted to say for example find out some values now that I have my polynomial polynomial function just like any function Maybe I could pass it a parameter and it's going to return back some value Associated to that and so the way we could think about that is let me just come in here and Take this out and I'm gonna just call this poly as a variable and So again, like I was saying if I came in and then treated this as if it was a function So I'll say the calculation is poly Five. Okay. Well, what we're saying here is What would the value of this function be if x was equal to five and you know If you have done a little math in your day, you can tell that that's five times five plus one So five times five. That's 25 plus one 26 And so if I came in and said calc I should be able to click and run and What do you know? I happen to see 26 25 plus one is 26