Good morning, everyone. Next talk is by Antirek. Antirek, the stage is yours. Thanks, Vipul. So, good afternoon, my fellow Pythonistas, and I'm assuming everyone can hear me. So good afternoon, my fellow Pythonistas. Welcome to my presentation on revolutionizing the web with Python. So, the agenda for this talk includes an introduction to Python, an example of Python in the browser, and of course, Python under the hood, and lastly, comparing and contrasting JavaScript in Python.  So, who am I? I'm a passionate tech enthusiast who loves software and enjoys learning new technologies. I'm a professional full-stack Django developer with over two years of experience in Python. So, let's take a look at an introduction to Brython. So, first of all, what is Brython? So, Brython is this JavaScript library, and yes, it's a JavaScript library, right? It's a JavaScript library which trans-compiles your Python source code, which you write, right? And it is this implementation of Python 3 in the browser. Now, most of you would have questions that how do you actually write this code? Where do you write this code? And how do you trans-compile it? Like, is there a CLI tool or is it built in the browser? Well, I'm going to answer all that questions later in the presentation. So, now it is this JavaScript library which runs Python, allows you to write Python code and trans-compile it and run it in the browser. So, why Brython? Why don't you just use JavaScript? Well, Brython, because, first of all, you have access to Python and its friendly syntax and who doesn't love Python, right? And, of course, to use Python for numerical computations, right? And then, of course, for many JavaScript problems they can be avoided like global variables, function scopes.  Like, you've got let keyword, const keyword, var keyword. What's the difference between all of them? And the most annoying thing in JavaScript is the difference between triple equals and double equals. I mean, what does it mean, right? If you're writing an ifs statement, it's just impossible to work with triple equals and double equals. And I know many JavaScript developers out there agree with me. So, let's take a look at some previous attempts at Python in the browser. Right? For those of you who are thinking, well, maybe Brython is the only one? No. There are many more, but I'm just highlighting four of them here. So, the first on our list is Piodide by Mozilla. So, Piodide is, I think, the best known attempt out of these four because it was an experimental project by Mozilla to create a full data science stack in the browser. Yes, I repeat, in the browser, full data science stack for Python. And of course, then there was Sculpt, right? Which is a JavaScript implementation of Python 2 in the browser. And yeah, Python 2. No one likes that. And then there was PyPy.js, which is basically a JavaScript library which runs PyPy source code for those of you who don't know what PyPy is. It's this Python implementation aimed at making Python faster. So, it's basically Python, but much faster. And then there's Transcript, which is a CLI tool which allows you to run and compile Python to JavaScript. Now, this is a graph of an insight into Python in the browser. It shows you all the different things we talked about here. Let me get the pointer. So, all these which we talked here. So, this graph shows you basically all those based on their compile time and how they work. So, the first thing which comes to mind is this is one group. This is another group, whereas Bryson alone. Well, this alone, this uniquely less, uniqueness in Bryson is what makes it, I think, the most successful Python attempt at Python in the browser. Yeah. So, as you can see, these are ahead of time. This compiles on-page load and this compiles after-page load. So, Bryson, we're going to see how this on-page load compilation time affects Bryson and its effectiveness in Python in the browser. But for now, it does not mean, right? This graph shows you different compile times and different Python in the browser attempts at Python in the browser. But this does not mean that Sculpt or PyPyroGS or PyOdide were failures. No. This shows you that PyOdide was... This shows you that these are not that effective in the browser. But in a general case scenario, Bryson is, I'd say, my preference. Bryson would be my preference at an attempt at Python in the browser. But if you, of course, want to use something for data science, then PyOdide would be your go-to. If you want to run PyPyroGS, then PyPyroGS would be your go-to. So, this does not mean all these attempts at Python in the browser do not mean that transcript, Sculpt, all these were failures. No. They just mean that they are useful in some other scenarios. So, let's talk more on Bryson. Let's get back to Bryson. To get started with Bryson, you can use the CDN, right? Or you can install it on a local machine using NPM or PyP. But for the purposes of this talk, I'm going to use the CDN. For those of you who want to use NPM or PyP, you can refer to the Bryson documentation. The Bryson official website is Bryson.info. So, let's take a look at an example of Bryson in the browser. This, I think, is the most awaited thing of the talk. So, here, as you can see, I have this small web application, small web thingy. So, as you can see, I've got these buttons. I've got this Save Jokes, right? So, what this does is that this is the random programming jokes generator. So, I can click on this button and it's going to generate a joke for me. Yeah, so it did. So, as you can see, it takes some time in the first time and it generated that joke for me. I can save that joke. Now, it does not save it and show you in real time, but I can reload my jokes to see it's still there, right? It's the same thing. Why did the JavaScript heap close shop? It ran out of memory. I don't get it, but it's still the same thing. So, now I can generate another joke and you'll see this nice loading effect, right? You see that in, for those of you who know what Ajax is, you see that in asynchronous JavaScript and XML applications, Ajax applications, for those of you who don't know, there's no, you don't need to necessarily know it, right? But it's good. So, again, you know, I cannot save, you know, if I don't want, I can also not save this joke and generate another joke. So, this is basically doing something called as Ajax, right? Which I told you about. So, I like to call it abax, because this is asynchronous Bryson and XML, right? Because all this is Bryson code. And to show you what I actually mean by that, I can go to elements. As you can see, I've got a bunch of code here. Like, these are, this is HTML code. But here in body, if you'll see there's this onload is equal to Bryson. So, the first thing that's going to catch your attention is what is this onload is equal to Bryson, right? So, this is the Bryson function, right? Which we're going to take a look at what does this mean, right? What does this represent? What does this actually allow you to do? We're going to take a look at that later, but for now what you need to really see is this, right? Now, I know what you're thinking. There's a script tag. And first of all, that script tag has a type of text slash Python. Second of all, this code is not JavaScript, because what goes inside a script tag is JavaScript. I know that. But since I'm using Bryson, I need to specify type of text slash Python, and I can then write this JavaScript code. It's that simple. I can create a script tag, write type is equal to text slash Python, and write in all my code. So, you can see it's Python code. It's pure Python. I've got the Python import statement, Python def keyword functions, right? Now, I know some of you would be amazed. Some of you will be like, okay, this is cool. So, as you can see, I've got CDN. So, as I told you in the Bryson introduction slide, that this, how you actually write Bryson code is by writing it in your normal code editor, as you would do. And then you copy the CDN links, right? You can get this from the Bryson website as I told you, Bryson.info. And from there, you can copy and paste these CDNs, right? And what you can do is specify this onload function of Bryson, and we're gonna see its significance in our code. And then you can write your normal HTML and go ahead and make a script tag with type of text slash Python, right? And write in your Python code. So, we're gonna take a look at how do we write this code? What does this code mean? What are the Bryson functions? What is this browser module, right? And then, of course, we've got this file here, localStorage.bry. I know many of you are thinking, what is this file? Is what this file is? What is this file? What is this .bry extension? Well, some of you may have known, may have got the answer, .bry represents Bryson. And on the Bryson.info website, it says that the official Bryson extension is .bry, right? So, for those of you who had that question, it's a .bry file. And I can simply say script, again, type text slash Bryson, and make source localStorage.bry. And I can actually convert this to a .js file. I can just do that. It's that simple. It will still work. I already tried that. It worked, right? But let's come back here. Now, another thing I want to show you is quickly, is this. You might think that, okay, this saved my joke. But what if I refresh my website, or close my window, close my tab? What will happen then? Well, this is your answer. It will still save your jokes. How does that happen? Well, some of you would know the answer. Some of you won't. For those of you who know this, we are using local storage, right? Those of you don't, we are using local storage.   Open your DevTools. And then go to application tab. Application, it would be somewhere here. And then you'll see something like this page. Click on this dropdown. Get this. And you'll see this beautiful key value pairs, a table kind of thing, right? So this is the local storage. Local storage is simply your in-browser storage, which allows you to save some key information in your browser, right? And this allows you to save some important information, which you'd want to reference in your websites. So I'm using local storage and local storage saves those information in key value pairs, right? So what I'm doing here is saving it in the key of ID and value of the joke, right? And then I'm referencing it over here. We're going to look at how do we do, how we work with local storage, right? But for now, you just need to know we use local storage here. I can delete an item. Also, I just press the delete key for those of you who were wondering what did I do? Reload that. Boom. Gone. It's that simple. Now I can also do something like, why did the... I can keep close shop. I don't understand that. Let's reload that. Boom. It's Python now. So there's basically local storage, right? It's some local storage stuff. I am not going to go too deep into local storage, but most of you may have made the connection between local storage and dictionaries. And yes, they have a connection. We're going to look at that connection and look at its significance in Brython. But for now, let's go back to our slides. Let's go back to the code that we are going to write, right? Right? So let's take a look at the code we're going to write. Woo-hoo. So selecting elements. Now, for those of you who know what the DOM is great, for those of you who don't document object model or DOM, you guys can research it. DOM is simply just this... your HTML document, right? That in a nutshell is the document object model, right? All of the tree, the HTML tree you have, that is the document object model. And there are... There's a lot of things that comes under this concept of DOM. So you can research it. But let's take a look at some DOM operations we can do with Brython. So the first one is, of course, selecting elements. For those of you who work with JavaScript in the client side, you know the selecting elements is the most basic DOM operation. So I've got two code snapshots here, right? This one right here. So this one right here is the Brython code. And this one is how you would do the same thing but in JavaScript, right? Because I'm just comparing and contrasting JavaScript right here. So I've run this Python import statement. You know, it's very Pythonic. You all know this code. Then I say data is equal to document in square brackets plus the ID of the element, right? ID of the element refers to the HTML element you want to select. The ID attribute of that HTML element, right? And then this code here, the JavaScript part, is basically how you would do the same thing in JavaScript using the get element by ID function, right? So this is essentially how you would select an element. Let's move on and talk about some more selectors because it would be a hassle if you can only select an element by the ID because what if you want to select all the elements with a tag or form, right? Then you'd have to give each form an ID and in large scale web applications it would be very tough. So we can use a select function which again from browser import document and we can just say document.select. Save it in a variable. We just select an element. So you can pass in any selector you want like .foo, hashtag container, a, square brackets, title, right? Pass in any selector. CSS selector, jQuery selector, normal HTML selectors which you have, you know, adding and removing classes. Now this is a very useful DOM operation, adding and removing classes. So what we can do here is this is how you would do how you would add and remove classes in JavaScript and for those of you who know JavaScript this is how you would do that. Now can you guess how you could do this the same thing in Bryson? Now for those of you who don't know just take a guess, put it in the chat because I can't read the chat but go ahead, put it, right? And this is how you do it in Bryson. It's exactly the same. There's no difference. You know, there's no difference. When I got to know about this I was not shocked but I was intrigued at how excellent Bryson is because it's exactly the same and in fact I just copied this code snapshot and just mirrored it and put it down here. I didn't have to do much work and it's exactly the same. So, you know, yeah, it's exactly the same so we have an element and then we have a class list and then we can say add, remove. So add and remove functions they are a part of the class list which is basically just a list of all the classes on this element remember this element is this, right? This data, this when we selected this element, right? This element refers to that and then we can just say dot class list, dot add and the class name which we want to add and the class name we want to remove, right? Then we can move on to creating and appending DOM elements this is another very important DOM operation which you would do, right? So, again, we want to run our handy import statement from browser import HTML, right? And then we can just say new development or whatever you want to name the variable is equal to HTML which is the... what we have imported right now we can say dot div and note here notice this div, right? This function div, first of all the first thing to note here is that the tag we want is in capitals the second thing is that the tag we want to create the element we want to create is being referenced as a function and yes, we have to reference it as a function and then we have to pass in the attributes we want in that element as arguments, right? So if you want this new div element which I want if I want to pass in a class of new divs so I can just pass in argument of new div and say class is equal to new div, right? I can do the same with ID pass in ID is equal to unique new div and appending an element is super simple HTML.li I just create an element because I need two elements or two participants in appending an element so I use this less than equal to sign and I put my new div element so this less than equal to sign just means that we are adding content because many people get confused what this actually about what this actually means because I myself have seen many Google groups many telegram groups and many people discussing about what does this less than equal to sign really mean, right? and really it's a hassle people are like why do they use this thing? well they use this and we can't negotiate we just have to use this so we just say less than equal to and our element which we just created boom we appended the element next the HTML module tags this is the HTML module right? so these are the HTML4 the HTML4 module tags right? you can see a tag and you don't need to remember all of them these are the normal tags which you would have in an HTML document most of these you won't even use like Q or S or SAMP haven't even heard of them so that's that you can find these on the Bryson documentation, Bryson.info and the HTML module tags for HTML5 these are the HTML5 tags and if anyone is asking this question that is this talk sponsored? no it's not I'm just making this talk because I want to it's not sponsored so adding and deleting items from local storage now this is what we talked about now here I'm going to first of all point out the significance between local storage and dictionary and how that actually works with Bryson and secondly I'm also going to talk about the importance of local storage local storage is really important because if you're on Facebook or any website and there's dark and light board or different themes you click on that moon button and it becomes dark that that works because of local storage when you go to your Facebook account you don't try this out if you haven't already go to your Facebook account click on your dark mode or light mode then go to your dev tools check it out in local storage boom it would be there that theme there would be like a key of theme and then a value of dark or light do this then you'll understand how local storage is used in what context it is used in what projects it's used so again we want to run our handy import statement from browser.local storage import storage then we can say storage and in square brackets pass the item key foo which is foo here and give it a value of bar for those of you who know how dictionaries work you know that passing in that this item our dictionary is going to check our storage and storage is basically our local storage dictionary so you can see how it connects how easy it is for working with local storage so this is the relation I was pointing out to the helpfulness and the ease of working with local storage so storage square brackets foo is equal to bar so for those of you who know how dictionaries work you know that it's going to check if there is an item if there is a key by the name of foo and if it's not it's going to create and give it this value of bar and then we can just use a del keyword and say storage square brackets foo it's that simple we just learned how to add and delete items from local storage you literally created half of what I did in my random programming jokes generator it's that simple another alternative for people who don't want to use this super easy method somehow no problem again from browser.local underscore storage just run that import statement and then storage.setitem setitem is a function it takes in two arguments foo and bar and it says ok setitem foo here is the key bar is the value and it sets that item creates that item and deleting that item foo from storage is super simple storage.removeItem foo again is the key here and boom that's it you remove the item so let's move on to the next part of this presentation Bryson under the hood this is probably not the most compulsory part the most important part but this is I think vital to understand because how Bryson works many people would have this question for such a technology so it's quite simple there's this transpiler or this trans compiler called py2js.js which is a JavaScript library which converts Python to JavaScript and Bryson uses this transpiler to actually transpile the Python code we write now to outline to sum everything up in a nutshell Bryson works in three steps and I'm not going to end my presentation here I'm going to explain these steps but the first step is the starter function Bryson so we we looked at that Bryson function here so this is compulsory compulsory so as you can see as resource and it's dependent resources have finished loading this thing so this basically means when your page loads when everything is loaded then we need to run the Bryson function right and what does this Bryson function do it looks at everything in this HTML page it looks if everything in this HTML page has a script tag in the script tag it checks if it has a type and then it checks if the type is text slash Python right if the type is we have four minutes remaining oh okay so just check that text slash Python great this is the Python source code right we just looked at this code great now let's move on then we've got then it reads the Python source code inside that script tag and then it runs in eval function which executes the JavaScript now I've written in parentheses avoids memory leaks on some browsers yes it does so when it executes the JavaScript on page load now I was talking about some benefits so I meant avoiding memory leaks on some browsers so this is vital because memory leak is basically when you don't collect all the unused variables which are now garbage right all the unused variables and they just take all that memory they just soak it all in and because of that there are memory leaks browsers can experience memory leaks so let's continue so let's talk about this second step in detail right so first of all there's this main script py2js.js which is the which basically has this py2js function which translates your source code and then there's this function which calls the tokenizer this function tokenize is inside the py2js function and what this tokenize function does is that it tokenizes everything so for those of you who don't know what a token is a token is the most basic representation of a source code so it can be something like an identifier a keyword a plus an equal to sign anything now this tokenizer builds a tree an abstract syntax tree an abstract syntax tree or ASD is just a syntactic representation of the source code a tree representation of the source code sorry so this tree is made of instances of the class node forget about this little dollar sign here it's just it has different nodes right and each instance of node is created for each statement this basically means that each statement we have here of code right each node is built for each statement that's what it means and for each statement or for each node in this case is a context right and then translation to JavaScript now this is basically this part but in a bit more explanatory manner so it's basically the same thing a tokenizer reads the tokens in the source code it passes them to the abstract syntax tree for the code and then based on the code it raises the syntax error or an indentation error and yes you do get those errors and then the tree is modified based on your line number and script name and then additional nodes are added based on that and then the transform tree supports a method 2.js which returns the JavaScript code now I'm not going to go into the comparison of JavaScript in price and like I was talking about the code here I had the code here but let's just talk about some features of Bryson and limitations so Bryson has an excellent DOM API we looked at the DOM API it has support for core Python packages and modules but those of you who don't know here we also imported JSON here and it also has support for JavaScript libraries like jQuery and ViewJS and PhaserJS and 3D and etc you know you can go to Python documentation it compiles the Python code right there in the browser as soon as the body loads which executes JavaScript and it increases its efficiency and of course it is still a developing library no one knows what can happen to it right no one knows what the output will be what it will result in in a few years and the main limitation which I feel the only limitation for Bryson is that Bryson is very very slow right it has some performance issues but that those performance issues are covered by the fact that it executes JavaScript right there in the browser and it increases its efficiency right so that in a nutshell is all about Bryson right there are many limitations but JavaScript is a much better language is a much better technology than Bryson which I can still say because JavaScript has a lot of support a ton of support and it has a lot of libraries which basically just increases over overlooks Bryson and it's not that Bryson is bad it's just that JavaScript has set a really high bar for the client side for client side scripting but Bryson is excellent for small scale applications for small level applications and that's it citations thank you


Welcome back to NPTEL course on game theory. In the previous session, we have seen some ways of computing the saddle point equilibrium for matrix games. Now in fact, one of the interesting property that we have used there is that if a player 1 is let us say playing his optimal strategy x star, then we are checking that the player again, we are checking essentially against the pure strategies of player 2. Now the whole another interesting thing is that do we really need to check against all the pure strategies.  Then the following happens some summation of a i j y star j j runs from 1 to n is nothing but v for all i such that x i star is greater than 0. Similarly, summation a i j x star i i runs from 1 to m is equals to v for all j such that y star j is greater than 0. That means when you take this what is this a i j star y j star and you are summing over all j. So, therefore, this is nothing but the pay of that player. Let me write it here.  Similarly, here it says is that pi x star e j pi x star e j is equals to v for all j such that y star j is strictly greater than 0. So, in fact, this is not difficult statement to prove because this in fact follows from that pi v is nothing but pi x star y star. So, if you really look at proof pi x star y star is nothing but v that is the value and what is pi x star y star this is nothing but summation pi x star e j where j runs from 1 to n and if e j is 0 of course there should also be a y star j here. If y star j is equals to 0 for some j then that particular term can be removed here and what you are going to get here is this is nothing but summation y star j pi x star e j where j such that y star j is strictly greater than 0 this is equals to v. Now, this is a convex combination of pi x star e j s a convex combination of pi x star e j s is equals to v if they are all not same of course if they are not same you look if something is bigger then that will be bigger than v that is not true because all of v is going to be there x star is optimality y star is optimal. So, this immediately tells me that using the convexity properties the bilinearity of pi and this is a convex combination what you have is that pi x star e j is going to be same as pi x star e l for all j comma l such that y star j comma y star l greater than 0. If whenever the probability with which those columns are chosen is strictly greater than 0 then the corresponding this is going to be same that is exactly what we wanted to prove it. So, this is known as an equal such a strategies are called equalizer strategies sometimes this is quite useful in solving this problem that what I mean is that computing an equilibrium. Suppose you can always try to find some y star satisfying such properties some y star x star and v then you can actually verify that a converse kind of result holds true. In fact this idea we have used in the early lectures where we showed that in the matching pennies game the choosing with probability half that is an equilibrium we have used that fact. So, you can go back to that video and see that and try to relate to this theorem that in that way you can also this theorem is also quite useful in solving zero sum games. The next we will look at it another very interesting idea of this games what is known as a symmetric games. The symmetric games are a nice set of games where the players have kind of a symmetric behavior. So, what exactly I mean is so whatever player 1 is trying to do the player 2 is also trying to do the same thing. So, let us say player 1 is maximizing certain utility and the same utility the player 2 also has and therefore you want it in zero sum game that means whatever you are trying to maximize I am also trying to minimize and several these things in particular in this setup what we have is that this a the matrix a should be same as minus a transpose that means this is a is a skew symmetric if the payoff matrix a happens to be a skew symmetric. So, let us look at an example the best example is rock paper scissors game we will understand this symmetry better in the this thing. So, there are three strategies 0 minus 1 1 1 0 minus 1 minus 1 1 0. So, rock paper scissors. So, the whatever player 1 is doing the same thing player is 2 is also trying here. So, whatever player 1 gets the same amount he is also getting under the similar setup. So, so both the players are trying to maximize the same payoff matrix. So, let us look at it the player 1 is trying to maximize this interest into this thing he chooses this one and player 2 is minimizing these columns if I he is minimizing this column let us say the column 1 if player 2 is minimizing this column that means 0 1 minus 1 that means he is maximizing 0 minus 1 1 minimization is nothing but minus of maximizing maximizing the minus of that. So, minimizing 0 1 minus 1 is nothing but 0 minus 1 1 and player 2 is choosing this column or he is basically looking at minimizing these entries 0 1 minus 1. Same thing if you look at it player 1 when player 1 is choosing row 1 he is actually maximizing these entries 0 minus 1 1 and 0 1 minus 1 here minimizing 0 minus 1 maximizing both are the same. So, the symmetric game is exactly that. So, what is the condition for this one? So, the minus of this row should be this row that is exactly this condition. So, if a is equals to minus a transpose we say that the game is symmetric. The symmetric games have an interesting fact. So, immediate thing is whatever in a symmetric game intuitively if you look at it whatever I am maximizing you are the same thing you are exactly in the same position you are also going to maximize the same thing that mean whatever I am getting you should also get the same. So, that essentially means that because it is a 0 sum game whatever I am getting should be same as what you are getting and the sum of both is 0. Therefore, the payoff that we get under an optimal play is 0. So, that is the interesting situation here. So, in fact we can write this as a theorem a symmetric game has value 0. The symmetric game will have a value 0 not only that whatever is optimal for player 1 is also optimal for player 2. So, let us try to prove this fact. So, what do we have? Pi x comma y is nothing but summation i is equals to 1 to m summation j is equals to 1 to n which is x i a i j y j. This is same as summation i is equals to 1 to m summation j is equals to 1 to n x i minus a j i by the symmetric property of this game. If the game is symmetric the payoff matrix is going to be a skew symmetric matrix y j. So, if you rewrite this one this is going to be y comma x of course minus. Now, here is few here are few things I have used m here n here. Remember because by the definition of symmetric game that is the matrix a is same as minus a transpose that means a the number of rows and number of columns are same m and n are same. So, that we have used explicitly here when I put y here and x here we are using this one. So, therefore pi x y is same as minus pi y x. So, that is basically the important fact here pi x y is going to be same as minus pi y x. So, whatever you are getting x and y let us say x and y is what player 1 and player 2 are playing then pi x y is same as minus pi y x. So, this in fact gives you the following fact pi x comma x is minus pi x comma x implies pi x comma x is going to be 0. If both the players are playing the same strategies we are getting 0. So, this immediately shows that the value of the game is less than or equals to 0 y if this comes easily what is the value of the game is nothing but max x min y pi x y minimum y pi x y certainly less than or equals to pi x y for each y in particular pi x x this particular term is certainly less than or equals to pi x x and this is 0 the maximum of that has to be less than equals to 0 and hence v of a is less than or equals to 0. Now, we have to use the symmetric argument now in a similar using a symmetric argument. So, for example look at the minimum y max x of pi x y now look at this maximum of this this has to be less greater than or equals to pi y y and this is 0 and minimum this term for each y is greater than equals to 0 therefore minimum of that is also greater than equals to 0 therefore this says the lower value is less than or equals to 0 this says the upper value is greater than equals to 0 and we know that the game admits a value therefore lower and upper values are same and hence value of the game is 0. So, this is a very interesting argument which gives you that for a symmetric game the value is always 0. Now, you can check the rock paper scissors game and then see that the game has a value 0. In fact, here is another interesting thing is that because you know that the rock paper scissors game is a symmetric game. So, therefore the value is 0 therefore you can look for an equalizer strategy assuming v is equals to 0 because you know the value. So, v is 0 you put it and for use the equalizing property of an equilibrium and then you can easily solve the best thing. So, that is an interesting and simple exercise. Now, what else is required? Now, we need to show that if x star is optimal for player 1 then x star is also optimal for player 2. So, how do we prove this fact? This fact once again comes from this thing suppose x star y star is a optimal what I mean is saddle point equilibrium here. Then we know that pi x star y star is 0 and now this is also same as pi x star x star. So, given x star if player 1 fixes x star y star minimizes and similarly by this equality x star also minimizes. So, therefore you can use any properties like equalizing or you go back to the linearity by linearity of the payoffs and other things you can now conclude that x star is also optimal. In fact, x star x star is saddle point equilibrium you can prove it without much difficulty. So, in fact this completes the proof but the way to visualize this fact is that this is a symmetric game that means whatever I am maximizing the same thing you are also maximizing.  So, this is quite a useful thing and in fact symmetric games play a very interesting class of games. In fact, there are ways to symmetrize a non-symmetric game. We will see that more later on when we go to the non-zero sum games. Now, we introduce an iterative method to solve the zero sum games. This method is known as a fictitious play. The method is introduced by Brown and the convergence proof is given by Robinson. So, fictitious play is an example of a method which is known as the learning methods what it says is the following thing. So, what is this learning particularly? So, there is a game that people are playing it. So, let us assume they cannot really compute the equilibria and other things. So, the only thing is that they are playing it. As they play again and again this game can they infer, can they learn the equilibrium what should be the optimal strategy for. So, this is basically the idea behind this learning algorithms. This fictitious play is one such algorithm. Let me describe how this method looks like. So, we have a zero sum game A and there are two players. So, the most important thing here is that the players do not make a mixed strategies. So, in other words let us say in the first time when player 1 is playing he does not know anything about the game. He only knows what choices he has and all. So, he will choose some strategy. Let us say a pure strategy let me call x1. This is a pure strategy. x1 is a pure strategy. So, player 2 will actually play a best response to x1. Once again he will choose only pure. So, he will look at y1 which is basically a pure best response to x1. He is going to choose another a pure best response. This is pure best response which is y1. Now, in the next round player 1 observes that player 2 has played y1. So, if he has played y1 what should he play? So, he will look at it x2 which is pure best response to y1. Now, in the next setup next iteration the player 2 observes that player 1 has played x1 and x2. Therefore, he thinks that player 1 will play x1 or x2 with equal probabilities. Therefore, he will look at the best response to half x1 plus half x2. Again he will only look at the pure best response. The pure strategy which is a best response to half x1 plus half x2. That means he is choosing x1 with probability half x2 with probability half. Then if player 1 the player 2 thinks that player 1 is going to play x1 with half probability x2 with half probability. Therefore, he will look at the best response corresponding to that. Let me call that as y2. Then once player 2 chooses this y2 in the next round player 1 will look at the player 2 and he has played y1 and y2 and therefore, he thinks player 2 will play y1 with half probability y2 with half probability. Therefore, he will look at x3 which is basically a pure best response to half y1 plus half y2 and it goes on like this. So, every time a player makes a decision he will look at the empirical behavior of other player what he has played how often he has played a pure strategy he looks at that then he forms an opinion and he plays a best response a pure best response to that opinion. So, this is basically known as a fictitious play. So, recall in a fictitious play players make an opinion about the other players strategies. So, this opinion is formed based on the empirical average. Now they choose the pure best response to those empirical averages and then this the convergence is that the x1 plus x2 plus x and these are the this thing by n. This is basically the empirical average of player 1's choices. This converges to some x star. Similarly, the choices made by player 2 look at its empirical average this converges to y star. The theorem that is proved by Robinson is that x star y star is saddle point equilibrium. Convergence the proof is actually a lengthy proof at this moment we will not go into the proof but we will see an example illustrating this result. So, let us consider matching pennies. So, this is a very simple example the two pure strategies to make and if both match player 1 gets 1 unit if they do not match player 2 gets 1 unit this is a zero sum game of course. So, how does this go in the fictitious play? So, player 1, player 2 let us say in the first round player 1 has played H if initially if player 1 plays H player 2 will play T and in the next round player 1 because player 2 has played T. So, he will play T because he has played T now player 2 will see that player 1 has played H and T. So, therefore, with half probability H with half probability T therefore, he can play anything that maximizes that let us look at the what is the payoff that player 2 will get. So, player 2's payoff is basically pi half H plus half T comma whatever he chooses Y. So, this is nothing but half probability if he chooses H this is T Y. So, if Y happens to be H then he will get pi H H will be 1 and then half and this is 0 therefore, he will get half if Y is H if Y is T then also he will get half. So, he is going to get whatever he chooses H or T whatever he chooses he will get half. So, therefore, he will pick one of them let us say he has picked T T and H both are best responses to half H plus half T. So, now once you know that he picks T now the player 1 has picked T. So, therefore, player 2 will continue to pick T because that is going to be the best response to this because both times he has picked T. So, therefore, T the best response to T is T. Now, player 2 will see that player 1 has played H one time and T two times. So, therefore, he will play 1 by 3 H plus 2 by 3 T. Now, player 1 has played H once in 3 times whereas T in 2 times. Therefore, so that means T he has played more often than H. Therefore, the for the player 2 the best response is going to play something not equal to T that is H. So, he will play H.  So, one can actually do this iterations for several times and then get some opinion about how much it is. The most one of the very important point here is that this convergence rate is actually very slow. This is not a very fast converging method, but nevertheless, this is a good method to show the convergence of this saddle point equilibrium and in fact, for any zero sum games this convergence automatically happened. This is a proof due to Robinson. In the next sessions, we explore further properties of this quick t-shirts play and then study some of its convergence properties. Okay, with this we will stop this session. We will continue in the next session.


L-carnitine is a amino acid that can boost your cognitive performance, increase your energy levels, improve your focus and attention, and even improve your physical performance. But is it really beneficial and should you really consider supplementing it? Well, let's find out. Hi friends, welcome back to the channel. My name is Greg and I'm a certified brain health professional. On this channel, we help professionals achieve peak performance by unlocking their full brain potential. If this interest you, then subscribe below and join our amazing community. Today, we are going to talk about L-carnitine. We are going to talk about the benefits, the side effects, the synergies, dosages, and at the end of the video, I'm going to tell you who should consider supplementing L-carnitine. So if you're ready, let's just begin. Now L-carnitine is an amino acid that is produced in the liver from two other amino acids. One is lysine and the other one is metionine. Now L-carnitine has been primarily used for reducing fatigue, for improving sperm quality, and for improving male fertility. But more recent research shows that it may be a potent cognitive enhancer. But is it really? By the way guys, have you ever tried L-carnitine? If you did, did you experience any kind of benefits? Let me know in the comment section below. So let's check out the benefits. The first benefit is that it may improve memory and learning. So there was one study published that showed that yes, L-carnitine can improve memory and learning. But the study was done on people who suffer from cognitive decline. In particular, they had Alzheimer's disease. And they took a very, very high dosage of L-carnitine, about 10 grams per day, which is five times higher than it is the recommended daily dosage. But they have noticed an improved cognitive function. So if you suffer from cognitive decline, if you suffer from dementia, then it may be beneficial to supplement L-carnitine. However, before you do it, do consult your doctor. But what if you are a healthy individual? Can you expect any kind of benefits on your memory? Now if you look at the famous Reddit survey, you're gonna figure out that L-carnitine scores quite low on the ranking of all the tropics for memory improvement. So I think it is very unlikely to get any kind of positive benefits on memory and learning if you're a healthy individual. But what about depression? Because that's another benefit of supplementing L-carnitine. While one study showed that if you take two grams of L-carnitine per day two times, so together four grams per day, the symptoms of depression can decrease. But there is one problem. The study was done in people who suffer from a nervous system disorder, which is the result of severe liver disease. And since L-carnitine is synthesized in the liver, of course supplementing it benefited them. So if you don't have a severe nervous system disorder, it's really hard to expect any kind of benefits on depression. Or at least let's say like this, we don't have any studies that show those effects. Now how about improved energy levels? Well yes, L-carnitine can increase glucose and creatine levels and because of that it can improve or increase your energy levels. And because of that it can also improve your physical performance. Now what about attention? Yes, well one study found that kids who have ADHD and were given L-carnitine have noticed an improved attention. But there was no other studies on healthy individuals, so it's really hard to say if L-carnitine can increase your attention or not. But we know that L-carnitine can be neuroprotective and it may help with fat loss, physical performance and also improve the sperm quality. Yes, the studies show pretty weak effects, but the effects were noticeable, so you can expect those benefits. By the way guys, do you want to know how well does your brain perform?  Now what is the optimal dosage of L-carnitine? Well there are two popular types of L-carnitine available in the market. If you want to boost your cognitive performance, then taking L-car a subtle L-carnitine seems to be the best form and for that the recommended dosage is about 600mg to 2.5g per day. Now if you want to improve your physical performance, then take a dosage of 1g to 4g of L-carnitine L-char-trade, which is the second type of L-carnitine. For best results, I recommend taking this amino acid with some carbs. Now how about synergies? Does it make sense to combine L-car or L-carnitine with some other nitropics? You can combine it with alpha-depoic acid, which is a very strong antioxidant, or coenzyme Q10, which is another very strong antioxidant. In addition, you may combine it with choline, because choline increases L-carnitine in the position of muscles and you can learn all about it in this video up here, and you can even combine it with caffeine, because this will even more boost your energy levels and work as a strong stimulant. So if you decide to take L-carnitine, consider supplementing it with those mentioned nitropics. But is L-carnitine really safe? What about these side effects? Well the first thing you need to know is that there are non-responders to L-car. So if you're one of those, then it doesn't make any sense to supplement L-carnitine. The second thing is that vitamin C deficiency can impair synthesis of L-carnitine. So you need to ensure high levels of vitamin C, which you can get for different kinds of foods. You can drink a lemon juice in the morning, or just take a vitamin C supplement. All of those options work well. It also may cause odd smell, which, yeah, is sadly true. In addition, people report the following side effects, nausea, vomiting, and diarrhea. But at very high dosages, at about 3 grams per day. So if you want to avoid those side effects, then take a lower dosage as I recommend to you before. Lastly, and this is very important, within 24 hours of supplementation L-carnitine would increase the levels of TMAO in your body, which can increase the risk of heart disease. So if you are at a risk of heart disease, then it's not really recommended to take L-carnitine. By the way, guys, if you like this video, please press the like button below. So just before I tell you who should consider supplementing it and who not, where can you buy it? Well, below in the description, you're going to find some links to my favorite entropic supplement that contains L-carnitine. But if you want to just buy it as an individual compound, you're going to find some links as well that lead to top quality entropic sites or entropic stores where you can buy L-carnitine or L-car. So just check them out if you're interested. So who should really take L-carnitine? Now in my opinion, people who suffer from cognitive decline, maybe they have dementia, they have Parkinson's disease, they have Alzheimer's disease, they would probably benefit from it. But if you're one of those, then of course I suggest you consult your doctor and you discuss the supplementation of L-carnitine or L-car in this case. So people who suffer from liver or kidney disease probably will benefit from supplementing it.  What if you're a young professional and want to improve your cognitive performance? Well it is very unlikely that you have two low levels of L-carnitine in your body and therefore you probably won't gain much from supplementing it. But if you want to try it out, then take a low dosage. I recommend 500 milligrams to maximum one gram per day for a short period. That's it for a couple of weeks or maybe one month and see how this works for you. Of course if you get L-car in a more complex and tropic supplement, then that's fine especially if there's a low dosage inside. But probably if you take it as an individual compound, you won't get that much of a benefit. Luckily there are better tropics available in the market, they're more potent and even safer for supplementation. And if you want to learn all about them, check my next video up here. Thank you guys for watching and I hope to see you soon again.


If you're looking for elegant, classy and chic outfit ideas for this summer 2021, then this Massimo Dutti haul and try-on should help. I've got a rail full of beautiful clothes that I'm going to share with you today and I'm also going to be styling each of these pieces in two different ways so there's lots of outfit ideas. I realised that it's been a while since I've done a Massimo Dutti haul on my YouTube channel so I thought it was about time. Plus, after just one peak at the new spring summer collection, I was sold. They're new and range with all those lovely linings and cottons and a soft, neutral palette was just my cup of tea so I'm really hoping you're going to love these items as much as I do. Now, you might have seen me making my spring capsule wardrobe recently and during that very messy process, I noticed a gap in my wardrobe for either a white pair of trousers or white jeans. The pair I had had shrunk over the years. Maybe it was more the fact that I'd grown a little bit. Either way, they didn't fit anymore. So it was definitely time for me to find a new pair, albeit in a comfortable size up. Enter these cropped, slim fit trousers, which I thought would make a really elegant alternative. They've been made from 100% cotton with just 2% of elastin to give them a little bit more stretch. Now, I would describe these as mid-rise, which is probably my favourite waistband on trousers or jeans, actually. I love super high-waisted jeans on other people, but I don't think it always works that well on me. So I'm sharing two different ways I would style these Massimo Dutti trousers for this spring-summer.  Both outfit ideas feel really elegant, but if I'm honest, I think I feel most comfortable and most like me with the addition of the blazer over the top. Now, the fabric is not quite jeans, but not quite trouser either. It's somewhere in between. And once you feel it, you'll know what I'm talking about in a really nice way, I have to say. And the fit is coming up a little bit big, but something, again, that I think is definitely a plus with this pair of trousers. They're not too tight and they're not showing every little bit of cellulite that I've got, which I would say is definitely a bonus. So yes, pleasantly surprised with this pair of trousers. I actually didn't think they would look as nice on as I think they do. So definitely a winner. And I think I'll end up finding lots of different, elegant outfit ideas for these as we go through summer. Next up to another pair of trousers, but this time a little more tailored. These have been made from a blend of linen and cotton, but I would say they feel more linen to the touch. I really like the shape of these trousers. They look slightly smarter than lots of alternatives I've seen recently and yet still retaining their on-trend, looser fit. The waistband is lovely too, actually, with their hook and eye-fastening giving the trousers a clean line across your tummy. So as you've seen these trousers could easily work for the office or smarter occasions you need to be a little bit more dressed up for. I've gone for a kitten heel with this look, one for practicality as you tend to be tottering around on six inch heels all day long, but also I think the shape and cuts of these trousers lends itself best to a kitten heel. The second way I'd style these trousers would be something like this. Obviously a contrast to the outfit before. Much more everyday elegant chic. But hopefully sharing just how versatile a great pair of trousers can be. These Massimo Ducci trousers would become something of a wardrobe staple for me. Obviously black is going to mix with the majority of my capsule wardrobe, but this type of smarter cut yet being in this lovely lightweight blend of linen is really timeless. So yet another lovely alternative to finally get me out of my blue washed denim jeans. Now I just want to quickly mention you might have noticed that beautiful new handbag that I've just got in from a brand called Demilia London. They very kindly got in touch and asked if I would like to choose a handbag from their collection, which of course I said yes because they're absolutely beautiful. So this beautiful little bag is called the Santa Monica and it comes in two different options. You can either go for it with the leather strap or you can go for one which has got a gold strap around it and on top of that it's got a long strap here so you can wear it cross body or over your shoulder as well. I actually made a mistake and it was actually the gold chain one that I personally wanted to go for but while I have this one here I thought I would show you all so you can get a good gist of what the brand is like. The quality of the leather and the stitching is really beautiful and the hardware is very subtle and elegant. So just the kind of thing I love like I mentioned the shape and that ability to wear over your wrist is very original. I don't think I've ever seen that before but also you've got the option of wearing it in the traditional manner over your shoulder or as a cross body. It's quite hard to show you but it's surprisingly big in there. It would definitely fit my purse phone and some makeup everything I like to take around with me. I am however going to send this one back and switch it for the Santa Monica with the gold chain. If you have a look at their website at which I should put in the description box below you'll see what I mean because I don't really have a nice evening bag and I thought that would tick that box perfectly. When I was browsing Massimo Dutti's website for this haul and try on I kept adding this dress into my basket taking it out and then going back and adding it in again. What I loved about it first off was this beautiful color of sand but I was a little bit hesitant about the shape. Would it be something that I could only wear to the beach maybe as a throw on on top of my bikini but now seeing it in person and getting to feel the quality for myself. I'm really happy that I decided to have a go. Not only is this neutral shade incredibly elegant but the quality of the linen they've used is just beautiful. There's a slightly silky feel to it which is probably down to the viscose element but that's also helping it to have a really nice drape too. So obviously one way to style it would be wearing it loose and floaty as you've seen in this footage but I'm excited to show you this other way I'd style it as well and see what you will think. Just by adding a belt to subtly accentuate my waist a little it's naturally gathered the fabric which gives the dress a whole different kind of look. Now it's become more of a typical elegant shirt dress a style I'm personally very fond of and something I know I'd wear a lot throughout spring summer. This kimono sleeves are falling beautifully but for me the shining star of this piece has to be the tone that they've used and of course that fabric content. It's original stylish and on trend of course with all those lovely linens we've been seeing this season but above all and probably most importantly it feels beautiful to wear so definitely a 10 out of 10 for me. I've been looking for a pair of white linen shorts for a while now but I was taking my time because I really wanted to make sure I got the right weight of linen especially with a pair of shorts as they're generally tighter against your skin than say a linen dress so I didn't want to be showing anything underneath. So when I saw this pair of Bermuda shorts at Massimo duty I thought they looked the perfect weight made from 100% European growing linen and with a slightly longer length to other styles that I've seen obviously you've got pockets there and a button at the waistband. So I'm sharing two different outfit ideas with these shorts in this haul and try on. First as you've seen my everyday casual look secondly something a little bit different but one that I think is equally elegant. I decided to try out if they were something that could be worn to the office or for meetings and added a blazer that I actually got last season from Massimo duty. It's a tonal look obviously but one that feels chic, elegant and classy with a hint at the fashion trends this season without compromising on comfort my perfect kind of style. Now I wasn't planning on adding yet another Breton stripe to my capsule wardrobe but when I saw this one I just couldn't resist. Now you might be thinking why on earth do you need another Breton top Jessica they all look the same but I can't stress enough there are lots of little details about each of them that make them different even if I do need to point them out. First of all this one has been made from a blend of organic cotton which is obviously really sustainable and I like the feel of that against my skin. It's also nice to have a simple crew neck shape which surprisingly I didn't have already but my favorite part about this t-shirt is definitely the sleeves. I love the width I love the oversized feel of them and the fact that the hem is quite deep and will turn over. So a really classic and elegant way to style a Breton top would be with a pair of white jeans or white trousers like I have. I've added the blazer to give the look a little bit more polish but as you can see it's a really timeless classy and chic outfit that you could reach for on an everyday basis. Alternatively I actually really like it styled with the shorts maybe add a pair of flat espadrilles I think that would work well. Sadly I don't have any just yet so you'll just have to imagine that look. Or for a third bonus look I really like them styled with the linen blend trousers as well. Actually I think that might be my favorite outfit idea out of the three but do let me know your favorites in the comments section below. Thank you as always for all your support or the likes, the comments, everyone who's subscribed and just generally being your lovely selves. I am always very grateful and if you're new here, hello, hopefully you'll stick around and check out some of my other styling videos that I've put in the description box below. Big hugs everyone and I will see you next week.