So, once more, hello everyone, good morning, afternoon, evening, whatever there is in your time zone, so thank you for getting up early or staying up late to join the Edge Computing Group discussions. Today is day one at the PTG but it will be day zero for our Edge conversations. So, before we dive into the sessions, do we want to do a round table introduction since it's not a lot of people or do you all just want to deep dive into the sessions because everybody's so excited. Well, I'd like, I'll go if you recall we discussed about sort of laying out the organization of the three days I think that might be worthwhile, because not everybody on this call is, is familiar with the, with what we're doing so that the laying out of the, you know, day one day to day three, or day zero day one, day two, I should say. Yeah, that's, that will, that will be the next, if we want a round, quick round table intro in terms of who's who on the call. Do we want to do that, or should we. I'll be happy to, you know, particularly since I knew there's a couple new people. So, I'll start Beth Cohen from Verizon been involved with the Edge working group for since its founding was one of the founders and primarily interested in at developing its use cases. I do a lot of what I've done with this group that take it back and developing products within Verizon. I will introduce myself to since I've been talking a lot. So my name is Eliko Vancha I work as senior manager of community and ecosystem at the open info foundation. And as part of my job, I'm community manager for the starting X project that we mentioned a bit earlier today it's an integrated cloud platform for edge and IOT use cases. And I'm also one of the co leaders of the edge computing group. And working a lot with adjacent communities such as etiquette state of the edge and some other ones in the edge and telecom space. Who wants to go next. Yeah, maybe. Yes, I can. Hi, my name is going to get your Terry I'm working in the open source program office of Nokia. And I'm also involved in the edge computing group, maybe not since it's foundation but from very early times, and I'm of course bringing in the, the telecom aspect of edge into the discussions. Get some new people about Nate. Sure. My name is Nate Johnston. I work at Red Hat. I'm a for neutron reviewer. I've been in the community for five years or so is on the TC for a little bit. I also now manage a team who that works focused on Octavia and designate. And I've not really, I've been aware of the edge discussions and watching them from a distance but what really attracted me to this was dimension in the notes of DNS. And I don't think the edge story for designate is very well formed at this point. And so I'm interested to listen and learn and see what I can help contribute back to the designate team from the edge perspective. That'd be great. Because we've been, we've been definitely struggling. A lot of people are not super knowledgeable about the whole, you know, network services side of the house. And so, yeah, it's definitely an issue that needs to be brought back into other components. Okay, maybe I can, I can go then. So I'm batis-jonglet. So I work at INRIGA in France as a research engineer. And I work in the team of Fabriann Lab. And basically, I just arrived in the group. I think I've been to a few meetings, but there's no big meetings basically. And so I, for now I'm getting to, I'm trying to get an overview of the edge activity in the group to better understand what's happening there and what we can contribute as a research institute. And I have a bag one in networking and in, so networking mostly on Linux and on research infrastructure and research platforms to do all kind of network and system experiments. And that's it. Sounds great. Thanks. Adrian, maybe you want to go next. So, hi everybody. My name is Adrian Labre, professor at IMT Atlantic, head of the Stack Research Group. So the group that is just mentioned. Mainly we are doing research and development activity on topics such as for edge computing, computing continuum from the cloud to the IoT. My goal is actually to try to design the next resource management system to operate this computing continuum. We are mainly eight permanent and between 10 and 15 non-permanent staff all working on those questions for the IoT edge computing. That's all. Thanks. Thank you. And go next. Everybody I'm Rob Hirschfeld with Racken. And, boy, Beth, I certainly don't have your tenure on this in this group, but I have been in and out of it for many years. And I'll serve some time on the LF edge, the LF Edge organization. I've been doing edge and edge related work for years and years. And I've been in the OpenStack community for a long time before that, too. My interests here are very much around operations and distributed operations for Edge. And so a lot of the things that I enjoy bringing into the group and discussing in the group are related to the automation and operations pieces. That touches on everything else too, but those are usually my focus areas. Oh, and bare metal. I do a ton of bare metal stuff. I'll take a smile. All right. No, I just think that that bare metal will become really interesting for Edge. It's one of the things that we have to get right. Yeah, we really do. Okay. Pankaj. Pankaj, I'm based out of Colorado. Sorry, I don't have my camera on. Oh, that's good. Disconnect one of the monitors and switch on my laptop. Too lazy for this early morning. I met Microsoft. I met the team that was sold from AT&T to Microsoft last year. I'm basically engaged with creating the network cloud or the recently re-labeled Azure for operators, distributors, services. I have been with this group for a while, but my main focus was from Aniket. Thank you. Oh, and I saw Karine joined. We are doing quick round table intro. Yes. Hello, everyone. Sorry for my late arrival at another meeting just before. So I'm working with Orange and my main focus is also my main attention is with the Aniket project at this moment. I'm interested on the OpenStack and Azure topics. So I don't know. I'm just joining, so I don't know if you want to be more introduction or not, if it's efficient. It's fine. It's good. I just would like to encourage everyone that I know that at least from from previous PTGs and other sessions. People are mostly joining with the intention to listen and learn. I think that we really arrived to the time when, even if you don't have a hands on experience with something, you still might have a question or a comment to add and just would like to encourage everyone to please speak up and grab the mic. If you have any time or if you don't want to interrupt the discussions then zoom has a function to raise hands and show in all kinds of ways that you would like to chime in as well. I will do my best to pay attention to those as we are going through the meeting. I also just shared the etherpad that we prepared for the event. So, you can have taking notes or you can just open it so that you're able to follow what's happening a bit more closely. And when it comes to one more logistics item. We will have a bit over an hour and a half left for today. We will see if we get to the point of where everyone needs a five minute break, or if we can, or if we have really interesting discussions and we will just kind of fly through the remaining amount of time. If more of you feel like that you need a short break, please again raise hands or just chime in at some point so we can maybe coordinate on that one as well. And with that, Beth, if you don't mind, I think it would be great if you could start kicking off the discussions with talking a little bit about the concept and the scope. I will ask others to join in who have been working in an area where this day zero day one and day two slash and concept is a thing. Right. So, Nate, this is a directly in in your interest. So the, what we did this, this time is we focus the discussions around operations and service delivery and this comes out of my experience in actually building a product, an edge product which is virtual network services. And we have the app horizon and we shipped it, what, five years ago now. But you know it has been attorney. Let me say that. And the concept is day zero. The first is is sort of the templates and the automation and sort of the standard features that that can be kind of predefined.  And so you need to, to, you know, bootstrapping is a whole lot harder. And so day one, sorry, today, we're going to focus on day zero, which is, you know, how to how to build those templates what needs to be in those templates. And, you know, who's responsible for creating them, maintaining them there's there's a whole lot of stuff that goes into sort of the day zero stuff and I know Rob, your, you know, neck deep in this stuff. And then the tomorrow we're going to be talking about day one and day one is really around this within Verizon we call it service delivery. Day zero and Verizon's terminology is product development. Day one is service delivery, i.e. customers ordered something, we need to actually deliver it to the customer's edge or deliver the service, whatever. And what that means is you take the templates that come from day zero and you inject specific information, let's say an IP address, or, you know, something about the customer's network connection or, you know, specific to that to that user that end node, you inject that and then you get it out to the site. There's a ton of additional information that needs to go into it, you know, particularly when you get involved in licensing, which means you need to have, you know, some way, you know, typically licenses are managed centrally, but you know obviously each site has to have a unique license you know how does it check things to make sure that the license is the right license is being delivered, etc. So, and then you know how do you validate that the hardware at the other end can support what has been ordered. This is actually a big problem. Again, because at the edge you don't necessarily have additional resources that you can just, we'll just add a couple, a couple more.  Well there is no more resources to use up. So anyhow, so service deployment and delivery is kind of the focus of tomorrow. And then the third day is sliding down. So this is once once you've delivered the service and you've turned it on you've turned it over to operations. There's a whole lot of things that need to be taken care of, once you're in operating mode. And, you know, just, just I use a simple example that we've run into, you know, we've, we've turned up the service customers happy we're running it and then there says oh here's the new update of the service and we need to push it out to the edge. Well, how do you do that, you know, because you're in operations and, you know, you can't just say to the customer hey, we're taking the service down for a couple hours while we do an upgrade. That doesn't fly. How do you access it if the network connections fail. How do you maintain your licenses right a lot of the vendors have a, you know, a check in mechanism you know has to check in once a month or once a week or once a day or whatever. To make sure that you know it's still a valid license and if you lose that connection. It's sometimes it reverts down to a lower level of service, which with nasty nasty surprises for customers. So anyhow that's the focus on the third day and and the thread through all three of these is driving automation and and manage and manageability and lifecycle management, you know, over, you know, through the entire lifecycle of all of these applications that are at the edge. So, hopefully it didn't go on too long. Any questions. That makes sense and I've been involved in exit delivery and administration at previous jobs, Comcast and America online so this, this all feels very, very normal and straightforward to make sense. If you've done, if you've done Comcast, yeah. Verizon does the same thing. Any other comments or additional thoughts to the concept before we dive into day zero. Zero let's go. Let's go. Okay. So as Beth mentioned, templates play or play an important role. In case of day zero preparation steps. So we prepared a couple of questions. As we were planning for the PTG that you can see on the etherpad and beyond templates we were also touching on things like how to do automation from early on, like, even before things starting to happen. So if you have the right level of automation to support day zero, then touched on licensing issues that could be a topic to discuss, and also platforms that you can choose to deliver your use case and applications with any high availability is appearing on the etherpad as that's also a pretty important question or a topic to decide before you start to roll things out because high availability setups are different. They're tricky and complicated. Yeah, that's my experience with them. Okay. So, especially those of you with experience. Do you have a favorite question to dive in should we start with templates. I'd like to start with. Yeah templates is good. Okay, let me actually let me share some of my personal experience with developing the product and and sort of some of the road, the bumps in the road. Oh yeah, trying to get the cut of the it started. So, we, we started with the idea of creating a product that could be delivered on the edge, as well as on a hosted core platform. So we in fact use open stack. And the idea was to create, we use templates in fact, and with workers with an orchestration platform to to deliver those templates. And we quickly ran into issues with how standard should those templates be and how many, you know, the idea being that, you know, do you do you have like, six, six standard templates and then you kind of add a bunch of variables when you do the delivery, or do you have a couple hundred standard templates. And over time we ended up with, we now have a couple hundred standard templates and the reason is is because the images are actually there's not a whole lot of them. But the templates go into details about the network connectivity. So it turns out that the way we architected it and maybe that wasn't the right way but it is the way we're stuck with. So we have like if, if let's say we have a MPLS connection we have a wireless connect you know LTE or 5G connection actually LTE and 5G separate templates.  And then we have to run around and create a new template. Yeah, each new template takes, you know, a couple hours to do. It's not a big deal, but as I said, we now have hundreds of them. So, other experience. Is this the right way to do it. Are you're the templates that you're using. Are they messing with my sound sorry. Do I sound okay. Yeah, you sound fine. All right, I was getting too much too much monitor back on my side. So do you version control all those like are they set up in a bundle and then site site specific. They're not version controlled actually it's just a library. It's just a catalog. So, you know if one goes out of date we just throw it away.  I'm trying I'm trying to think I have questions for you I also have what what sort of what we've been helping people do and our approach to it. I'm happy to share that if that's helpful because this is, it's hugely painful to go site to site. And then also know what. Just to back back in the old days we used to have a complete automated system and bundle everything. But what we found was that if we change the automation on on site to be to fix something. It was really hard to know if to bring back the change and then roll it out to other people. And maybe this is different this is automation it's different than templates. Although for us that they've started to cross into the same thing. Yeah, the automation actually it doesn't change as much it's the templates that I mean it's the same automation just using an orchestrator. Our experience has been that the that is if the templates are the configuration that you're using as input. The changes to those templates also have to be respected by the automation or the automation has to be able to pick up the changes to those templates. Yeah, but we're not doing it that way we're just saying, during the order process, we take. We, you know, based on what the order says it gets converted into Oh, you want this template. And it just the template gets injected into the automation. How do you how do you keep. So, what we've seen is that as the automation changes the information the templates can can need to be updated and so there's a vert there's a synchronization issue where especially past templates when you're talking about a lot of sites or a lot of deployments that you know you're doing all the things all the time and so you have a case where the information you're providing to one site or a collection of sites has to be changed in relation you know it has to be changed in relationship to the automation that's behind it or the systems that are behind it. And for this we call it a content pack and you can version individual content packs and then you can create dependencies between content packs and then a content pack and have templates and other things but all of the pieces that you need to make something go because that can include because this can include binaries as a as a requirement. Right now we're talking day zero so this is like hey I'm building a site I need to know all the stuff that goes into that site that could include a set of, you know, configuration templates it could include the automation for it it could include the DHCP configuration for the system it could include binaries that you need to have loaded license files I know we're going to talk about that. Which is which is fine site site to site but then what we see is it once that's, you know, you start replicating that pattern and it's going to. It's the next site's going to change and the next site's going to change the next site's going to change. How do you isolate the differences between sites like do you have a way to break out some dependency some inheritance graph or some reuse components. Well, remember the site. So we're, it's day zero. So this is not, it's not. There's nothing unique about these templates. Don't you have like. Each site has some configuration about what you know what its name is what it's IP ranges are. That's injected in day one. That those are all variables that are injected as we, as we do the service deployment. And do your, the, how do the templates accommodate so you're starting day zero with these templates they expect to have injection of this is good, good. Yeah, yeah, yeah, yeah. That's I think I kind of mentioned that in the line where she's how standard are they and how much they can rely on variables to support day one deployment activities. I was talking about that. I see. So they're vanilla. The idea is that when the, when the solutions architects are architecting a customer's deployment, they're going down and saying, Oh, this, this is, this is site type acts that has these, these types of network connections and the and these services. Okay, so. I don't know what a blueprint. Okay, it's exactly what we call them actually we call them blueprints. Okay. So can that go all the way back to some of the reference architectures that are getting built like would have, would have blueprint here reference. I don't know if it's a Prano or some other standard, you know, some other blueprint system what does that look like for y'all. Well we built it ourselves but that was because we built it five years ago so. Yeah, so we use T templates but there's nothing that says, I don't know what's a great a Prano is based on itself or it's got its own YAML. Leave. I don't, I don't know enough about a crane. Yeah, I'm not, I mean the challenge is anything that you do this so when you build a template like this is it looking to be an actionable like this gets fed into the automation I'm assuming. Yes, yes, totally. That's why you're saying he, right. That's why we use he doesn't have to be he just that's happens to be our system. Right. It needs to be an automation driven as to go back into the automation. I think a quick interruption, a little bit of a technical issue with zoom. So it will most probably disconnect in less than a minute. So just join back to the room and after that it should work. We will see may not draw but I think it will. So if zoom drops just please connect back to the same room and hopefully it will work. So I think about that. It's just, you know, how Monday mornings are going. It is what it is. Okay. I know.


Hello, my name is Diego Lissarazzo from the OpenShift online team and in this video We're going to use OpenShift to host your Construct2 video game. So this game basically assumes that you already checked some of the videos that I created on how to create your first video game I have several of those that I created too in particular for this series and also that you have installed All the tools in your Windows machine to work with OpenShift If you haven't done those things I recommend you to check the links that I'm going to put on the description of the video and please Follow the steps that I'm mentioning there. Now let's host our game We're going to go to OpenShift.com to start this process Quite likely if you follow the previous video You already have an account if not, this is the moment to sign up for free for your OpenShift online account And after that, well, we're going to be logged in and if not, just go here to OpenShift web console We sign in and we're going to be logged into the dashboard that we see here And we're going to be able to see the applications that we have already created So here you see that I have already two games that I have hosted in OpenShift And at some point I'm going to create a couple of videos just to show you what I did But at the moment, let's just create a new one now since we used Construct2 to Create our first game and If you go and check the tutorials and check a little bit the documentation that you have with Construct2 Let's say features I think Well, you can see it over here These games are going to be HTML5 and JavaScript So the first thing that you're going to notice when you are in OpenShift online is that you have several instant apps several templates that you can just use to start well creating your app really easy and The first thing that came to mind the first experiment that I did to today's was We need something with JavaScript So I say like okay mean JavaScript. That's something that could work. I also look for Node.js really those were much more complicated than what I expected for this example and Afterwards, I figure out that the best way to do so was to just go for a PHP template So in this case, I am just going to pick the latest one PHP 5.4 Then obviously is going to ask you for a name for your project You see that the URL that is going to be picked is going to include the Domain that you picked for all your projects So this is something that you can change in any given time But you're always going to have a our hcloud.com so redhead cloud and whatever name you are going to have here So let's say that this one is I'm going to just call it Falcon since that's one of the assets that we use for our Constructive game So if you are not using the template If you are just going to Bring code from a git repository you also could do you could also pick something here But in this case, we are not going to do that We're going to just use everything that we have on our Machine so that's it No scaling. Yeah, let's just create obviously depending on your location. You could just pick one or Just say that you don't have any preference. Let's create application This could take a couple of minutes while everything is set up running and I am going to jump just to that part After a couple of minutes, we're going to get a pinch like this, but it's basically telling us that the entire project was created and Also is going to give us this information these Instructions on how to use to get to work with our project So one of the first things that we will have to do is to plan our project That is going to create a folder in our computer that will have all the code and we're going to modify that to well put our own game and Then we're going to Also have the git instructions that you are going to need to commit and push your changes So if you are familiar with git, this is not going to be really much of a surprise for you But let's try to work with this and see how that goes so let's copy this and We're going to use The common prompt here on Windows going to paste and then We're going to try to Clone the folder that we are going to need here So it's going to ask me do you want to continue to connect say yes And it's telling me that is done and right after that is telling me like hey You just have to say CD Falcon. I'm going to copy basically just like that and And We see that we have some directories and that we have an index PHP. This is basically What if we are going to modify to get our game there and Now we have to actually export our game. So let's do that For our next step, we have to open our construct to project the one that we work in some of the previous videos that you have in my account and We're going to export this project and create an HTML 5 JavaScript game If you are not using construct to you if you were using something like Unity on real GameMaker cuckoos 2d.js and well almost any other Java script or modern gaming platform You're going to have similar steps quite likely. I'm going to create a few videos Covering some of these other engines and you're going to see that most of the steps are exactly the same So I am not going to repeat some of the videos like how to install your How to install all the tools in your Windows machine but this part in particular is Going to be useful for anyone that is just creating new games and is using construct to So if you don't remember this Basically with construct to we create the small game that we have to tap on different enemies to try to protect our Centennial Eagle or Centennial Falcon in this case. Obviously, this is for educational purposes. That's why I am Using this small game. So nothing really complicated and That's pretty much it So this is what we're able to test on our computer using browser But now we really want to export this so the option is simply just go here to file Export project and then you pick the option for HTML5 website You see that there are many other ones, but this is the one that we need So let's say next Let's create a New folder here that we're going to call Falcon Export or whatever you want at this moment say next Normal style this is in case that you want to add some sort of like advertisement in your game But since we're just creating our first game just go for export It's going to take perhaps one two minutes This case is telling me that I don't have set up Java correctly to do the minify of the JavaScript and Well, that's fine. This particular case is just more an example. So let's open the destination folder and This is what we're going to have and you see that everything starts with an index HTML, right? So this is where your game is going to start This particular case if you try to open this In a normal browser, it's not really going to run quite likely your operating system is going to stop it from running and Like a local network for security reasons But you still can use a preview that you have with Construct 2 that is over here and you have this kind of like the same result Now we're going to have basically two different folders the export that we just did with Construct 2 or let's suppose that you did something similar with a Unity Unity 3d and also You're going to have the folder that we just created that should be called Falcon So we have it here So this is where the third trick goes and you're going to see that it's incredibly Incredibly simple a little bit of a hack, but it works perfectly So we're just going to copy all the files that we have here in the folder That we need that we created for OpenShift, right? Now we have a little bit of a problem. This is where the hack comes I guess that you could set it up manually, but I'm assuming that you have no previous experience with OpenShift and This is going to be great because the only thing that we will have to do is make certain that the code that is in our index That is index HTML is In our index PHP that is the one that the project is really looking for So let's open this let's say with Well, so open with Adam Could use basically notepad if you want you just need some sort of editor where you can modify the code So that's the first one and let's open the next one also with Adam. So we're just going to do a Dirty copy paste from one to the other. So we have the HTML here. We're going to control C Control a over here control V and then we have all the code that we needed from our Construct two game here. So let's save it Certain that that's the case and that's pretty much it now Everything that we had in this file now is copied here on our index PHP But obviously all the changes that we just did are not Set in Our open shift online account right now if we visit that it's not really going to show us our game So what do we have to do? So right now here you have basically the next steps that you that you need to do So we already did this we already enter our folder now. We just do this Obviously, we still need the prompt and we still have to be in the folder that we are going to modify But if we're right here, we just can do paste. We're going to add every change Then I am just going to do a comment. So look, I'm just copy pasting. I'm not even like doing anything Incredibly original you can change Name or put any comments that you want here to this comment that we are going to do with git in this case Well, let's let's make it a little bit more interesting So, I don't know My Construct to game, okay And of course, I think Okay, that work you see sometimes copy pasting is not great and The last thing that we're going to need is not we just did the comment now we need to push all these changes and paste and Then everything for your little application Should Automatically get ready and you see it's remote waiting for it to stop finish It's going to take one two minutes at most. It's done. So that should be pretty much it and now Well, I don't have it here But I'm going to just open in a new tap So we're going to see the overview of our application This is something that could have done at any given time and really what I want is the URL to check my Application so this is the name that you gave in a couple of steps away and Let's say that I'm going to open it. Let's see how that works And now we have our little game running on up and shift And of course well is here If you're running this in a Touch screen enabled device you're going to literally touch the screen instead of just clicking like how I'm doing right now and You should be able to play your little game and share it with everyone else So what do you do if you're going to make more changes on your project? so you go back to construct 2 or again some other engines and Then you're going to Modify, let's say the assets or you're going to change. I don't know the game over You don't want it to be red anymore. You just want it to be blue or whatever Afterwards, you just export your game. You're going to end up with a folder similar to what we had here So you end up adding images. You could try to modify the code manually, but in the case of construct 2, I don't recommend it and afterwards you just like Overwrite what you have in your open shift project that is Set up with gate and everything is already ready and you only have to repeat the last three The last three steps that we did that is the gate add commit and push and With that you should be able to Get your game running on open shifted. We see it here in this particular case my falcon project So I am going to leave this project there. You can check it is quite simple Perhaps I am going to modify a few things. I am going to start adding I don't know like a splash screen like menu or a couple more things But at the moment since the project was created to help the people that are going to work and the global game jam this weekend I think this is pretty much it. This is something that you can do in let's say half an hour and Now you have a space where you can share your game with anyone around the world Regardless if it's on the game jam or not and afterwards you can start sharing with this with all your family and friends At this point you should be able to create Different video games at least with construct 2 and to host them using open shift We would love to hear some feedback from you and see if you create any cool projects during this weekend. Let us know and game on


Hi, I'm Matthew coast head dating coach and founder at commitment connection calm in today's video We're gonna talk about how to get him to commit in the age of the hookup culture So as you probably know by now the hookup culture has really kind of spread like wildfire through Western society everybody's just trying to hook up with each other and it's just yeah Tinder everybody's let's just hook up It's just a big hook-up thing going on and as I talked about yesterday Um, I really feel like this is devaluing Women in men's eyes and I feel like it's a really it's hindering them from having the types of relationships they want I think it's preventing women as a whole from really getting deeper relationships and You know if you really want to Have a real relationship with a man There's one simple thing that you need to do you need to be different than all the other women that are out there So for most men here, let me let me explain something about men that I think is very kind of significant and important in terms of This whole hookup culture thing and why it's so important to be different For most men It's much it's far easier to go from Being in a committed relationship to being in a casual relationship then it is to go from being in a casual relationship to being in a committed relationship and You know one of the things that Happens in a man's mind when you just start You know when you just hook up with a guy is that He might have been open to something serious and real with you before the hookup and Just hooking up with him might have cut that off for him. So Studies have shown that Going from a casual relationship to a committed one works like one out of nine times Which if you don't know it's not a lot It does mean that it can work sometimes and and I'll talk more about that in other videos, but for the most part It's really difficult for a man to go there and But for women generally speaking what I found is that a lot of women Jump into kind of hookup relationships casual relationships because in their mind they're thinking oh, I'm just gonna go you know have fun with this guy and And they don't realize how things really work for them When they get into that sexual relationship? So first what I want to do is tell you some rules that I think that you should follow and or If you want to have the committed relationship that you want with a man In the age of the hookup culture and so the first rule is kind of what I was just talking about which is knowing They how things work for you. Um, so Usually when I talk to a woman who? Is in a casual relationship who's trying to get into a committed relationship? What she'll tell me is that she did it because she thought it would be fun at the time Right and then she ended up catching feelings as I like to call it and next thing you know that She was having sex with this guy and she Started falling in love with him and now she wants a committed relationship with him You know like I just said it that's not how things work for men, right men Typically unless he goes into it thinking, you know, I do want something more with this woman there's a really high probability chance that He's not gonna want anything more with you if you just hook up with him and so You know, I I know guys who have been in Relationships or casual friend with benefits relationships for 10 plus years with women and they don't want Anything more with that woman Other than just to hook up with her and and usually by that time the woman is like hey I think we're in this committed relationship And then there's this big fight that ends up happening and usually there's a really painful breakup that comes from it Because the woman starts to realize that she just wasted 10 years of her life with this guy who wasn't serious about her ever and so You know know how things work for you as a woman How things tend to work is that if you start sleeping with a guy You'll eventually develop feelings for him and that's not how it typically works for men So just keep that in mind if that's you just know that That might happen to you so rule number two is have some standards Friend with benefits is not a stage from meeting a man to marriage And so if you want to have something serious and exclusive with a man Don't waste your time getting into situations that have very little chance a very little chance of giving you what you want Instead figure out what it is that you want and you need from a relationship and make sure that you're getting those things Before you jump in right so make sure that he's not involved or emotionally connected to another woman Make sure that he's ready to get into something serious make sure that the two of you can support each other and what you value and want in life and You know have real conversations with the guy about these things. So a guy's not going to force you to have a conversation with him about these and you know trying to kind of You know figure out what's going on with a man like he's some kind of jigsaw puzzle that you're trying to put together Without looking at the the finished picture doesn't work. It doesn't you know you need to make sure that you have real conversations with them and A man that's just trying to have something casual is going to avoid these conversations. So You know and if he's looking for something real, he'll be honest with you about it So make sure you're having those conversations and make sure that you're getting into something that you want to get into From the start so rule number three goes along with rule number two and it's setting and maintaining Boundaries so women who end up in the types of Relationships that they want with men are the types of women who move on from situations that they don't want Until they find what they do want. You may you might want to write that one down. So if you're You know the women that end up in relationships that they don't want are women who Just stay in bad Relationships or they ignore red flags or they just hang out with guys that Aren't exactly what they want for a long period of time. They end up settling. They end up really being resentful. They end up You know breaking up 10 15 years later coming back and going man I wish I didn't just waste so much of my life with this guy that I didn't really want, you know, and you Just talk to women in our community about that You'll you'll hear tons of women tell you these horror stories of wasting time with men and it's it's really a painful thing So women that get into the relationships they want They don't accept men into their lives who aren't mature enough and aren't ready to create the type of Relationship that they want to have they don't have sex with these types of men They don't try to trick these men into wanting something more with them And they they don't get into situations that don't serve them And then try to hope and pray that it turns into something that they want believe it or not if you Hold a standard for men and you stick to it A man is much more likely to step up to to a to the plate and give you a real relationship then You know if you don't hold those standards, then he'll just assume that You're willing to let him walk all over you treat you like a set sex object and never require anything more from him And if you don't have that standard set When you meet a man if you don't have these boundaries That you stick to You know, even if a man was open to having something more with you before It's like it flips a switch in a man's mind where he no longer sees you as relationship and marriage material and It makes him start thinking of you as something that's more casual and I know that sounds bad But it's really about value here You know if you believe that you're a valuable woman and you project that value to a man if he If he believes that you're valuable as well Then he'll he'll do he'll move mountains for you He'll you know fly he'll you know travel across the world for you, you know And if he doesn't see that value in you Then he won't he won't do any of that for you and so part of it is Maintaining boundaries and believing that you are valuable in yourself and another part of it is him looking at you and feeling like you're valuable and so it's kind of a There's two kind of separate components there and you need both of them there and the boundaries part is believing in yourself and believing that You're the valuable one so rule number four is Discovering what really works in getting the relationship that you want So here are some things that do not work in getting the relationship you want Convincing a man that you're perfect for each other that never works Using sex to try to make him feel something for you that doesn't work either Buying a man gifts or doing favors and errands for that for him. That's really being in your masculine and that's You know when you're masculine when you're in your masculine a guy might like you but at best you'll you'll you know think of you as like one of the guys or Think of you as something casual Another thing that doesn't work is playing games or using manipulation tactics that stuff works short term doesn't work long term Seeking his approval that is that just makes your value go way down and makes him see you as somebody that he doesn't want anything to do with Calling or texting him all the time You know we talk I talk more about this and some of my videos and programs and stuff But there's a thing called mirroring and that's that's really where you want to be when it comes to calling and texting I don't think you should play games around this but at the same time I don't think that you should you know Kind of be obsessive about it either So shaming or bullying him into being the man that you're looking for this is like the worst Worst possible thing that you could ever do to a man and so many women do this and it never ever works It's never ever worked and I don't you know, I think it's kind of this righteous like you know Yeah, I deserve this and you need to act this way type of thing doesn't work That doesn't work with men at all. It'll never work. Don't do it.  It'll make him hate you Just avoid that at all costs and the last thing is Listing your impressive resume or talking about guy things or becoming the social planner of his life And we talked about being masculine. This is more masculine type stuff if you're being masculine around a man It's just not attractive even if he was attracted to you before it. It's like, you know, it's total It's a total turnoff for guys, you know, it makes him go, uh, you know like What one of the a big thing that I talk about in a lot of my programs and videos and stuff is This thing about investment and the guy has to invest in you and we'll talk more about that later So all the things I just mentioned are all things that will immediately or eventually make a guy lose interest in you pull away and disappear altogether and so What a man really needs in order to want this long-term Committed relationship with a woman is he needs to feel like she is the one the one that he's been looking for His entire life or at least she might be the this amazing woman that he's looking for and You know, I just want to make a clarification here I didn't say that a man needs to think, you know, I said that he needs to feel, right? So I think a lot of people Underestimate the amount of stuff that men do based on how they feel And a man You know, especially around relationships, he's looking for that feeling he wants to feel like this woman is the one You know a man's not gonna chase you. He's not gonna pursue you. He's not gonna commit to you unless he feels This thing that makes him say this is a special amazing girl that Has come into my life And so if you want to know more about what makes that a man feel that kind of feeling for you I've got a video a link to a video underneath this video You can go to that and check check out more About what makes a man really feel like you're the type of woman that he's always been looking for in his life


Very good. Well, hello everyone and welcome back to Sailor Academy's introduction to Python This is unit five. We have done Four other reviews of units if you have not taken a course yet Feel free to go to sailor.org Python course come back. I'll make sure there are links in the description below if you're coming out late If you're live now, I'll put the links in the chat over there Um Yeah, that's a big thing Let me just introduce you to Dr. Eric sack who's gonna take you through what we're about to do awesome well, good morning everyone and Good morning What's it? Oh, I was just saying good morning if I'm being the class for you. Okay All right, so we're gonna talk about functions today and I want to I think what I'd like to do is maybe start not only to to kind of go over functions, but also see if we can't Maybe integrate some things from previous units here to sort of start to bring things together a little bit. So You know the idea of a function in general Hopefully I hope everybody's at least seen something in mathematics where if you they showed you this type of notation Where you have some function of x like x squared or something like that Basically, there's a rule that says if I give you any x you take the number and multiply it by itself and you get another Number sort of from the function. So you're sort of like dropping in x in and then you're getting in f of x out And that's that's really pretty much what functions are right? So here's your here's your f of x So so for any function you have an input you've got the rule and What you want to compute and then you get the output so functions basically have inputs They have outputs and they they perform some operation of some some kind the intent is to and And why do you do that really is is to in some sense? If you if you're you know writing code for a living what what usually happens is is like you find yourself Writing chunks of code and they end up being appearing several times in in a program And it just becomes more efficient at that point to sort of package all those Commands up all those instructions up into a little box that we call a function And then and then you can call that function and and you can give it a name and and you're allowed to Do anything that you want with it. So in Python or any really any any any Any programming language for the most part there are built-in functions That the that the language kind of gives you in some senses as part of the package I guess and and we've talked about and and also you know methods I will get to talk about methods also methods are basically functions defined within within classes And we're going to get to object oriented programming So you won't hear me talk too much about methods But but most of what I'm saying is going to hold true for methods as well Although the syntax will be a little bit different because even last week we saw you you you type something some Variable name dot and then you give the method name So that's the syntax for methods is is similar to functions, but not not exactly the same anyway They're a built-in do they're built-in functions And I think I think when we were doing lists I may have shown you like the sum function for instance So that's a function where you drop all you could what you don't have to drop you could drop You drop a list in for instance for example a numerical list and it'll sum the values for you So the input is the list the output is the sum And and and that's and we'll get to the syntax and all but those those are built-in those are important and then the beauty of Of programming is is that is that you are the creator right? You're the you're the one who is given the construct so you can write Any type of of function that you want to those are user defined functions you get to define those You're the you're the expert you're the one who comes along says, you know I need an x squared function or I need to do this out of the other thing and then And then you throw the syntax together that allows you to do that. So It's very powerful And let's see so pop over here again and do that And I should be so let me do that So we'll come back over and so the syntax for defining a function. Let's just take that example. We just did The the definition line or the depth line Is you you you specify the name of the function? Maybe I'll I'll call the function x squared for instance And so you have to give the function a name and then there's going to be an input And anything that's associated with the inputs and functions don't always have to have inputs There could be no inputs But the syntax is you for in python you have to have a left parentheses and a right parentheses And anything that you're sending to the function is placed within those parentheses comma separated and those are what the inputs to the function will be And then you have to end it with with a colon. So that's a syntax for a function call What the plan is is that I'm going to have a function So that won't be a very interesting function, but a function nonetheless just to get the point across We're going to take a number and square it. Okay, and then we're going to and then we're going to return it And we'll see how to do that. So the definition line is use de app. That's that's a reserved A python keyword the the word x squared doesn't exist in python if you try to use the word x squared You get a syntax error because python wouldn't recognize it until we define what it is So I'm calling this function x squared and then and then again as I said before the input is is x and Just for the heck of it. I'll write it like this. You this is not very efficient, but I'll I'll do it this way Is I'm going to take x and square it and then what I'll do is I will Return y so so if your function is going to have outputs There must be a return statement that is going to send the the answer or answers. I mean depending on how it gets defined You know back from the function so And the indentation is critical It's key the you have to have indentation here to to say what's so that should be no surprise Python works by indentation. We've already learned if statements while statements for statements They all kind of work in in in some sense the same way for their definitions you you define The the programming structure that you want to use you put a colon at the end And then once you hit return you indent everything that's associated with that with that particular programming structure So again, not the most exciting function in the world, but maybe what we'll do is we'll set y equal to two and then We'll set z equal to the output. We could do it this way again. It depends on You know what what your What your goal is But so here i'm setting y equal to two notice these this we're back in main now. So I might as well even put put a little Comment here, maybe I'll say something like this of main is here something like that because The function is separate and distinct from the main code. That's why you have the definition line That's why everything is is being defined outside outside of main in some sense main is just running this set of instructions and I could go ahead and and print You know z at this point after it runs and you would expect that You would expect that after you square the number that you'd see Why you'd see a four on the screen and But the the whole point of writing the function is that it can be called again and again and again maybe this time what I'll do is I'll do it with y equal to three and You know, or maybe I'll do it with y equal to four. So so the the idea is that You're planning on I'm using the function over and over again and and really what you do is you you've created your own Personal command basically you've created a new a new python instruction basically and And that's you know, that's that's powerful. That's that's what makes that's what that's what makes programming so So powerful is you get to define Your set of user defined commands or instructions if you want to think about it that way and you can use it over and over and over again With with different values So you can see what happens is if we run this function these instructions will execute the values will be returned from the function and You can you i'm just using the variable basic z as a sink for the output And so there's an assignment saying basically it's saying whatever comes out of that function drop it into the variable z assign it to the variable z And so that's so so every time this is being called we're seeing we're seeing different values Uh be That's interesting. Oh I'm not squaring it. I'm not squaring anything. I am actually raising it to the to a power So there we go. Just for the uh, just for the uh uninitiated. Um, what would you you want to explain what happens? For the for for the chat not for me, obviously, I 100 understand what actually but we'll do that in a second Let's go back. So x squared is just x times x Right x squared is x to the second power So i'm taking x and when I when I want to when I want to square something I want to take a number and multiply it by itself That's what the exponent does x to the power two is x times x and and so I was thinking I was thinking both ways at the same time basically, uh, because you could you could write it like this Which is x times x now if we run it, we'll see the right answer You know, but but you could also say you could also do this if you want to use powers x to the power two, right? So so you could say x squared like that as well That would be a more faithful reproduction of what the equation I gave on on the on the white board was Is that I'm trying to compute x squared and that's x times x So so I kind of mixed those two together in my brain and then I wrote x x to the x power is what I was computing So what I put in two is two to the second power when I was putting in three It was three to the third power which is 27 and then four to the fourth power is 264 so on and so on and so on and so forth. So um That's kind of how that works. So that these are the right answers now. So so I guess first of all for for Computing powers you you have a number of different ways to to raise something to a power in the math We talk about the math module in the course and so there's actually a p o w Function called called pow math dot pow and and you can raise a number to a power using that Or we can take x and raise it to the second power or we can take x and and multiply it by itself So there's a number of different ways to achieve the same thing, but this this is not That is not x squared. Okay. That's not x where that's x to the x power Okay, so uh, so that's that uh, but so here's the deal and you should really think about this because I find sometimes when when teaching at the beginning the beginner level Students The concept of a function is is odd in some sense and and it shouldn't be it's like it's like when you're creating your own commands And we're executing commands sequentially so we start at line 11 Then we execute line 12. Then we execute line 13. Then we execute line 14 So so this is what's called sequential processing instructions are being executed one after the other after the other Okay, and then you get this and then you get this and then this gets executed and then this gets executed And then this gets executed one after the other that's the whole You know idea behind sequential processing is you just If there are no branching instructions, if there are no conditional instruction instructions Like what we talked about like with if statements and so forth You're just going to go on and and execute remember with if statements There are sections of code that that that will not execute because you basically jump over them because a logical condition wasn't satisfied so that's going back to the unit on on conditional statements, but When it comes to just if there are no conditional statements, then then you're just going to execute Instruction after instruction after instruction and and so so x squared the instruction x squared the function is like A python instruction now and so it's just going to execute. What's interesting Is you know just a little bit about how computer systems work is basically when you when you write this this when you execute this instruction This is called calling the function you call it you make a function call And what happens sequentially is that is that the processor in some sense leaves this code Comes up here finds this function x squared and then begins executing all the stuff that's in the function And then when it sees the return statement, it knows to go right back here It started it remembers basically that it was at locate at at instruction 12 line 12 And it knows to go to line 13 after the function executes. And that's a pretty amazing thing It's it's um You you you have to have something in your computer called a called a stack. It's called a stack based architecture But but basically the computer has to remember Where it was in order to get back to the program So it the the central processing unit literally jumps from here It jumps up to this instruction begins executing everything inside until it sees this return statement And when it sees the return statement, it knows to go directly back To uh instruction on line 13 And you know, I mean the print is a function does the same thing the print is actually a You know fairly sophisticated function You're you're dropping something in here and you're telling it to print it out to the screen There's a lot that goes on in the background to do that And then and then the cpu knows to go to knows to return basically to line 14 And then you execute line 15 and jump up here to do all this and then you jump to the And so so sometimes in terms of program control Students get a little bit confused, you know about the order of execution, but it's it's completely sequential And you it's a good way to think about your program is once you've written the function This is this really is like an instruction that gets executed in a sequential Fashion so that when you're done with this one you get to the next you get to the next instruction And that that's just the mechanics of how it works So it should become very natural for you to be writing functions and ultimately methods as well Because what what's going to happen as I said is you're going to have some Operation that that you want to perform and you you want to have it as as one single instruction It makes the code a lot more efficient And it makes it neater it makes it more readable In the course we talk a little bit later on I think it's upwards towards unit 10 just to distinguish between what's called object oriented programming And procedural programming when you're writing procedures, you know, you're writing functions Basically, you're thinking of you're thinking of your program in terms of of small units small chunks That and we'll talk more about this like a so we get to unit 10 But you're thinking about small chunks and you create functions to execute those small chunks And then they they become reusable, you know, you can use them over and over and over again So so functions are are very very useful There's no way that you can become a an excellent programmer without without understanding how to write them And they're not very complicated. I mean look how fast I I chuck this down on paper. Okay, so this was, you know, very You know very easy to do So I'll take any questions about about functions. I think I just want to make sure everybody understands the The structure of a function call there are inputs There's code inside the function and then values are returned And so that's how that works So we don't currently have any questions, but as usual, I'll just vamp and see if we get some mostly positive feedback Our our UX designer Ryan Was in the chat saying functions are cool so so We have that as a comment for you Do with that what you will But uh, yeah, I'm just gonna talk for another couple seconds about mostly nothing just to wait and see again If you want, you know, you can leave a question in the chat if you need if you have a question And also leave one down below. We'll uh get back to it if it's relevant Maybe in another video, but as of right now that seems like enough delay time for people to have asked a question So I'll just kick it back Okay, so what I'm going to do is I just thought maybe I'd throw out an example I think that that would be interesting, you know from a from a programming standpoint Uh, but it requires a tiny tiny bit of understanding of of discrete math So I'm going to spend about five minutes. Uh, just teaching a tiny bit of discrete math for this example um, but basically there's this greek letter capital sigma and uh And sometimes you'll see stuff like this when you when you read about computer programs like the sum from You say this sigma means some you're gonna sum something you're gonna start adding a bunch of stuff And I want to bring this up because like I said, this will help tie together You know the basic for loop that stuff that we were doing maybe last week or the week before But if you if you're planning on summing some things and you've got a lot of terms like like 100 terms And you wanted to write them all out Just like the for loop makes the for loop makes your code efficient for summing a bunch of items The sigma sign does exactly the same thing on paper Just makes it much. So if I said the sum from i equal one, I'll take a small number But it make believe it was like a million, you know Then I'm going to make it three though because I'm not going to write down a million elements And maybe I'll say oh, I want to sum the elements from i starting at i equal zero to i equal three Well, this this translate unravelled unpacked unpackaged that sigma sign means this whatever value of i is You just sum it to the previous value. So this is very very much like a for loop In fact, I would say that if you ever if you ever see a sigma sign In something that you want to program up you could almost you could almost You know conclude like probably about 98.5 of the time that you're going to use something like a for loop to implement that Like an equation let's say But I want I want to you'll see where I'm going with this in a second I just want to get through this notation or if I if I said something like this the sum from i equals zero To and that's how to three of let's say i squared Right i squared then it's going to be zero squared By the way, this is everybody cares But I think you all can do that problem. Uh, so and one squared plus two squared Plus three squared like this, you know, again, you can see how this notation could be helpful If if I weren't just doing like the sum from zero to three You know if I if I were doing the sum from zero to a thousand this equation would get like ridiculously long And so so so the reason that we we pack it up in this Is that it just makes it more efficient, you know, you don't want to write everything out like that You know that just gets too too difficult, you know um, or If you have something like the sum here's another one like the sum equals zero To three of let's say two to the i-th power. Let's say so this is going to be like Uh, I'll make it minus cycles. I will make it converge um, let's say two to the minus zero plus two to the minus one plus Two to the minus two Plus two to the minus three. So what's happening is that as as the i varies From zero to three you're counting by ones. Basically. I'm telling you where to start counting I'm telling you where to stop counting and we're going to we're going to assume we're counting by ones Unless unless there's other notation in there to indicate otherwise So the sum basically tells us how to count and then there's some term inside the summation sign Inside the sigma sign that tells us the rule Okay, so here the rule anything to the zero's power is always one Anything to the minus one to the negative power is one over that. So that's like one over two to the first This is like one over two squared Just to remind you of negative powers one over two cubed, which is eight So so you get a sum that looks like that. So notice, I mean this This doesn't look anything like this But but you have to kind of get used to working through the rule To to generate the series of terms that you're going to sum together But when you see something like this, okay, you automatically think for loop I mean you would program this up or i'll say it in words because i'm going to assume everybody understands that material from the previous week it you do something like for i for i in range four Right because you get a count from zero to three it has to be in range four And then you would just compute a partial sum of two to the minus i And you would just sum those together like I showed you how to do the running sum with with the for loop And uh, I I suppose what I'll do is I'll write the code for that. Let's just do one really quick. I guess Rather than say it. Let's just do it. Um, and I'll write a little function and I'll call it Uh, I don't know what let's in fact. I'll leave that one there. Let's say we'll define. Um, you know to to to to to to the I And then I'll drop in I'll drop in a variable. I'll call it capital n And uh, I'll say two to the i or two to the n. I don't know You know Let's let's do some I'll call Two to the i or something like that. Um, and uh, what I'll do is I'll set a sum equal to zero and then we'll say for Uh, for i In range and you know, it's so funny There's just so many things. Um That Would go into this like um I'm gonna send it and I'm gonna sum from sort of at three So so if I do this, I won't actually add one to it And you'll see remember because the range can always counts to one less But you know, you know, what's funny is I love it students are so accepting and sometimes because uh The uh The in in range I haven't really even it's there because it's actually a set operation We haven't talked about sets. We're going to get to that next week But you're all accepting of of the fact that the range is going to give us some type of a set That uh, is going to have the numbers counting from zero to n basically, which is what we want So I could say like s plus equals Two To the ith power and if I do something like this this this really honestly goodness is the implementation of You know of that thing that little animal that I wrote down over on the board over here So if I if I do something like this if I'm sharing this again just to write it down again Yeah, to say for i equals zero Let's say Two to three what i'm doing is i'm going to send this variable n which is the number i'm going to send the number three And then we'll go ahead and add These partial terms together using a for loop. So this really will be you know one plus One over two to the first power plus one over two to the second power This is really just I don't mean to freak anybody out with a little bit of discrete math But but you know, this is the type of stuff that you're going to see when you're programming, you know So you might as well, you know, I think this is a good thing to know And I feel like it enables me to teach you functions using for loops, which we taught a couple of weeks ago so I think this is a good example and And and so we're going to take these terms these these terms and sum them together in a in a for loop So so this is what we're doing and this is this is actually the code That will implement this if I can call this correctly. So so what I'll do is I'll set I'll do it all in one line. I know before I was I was separating out Variables and so forth. But what I'll do is So the assumption is that we're going to sum two to the i For that maximum value from zero to three In this case, that's why i'm adding one to it because because I want to count from zero to n And remember the range function is going to go one less than the number that I specify So i'm specifying n plus one. So notice i'm sending the number three Which says count from zero to three So my loop is being set up to count from zero to three And uh, and then what i'm doing is i'm taking these partial sums these partial terms Remember how the for loop works is if you if we sum values, we're doing this every inning So in in the zero thinning, you know, we have two to the zero in in the uh, oops, and We're not doing two to the i by the way. We're doing We're going to do two dot dot Minus i just to be clear about that. Okay That's that's what we're doing. That's what we said we were going to do over here When we sum these values together. It's two to the minus i um So to be faithful to what that that we what we wrote there And then the loop now is going to take these partial values and every time we go through the next loop We're going to add the two to the i term for i equals zero And then the one for i equal one and then the next one to the partial sum For i equal two and then the next one for i equal three And if and then the last thing that we want to remember to do is after we have this value We'll have the final sum after the after the loop runs And we will return that value. Okay So so this is you know, the function is more like a contract, you know, you're saying That that these are the input values and then i'm going to use these input values in this way to compute something And then I promise to return this value s to you, you know, so so you have to expect that there's going to be an output Whatever that output is You know, i'm going to just drop that in i'm gonna i'm going to go ahead and print it So if everything works, okay, then what i've done is i've summed One plus a half which is one point five plus a quarter Which is a point two five and that's one point seven five and then you go ahead and get one to the one over eight And now you're at point one two five and you add that and you get One point eight Seven five so so this is the right answer It seems to be and you could you could check this on a calculator You can you know test it you could easily go into a calculator and add one plus a half Plus a fourth plus an eighth and demonstrate to yourself that this really gives you, you know, the right answer But the reason the main reason i'm choosing examples like this today is because uh, I want to immediately begin applying concepts from previous units in a way that that That sort of brings everything together After this unit, you know, we kind of go off on a a number of different I would say more sophisticated Aspects of python, but I think units one through five you'll find are very consistent with The way most programming language courses work. There's always a discussion about loops. There's always a discussion about conditionals There's always a discussion about functions And so I think this is a very sensible point like halfway through the course to to try and Tie everything together And what you need to have the ability to do is to be able to take these structures and plot them into functions And and be able to sort of play around with them and they feel very comfortable making Function calls to to compute stuff So this is just like I said, it's just i'm summing That's what the function is doing. I'm summing two to the ith power in this case. Okay Any questions about that? So that yeah, we we did have we have a question here. Um, uh front Henry gay About recursive functions Yeah, we um We don't talk a lot about recursion in the course And is it so I'll just I'm sorry. I'll just paraphrase.  Sorry, but um, uh, so I guess Is it different in python than in other coding languages? um I think python affords one A certain measure of convenience that I think other languages might not when it comes to certain You know recursive structures Because you can you can write some really interesting return statements. I think with with python so for instance, um You know just as an example if you were going to make the attempt to make a recursive call uh You know for a For like a sir a linear search through an array Uh, and the the way that you sort of break the problem up Into its recursive pieces Um, it's very convenient to like integrate slicing A list slicing into a solution like that and you really You can't in certain in languages like maybe c or java you wouldn't have that Albeit it's possible, you know, and of course you can write code to do it I think with python it becomes much the code becomes a lot more compact um And and much more reflective because of lists and slicing it becomes much more reflective of uh of what the recursion is actually doing Uh when it comes to you know, sort of breaking a larger problem down into into a bunch of smaller problems but I think outside of the syntax, I mean recursion works exactly the same way because uh, you know recursion is recursion you the the the uh You have to you know, have a stack-based architecture. You have to um, you have to have a base case so that you don't make An infinite number of recursive calls And so In all that pretty much stays the same But I would it's interesting to compare like the implementation for instance of like For instance a binary search how you would do that in a in a java or a c versus uh versus a Python that I think python actually gives a much more elegant looking Solution simply because of you know, how lists and slicing work. It's it's it's much it's much nicer I think anyway But you know, it's it works the same way. So I mean we could I could do You know, we could try a simple Like a Fibonacci or something like that if you wanted to do Like it, you know an f of n is equal to an f of n minus one plus and f of n minus two This is a typical type of you know, introductory recursive type of an equation and like the um So this would work exactly the same way you'd end up with like a return just as an example You know, you'd end up with a return Statement that would be like if you called the function Fibonacci or Fibonacci just to make it sort of Fibonacci You know, it would work almost exactly the same way, you know as as other You know languages, but They're the one-to-one translation. I think You know, if you had your function Fibonacci that was adding together This is what a return statement would look like in in Python Uh, so you know, this this these types of A single variable recursions, you know, unlike Recursive equations or difference equations I don't think there's much difference between Python and many other languages But I think when you get to more You know search types of questions and sorting types of questions you would find that the The implementation is is a little bit more elegant. I think then Then what you would see for for typical languages that don't give that don't give the list Slicing so I hope I'm answering that question. Um, I hope so. Yeah, I think I saw a thank you I think in the chat. So I think I think I think we might have got it So I think we need to probably move on to the probably the next bit. Okay. Okay. Sorry No, no, no, it's okay I'm just you know in the back of my mind. I'm thinking whether or not I just it's just I I'm going to stay focused on this. I I was almost tempted to like quickly write a Recursive program, but I'm trying to I'm trying to stick to what's in the course like it's an introductory programming course and and My recollect we don't we didn't go into recursion for that introductory Course, but you know, there's a place for it in introductory courses and You know, it just for some reason that that didn't we had enough I think enough material with the 10 units to to not do that and even as that question comes up now, I almost I almost I'm thinking, you know, that that might be an interesting addition to to this unit But I want to stay focused on on what's in the course, you know Because I just I was almost tempted to write it was like a recursive program and then but we don't go into it in the course So it's like Maybe we'll come back to it. You know All right Anyway, so um, so let's continue with this the summation business because I wanted to I wanted to show you what it's something that I thought was kind of interesting Would be interesting if we understand the summation notation that do not do not do not do not do not Freak out on me here. Okay. I'm gonna I'm gonna I'm gonna write this out Okay, I'm gonna write this out as the summation. Let's say from i equals zero I'll choose three again because it's finite math. This is just discrete math It's just basically addition Subtraction and maybe raising things to a power. I got to show you one little function and speaking of recursion by the way I'm going to show you The factorial function and and I think we this this we do talk about in the course because I think I give a loop example That uses the factorial operation, but n factorial is just start at the value n And then start multiplying numbers all the way down to to one So three factorial is equal to three times two times one and four factorial is equal to and you could You know, I think I actually think I give A question. There's a quiz question I give on factorials And but again, it's done iteratively. It's not done recursively because you could do it recursively as well Uh, but anyway, um So so that's all if I if I say something factorial you just basically take the product of all the numbers up to that number And uh, again, you could you could easily I'm going to assume that everybody could write a loop to do this Because because this would be something that you would you would have learned in the loop section Of the course when we talked about program control The only thing you got to remember is so one factorial is equal to one You know two factorial is equal to two times one, which is two And uh, the only thing you got to remember is that zero factorial is defined As one so the factorial function is defined over over integers positive. I'm sorry, non negative integers Um, and it's it's generalizable. I'm not going to go into there's something called a gamma function Which makes which sort of takes this discrete version and makes it continuous And there's there's something from that can be derived to to compute something called sterling's approximation Because this this n factorial really grows fast. It blows up like like really fast and so these numbers get large really quick Um, and so there comes a point where it doesn't become sensible to do it within to drop Operations anymore. You want to use floating point operations that approximate what that big number will be And that comes out of something called sterling's approximation But the point is is that just take my word for it. This is a good. This is a good definition So zero factorial is defined as one Uh, and so so one factor is one two factorial is two three factorial is six Four factorial is 24 five factorial is five times three times four 120 so on and so forth and So, uh, the reason I'm showing this is because I'm going to show you a formula And what we're going to try and do is we're going to try to build the function the time we have left Together the function is this I'm going to take minus one I'm going to raise it to the i-th power And then what I'm going to do I'm going to this is actually going I'm going to call this a function I'm going to call it f of x which means I can drop x's into this and it's going to give I can drop a whole bunch of x's any x I want to and I'm going to get an answer out And I'm going to raise x to the two i-th power And divide that by i factorial And so if the first thing that we want to do Is excuse me is evaluate each term It looks this looks really nasty if you haven't seen stuff like this before but I don't need to be afraid of stuff like this It's not hard It's just discrete math where you're summing a bunch of simple terms together Depending on what the value of i is in this case. We're actually dropping an x in as if this were a function So if I if I do the if I do the zero terms set i equal to zero and just anywhere you see an i You plug in i equals zero. So that's i to the two times zero and that's over Zero factorial. Okay, and then we'll take minus one Because we're we're we're programmers now. We shouldn't you shouldn't shy away from stuff like this It's not it's not hard to do and and honestly if you do program a lot you're going to uh, you're going to see this stuff Quite a bit, you know as you get more sophisticated Plus so why not why don't we do a little computer science together just a tiny bit? Okay, plus this square when i is two it's x to the two times two divided by two factorial and then if if i is equal to three Then that's the that's the i equal three term It's going to be minus one wherever you see an i now for this term you put a three And then it's going to be two times i which is three and it's going to be over i factorial Which is three okay, and I'm going to tell you something right now. There's something called a taylor series and and if you're like if you're press a function on your on your Calculator, maybe we're taking like trigonometry in high school and you had to compute like a cosine function And and i'm sure nobody ever asked the question I wonder how they compute that because the cosine is just a theoretical object, you know, it's just the if you have a triangle It's just the ratio of you know this distance If you haven't had an angle theta the greek letter theta is what used to use for angles go back to high school trigonometry You know if you take x and you have a radius r it's it's just x divided by r. That's what the cosine is and and so You have to have what's called the numerical method for computing this you can't The and also it's it's a transcendental function. It's like it doesn't In principle, you know a lot of values that you compute for the for the cosine function Theoretically the numbers go on forever. They never end, but the computers are discreet, right? So you can only process an approximation to that to that number Well, i'm going to tell you that this function right here. This f of x is approximately equal to the cosine of x And i'll evaluate this in a second, but you can see this term anything to the zero power is always one so So x to the zero zero this whole term Minus one to the zero is one x to the zero is one zero. This is one So that this nasty looking thing where i'm taking this number and raising it all to all these powers It's just one minus in the next term minus one to the first power is negative one So you'll actually get negative one times x squared Over two factorial And then you'll get the next term is minus one squared minus one times minus one is positive one. This is x to the x to the fourth I'm sorry. This should be two times two times this Two times that and two times that sorry about that So this is going to be over two factorial And then what's going to happen is is the next term is going to be x squared over two factorial and Then here you'll get negative for the next one This is the x squared term. Now you have an x to the fourth term plus x to the fourth Over four factorial and then you'll get minus for this term minus one x to the Sixth over six factorial. If you work this out if you work this this term out, okay? What's going to happen is you're going to You see daisy put that in there like that Um, what's going to happen is this is what you'll end up with you're going to end up with f of x Is equal to and and I encourage you to do this. I really do this is and it's if you you can look it up It's called Taylor series. I'll just do three terms And it's a Taylor series for the cosine function. I'll write this again x to the two i So again, this could look like a complicated animal And I'll put this in parentheses So the point is though when you get done with it looks like this one minus x squared on two So it's called an alternating series with even powers it alternates plus minus plus minus plus minus Okay over four factorial Plus i'm sorry minus x to the six over six factorial And and I and like I said, I encourage you to to uh, you know to look this up Because my claim is that if you take an infinite number of terms That this will be equal if you go dot dot dot went on forever. This would be equal to the cosine of x Okay So what i'm going to do now in the last few minutes that we have is we're going to write a program We're going to write a function to compute this and then i'm going to convince you that it's actually equal to this And i'm going to show you how i'm going to do that. Okay What we'll do is we'll define a function and I'll call it cos A prox and I'll send in a value x. Sorry. I'll send in a value x And then I'll send in the number of terms So I want to compute in my sum on the whiteboard. I used three terms from zero to three But now what i'm going to do is i'm going to i'm going to create a sum Set s equals to zero partial sum. We'll have a for loop and again, it's the same game. We're going to have i in range in range Let's say n plus one. Okay, we'll take it out to you know that value again So nothing changes in this code right here It's exactly like what we did for the two to the i and then we'll have like s plus equals And we're going to have this term. Okay now in order to make this work There's a point where we introduce the math module and I think it's somewhere around The it's right about now. It's actually it's right about now That you've seen the import command where we import a module where we can do some where we could do some math And then I introduce, uh, you know raising numbers to powers trigonometric functions and so forth and uh and factorials so um So in this case we can write something like this. We could say, um maybe like this minus one to the Ith power Okay, that's the first term the second term now we multiply by x star star Let's say two times i like that Okay, so that's the second term in the summation that we come back over here I'm trying to implement This and so you have to get the first term minus one to the i'th power And then you have to get the x to the two i'th power and then you have we have to divide that by The factorial of two i okay, so we need three terms in that summation. Okay in that part in that partial sum Uh, and so if you come back over here, uh, I've got the first term minus one to the i'th power I've got x raised to the two i and then I'm going to divide this by watch this in slow motion now math Dot so this is a method that I'm calling within the math module. It's the factorial method And I'm gonna I'm gonna put two i in here as well Okay, and then what I'm gonna do is I'm going to Return this let's say okay um Get this guy out of here return return s Okay, and so what I'm going to do now is I'm going to call cosine approximation and oopsie daisy That's a That's replete that wasn't Um, and I'm going to call these functions I'm going to call the function with these values and I'm going to set I'll set x equal to You know some special angle will set it equal to zero and the cosine of zero degrees is always is always going to be one So that's an easy check and maybe we'll take like Four terms we'll let n equal four in this or we used n equal three so we'll use n equal three and I'm going to call this function with these values and You'll see over here the answer that gets printed out is one So at least for x equals zero the cosine of zero degrees. We're getting an answer of one so um the the But I think the most important question is you know if I if I use the different x like maybe if I use Like your special angles if you remember 45 degrees in radians again go back to basic trigonometry Is is pi divided by four So math dot pi there's actually a pi in the math module divided by pi divided by four is uh Is 45 degrees So if we go ahead and run this then we get something that looks like 0.707 That's one over the square root of two That's that if you go back like I said in review You'll remember that that the cosine of 40 there were special angles that they wanted you to remember and one of them was the cosine of 45 degrees And the cosine of 45 degrees is one over the square root of two which is 0.707 So it looks like this is approximating Potentially the cosine of an angle now watch this though This is the most important thing is that if we really really wanted to know if we were approximating it You'd want to you'd want to compare the um, so there's an abs function. It's built in in python Which is the absolute value the cosine of x Minus watch this in slow motion now the the cosine of x Minus the r approximation we want to see if we have a good approximation going on okay So what we're going to do is we're going to compute the difference between oopsie daisy math Dot cosine okay So we're applying the math module to compute the cosine of x and then we want to say we're going to say compare this value The value that you would get from your calculator Compare it to this approximation this what's called a series approximation or a tailor series approximation to the cosine of x And we drop this x and and we're going to compare them and we're going to see what happens So what did I do wrong here unexpected end of file? Oh, oh, did I do something down here? No, that's good. Oh, uh, that is the difference between that and then sorry there we go I could have told you that yeah You know what it's it's it's that um Replet is a little frustrating because it like it tries to finish lines for you And sometimes it'll put in stuff there that you never meant to do and it's what anyway But watch this now. So now the difference the difference between The cosine function that the math module computes and the one that we just constructed through this series approximation We're good to about six decimal places. They're actually very very close If we take more terms if I go ahead and take more terms like let's let's go ahead and take 10 terms now So that summation would go out over 10 partial sums partial terms 10 terms Which is a which would give us a better approximation. Let's go ahead and see what happens here Now we get a better approximation out to 16 decimal places So so it looks like this function that we've written actually approximates the cosine function And again, I don't need to go into all the details of where that equation comes from If you ever taken a calculus course, this usually gets brought up in like a calc one or a calc two type of uh, when you talk about what are called infinite series But that's you know, we don't have to go down that path because we're cutting our series off because we do discrete math computers Only compute a discrete number of terms So the reason I'm showing this application because I think it's a really good aspect of numerical methods Of of of how a computer computes Functions using these these finite series. Basically, that's how it does it May not necessarily use this one that there are more efficient implementations, but Of the let's say for trigonometric functions or cosine functions But but the general idea Is that is that you've got a host of functions either on your calculator or within the math module And the question is how does how does a computer compute those things? They pretty much use these series kinds of solutions to Compute to approximate pi to to do anything really um, and so this is one example of approximating the cosine function and uh and so Then you can test Whether or not it's a good approximation or a bad approximation. How do you do that? Well, you you use python's cosine function You compare it to your cosine function Compute the absolute value of the difference take the difference between those two answers Take their absolute value and then and then see if that's getting smaller as you take more and more terms So hopefully these two examples are tying together stuff that we did with loops and for loops and and uh Computing partial sums and that summing function we were talking about and and sort of integrating those now Into callable functions that you could use over and over and over again Um, I think I think if you walk out of today's lesson, you know understanding all of this you'll be well well primed for the uh the second five units But this is really again, there's there's a difference because you hear me say this over and over again There's a difference between memorizing syntax and applying it to write actual programs that solve problems In this case, you know, we we're applying syntax and so I'm talking to you as if you're experts with for loops now Uh and experts, you know on on various modules that we've introduced within the course Uh, and now we're trying to apply them to in this case make a certain kind of a computation. So You know, I hope that that ties, you know, this aspect ties together really the first five units Of of what's been done in the course So that we can kind of take a a breather and then go. Oh, okay. Well, I put all this together into this example Now let's move on to the next unit to do even more interesting things So that's just an example. I thought of I thought maybe it might be helpful to see, you know, this stuff integrated with previous material That's about all I wanted to say for today Oh, well, that's great. I just uh I want to Before I reiterate to everyone that, you know, this is part of the python course is unit five. You should definitely go back Uh, we have other videos that are recaps of the unit, but you should go to sailor.org cs105 and start learning python Replet is the program that you are using to To show everyone how to do it Um But while we wait to see if there's some more questions I just want to ask you because you seem great. So I was thinking while you were talking about I can do 3.14 159 Of pie how much pie do you know while we wait? Oh, no, you know, I never I never did that exercise I never really memorized a lot of those digits. Um I suppose I should, you know, but I I just never did, you know It was never my thing for some reason some people like, you know, you get to oh, I can I know All right, whatever. Okay. Well, it's just one of those things where like You're just like, oh, everyone knows the square root of whatever's whatever and I'm like, oh, you must know what pie So do I know more pie integers than you? You know more pie digits than me. You do. Uh, great All right. Um, so everyone we'll be back here next week. Uh, march 10th 938 m eastern time Again, uh, check the comments below. I'll put it in the chat again This is for our python course and definitely if you haven't caught up with us, um catch up with us We've we've done Four other of these videos that are all related to the course on sailor.org should catch up Leave a comment on an old video. I'll look back and see if we can answer that question Maybe in a newer video and as always, uh, Dr. Eric Sack, you're the best. You teach it like nobody else. So thank you everyone and uh, we'll see you next week