Transcripts
1. Introduction: Hi and welcome to this new quest where we are going to explore the tics package in late OK. So first of all, what is ticks? Ticks is a package in latex for drawing figures. So what can it run while it can draw plots, community diagrams, graphs, geometric figures, and much, much more. Tic stands for a takes this kind section, put it down, which is German and translates to tics as not a drawing program. What will we cover in this video lecture? So takes is a very big package and can do a lot of stuff. So we will not have time to cover all witches in the text package. So the things we will cover is drawing lines, circles, and polygons using techniques, we will learn how to change the lifestyle, like having dotted or colored lines and etcetera. We will learn to plot functions and curves using ticks. And we will learn how to use for loops to create ticks marks, for example, there are a lot of further resources, for instance, the tics manual and additionally, all belief have a documentation page on tics. So let me quickly show what we are going to create the intakes. So first of all, we're going to start with drawing lines. Thereafter, we are going to learn how to draw rectangles and circles, and how to create colors. After that, we are going to learn how to plot functions and how to plot curves. And finally, we are going to learn how to create ticks marks using for loops. This course requires some basic Natick knowledge. So for instance, you will need to know before you start how to import packages and How to Write Basic Mathematics in later. You do not have any late acknowledge. You can begin by seeing or first 27 videos of our litter course mastering later. In this course, we also have several exercises and the project is simply going to be to do those exercises. And additionally, if you made something that you are particularly proud of and want to show it to others than you can publish it as a project so other people can see it. So I hope you find this interesting. So let's get started in the next video.
2. Drawing Lines: Hi, and welcome to this first video on ticks. So the goal of this video is to make the Pauling shape in tics. And here we can see the code which is used to make this specific figure. So now I have deleted everything because I'm going to start with a completely blank canvas. So first of all, I will need my package, which in this case is the tics package. So I will write use package and then ticks to import this package. Now my package is important and everything compiled nicely. So I will start making my figure. So all my tics code is going to be inside the environment, takes picture. So I will write begin ticks picture and press Enter. And here I can write my tics code. So a triangle consists of three separate lines. So I will start by drawing one line from the 0 comma 0 to the coordinate two comma 0. To do this, I would write the document. And then I will write the starting 0 comma 0. And then I wanted to go to which I'm denoting by this line here. And the end point is going to be two comma 0. And all my tics commands is going to end with a semicolon. And if I now compile, we see our single line here. One thing to note is that all the lengths are in centimeters. So this line here is exactly two centimeters slung. Okay, so we have one line, then we can add another, because our triangle has three lines. And this is going to be from 2.021 comma 1.So 73205, which is the square root of three approximately, and then semicolon and compile. And now we see that we have two lines which gives us an angle. So of course now I can draw the third line. But before that, I'm going to say that it's a simple way of doing exactly what I'm doing in this code. So if I want to not a line going from this point to the 0.1 comma one dot 73, et cetera. Then I can just do another double dash and then write this point here. I will just copy it of pair. And let me also delete this one and compile. And now you see that we have exactly the same figure and we can continue if we want to define a line from this point to the starting point, which is 0 comma 0. We can write 0 comma 0 here and compile. And now we have our triangle. So one thing to note is that instead of writing 0 comma 0, I could write cycle here, which just cycles around to the starting point. So if I now compile, I get the same figure. So one thing I want to comment is that I will always use cycle one. I want to make closed shapes. Recent for this is that using the endpoint will sometimes create some strange artifacts. Okay, so I have my base triangle here. First of all, I want this triangle to become a bit bigger. And to avoid, to do this is simply to just scale the picture. So what you can do is up here, take an optional arguments inside your environment and just RightScale. And then how much you wanted to scale with. And let me take free and then compile. And now you see that my triangle here becomes three times bigger. You can also only stretched the x-axis or the y-axis. This is done by, for instance, using x scale. So let me compile. And now only the x-axis is scaled. Or you can do wide-scale, which scales only the y axis. And of course, if you want to scale both the x-axis and the y-axis, you can do lie scale equals three ands x scale equals three, which will scale for the x-axis and the y-axis. But OK, this is just the same as scale does. So we will remove all this and just settles scale equal to three. So one thing I know now is that our lines are very thin. I want them to be thicker. To do this, I can in the draw command have an optional argument which is fixed. And now my lines are much figure. If I want an even thicker, I can do ultra thick. And now they are even figured. I can also go in the other direction, making them finner. And there the operation is phi1. And now they are lot thinner. And here I have ultrafine and you also have the fin command. Okay, so I was happy with it. So let me go back to that one. So this is my temporary picture now. So the last thing I want to do is to create lines from this corner to the midpoint here, from this midpoint to this corner, and from this corner to this midpoint. So let me start with this line from here to here, which I can write by drawing. And then one comma 0, which is the midpoint here to one comma one dot 73205 here, and then semicolon. And now we have our line here. So in the original picture, this line was dashed. So let me make a dashed line by just writing dashed as an optional argument and see how it looks. And now we have a dashed line. We can also make it dotted by just writing dotted here and compiling. And now we see this very thin dotted line here. So let me take it back to dashed and compile. And now I have my dashed line again. The next line I wanted to same style, but only from here to here. Of course I can do the same thing as I did here on a new line with the new door comment. I can also place it inside here by just writing the starting points 0 comma 0, and then two. And then the end point, which is one comma five, comma 0 dot eight, 6-6, like this. And if I now compile, I end up with two separate dotted lines. One starting at this 0.1 comma 0, which is here. And going to one comma square root of three, which is here. And then a completely separate line from 0 comma 0, which is here to this midpoint here, which you can see here. So we can do it with our final line, which is going to go here to here. And it's going to be two comma 0 to 0 comma five, comma 0, comma eight, 6-6, like this. And now we are finished with our main part of our figure. One thing I wanted to say is that instead of writing all this approximation, so this is just taking the square root of three, the calculator and just writing the first that smells that. You can also just make latex compute the square root of three. So the way to do this is just writing square root, which is SQRT and then free here. So I'd prefer to have it in, inside curly brackets here. So that latex doesn't think that this parenthesis and here. So if I now compile, you see that nothing really happens. But often this can make it easier to make this picture. So here as well, instead of writing the square root of three on your calculator, you can just write square root three here, like this. And you can see an h changes here. So tics understand basic math operations. This is something we will go more into in later videos. As a final thing, we want our figure here centered and we want to explain what this figure is about. And to do this, we will wrap or ticks picture in a figure environment. So let's do this by begin figure and with an nth figure like this. And if I now compile, it goes down here. And let me write, first of all, I want to center my figure. So let me write centering, like this, compiling. And now it's centered. And I also wanted to be here in the picture. So let me write each year as an optional argument for placing it here and compile. So now it jumped up because it's where our code is. And finally, I want to make a captions to the figure. So let me write caption inside here and just write my sweet triangle like this and compile. And now I have the final picture, which was the same as the one we started with.
3. Drawing Lines Exercise: I have an exercise for you in the audience. So try to make this simple triangle here using ticks. And also you have this line here, speeding the triangle into two parts from this corner here to the midpoint here. So just try to do this exercise and then we will go through a solution. Okay, so now it's time for the solution of the exercise. So let me just take it below my original picture. And the first thing we want to do is to begin or a ticks picture environments. So let me write begin takes picture. First of all, I want to make the outside triangle. So this triangle is going to be from 0 comma one to 0 comma minus1 to two comma 0, and then cycle around like this. So you first make a line from 01 to 0 comma minus1, then you make an underline from 0 compliments one to two comma 0, and then you just cycled around. So you make a line from here to here and compiled. So now we have our outside triangle and then we had a line from 0 comma 0 to the corner, two comma 0. And remember to end everything with semi-colons. And now we have the midpoint line here. And finally the picture was a bit bigger, so I'm going to scale it by two. And this was the triangle I showed. So don't worry if your solution was not exactly the same as mine. There are several ways to do this. For instance, you can make this triangle here and then just add these two lines. Or you could make it bigger instead of scaling here by multiplying all these coordinates by two, for instance. Ok, this was everything I've gotten this video. So see you again in the next video.
4. Basic Shapes: Hi and welcome. In this video, we are going to learn how to make more basic shapes in fix, for example, in this video, we are going to go through how to make rectangles using texts and circles, and how to use colors and place text in our image. As before, let me begin by a completely blank canvas. So let me delete everything here. I'm going to keep my tics picture environments. And remember that we have imported are fixed package in the preamble. So let me now compile. And now we see that our picture vanish. So first of all, I'm going to begin by making the rectangle. To make the rectangle, you use the draw command and then you write in the lower left corner of the rectangle, in this case minus three, minus three, then you write rectangle. And then the upper right corner, in this case free, comma free. And remember the semicolon. And you see that we have a rectangle here. The lower point here correspond to the point minus three, minus three. And the upper points here correspond to the 0.3 comma free. So for instance, if I change and say that to loss coordinate here is four and compile, then you see it gets longer. And now this upper coordinates here is three comma four. Let me take it back to free and compile. And remember that the next thing was that we had a circle inside the rectangle. To make a circle, we again use the draw command and we need to specify the center of the circle, which I'm going to set to 0 comma 0. And then in this case I want to draw a circle. And in square parentheses, I can have several different options. So let me say that the radius of the circle equals free and always end with a semicolon and compile. And now you see that we have a circle here with radius free and center 0 comma 0. So the point here in the center is 0 comma 0. So in my picture, in the circle was thread, which is very easy to change. You just take the optional argument rent in the document. So now we have a red circle and let me also make it fit. So now you can see the color a bit better. You can take in as an optional command almost all the common colors. So for instance, if I want to circle to be blue instead, then it becomes blue. I can also make the rectangle rent by completely the same way. And so on. But let me keep my red color here. Okay, so what I want to do now is to mark the center using another circle. So want a very small circle in the center. So let me do this with a draw command. And the center is 0 comma 0 still, we want to circle. And this time I want to radius to be very, very small. So let me set the radius to be equal to 0, D21. And now I forgot the semicolon. So let me compile again. Like this, so that I don't have an error here. And no, we made a very small circle here. So what I want is that this circle here is going to be filled in. The easiest way to do this is just to use the fill as an optional argument like this. And now you see that the circle here is filled in. And let me make it blue as it was in the other picture. So now we have a blue dot in the center. There are several ways to make filled shapes. For instance, you can use the Fill command and let me just copy this thing here, like this. And let me comment this out for the time being and compile. So this is not a way to make a filled circle here. And of course you can take this one to be blue by just setting the optional argument blue here. The next thing was to have a green line from the center here too, the point here. And this is done like in the previous lecture. So to make the line, and we just make a line from 0 comma 0 double minus sign. And then this point here is three comma 0 semicolon vile. And now we have a line here to here. And we can take in some optional arguments. In this case, let me make it Korean adopted. And since we don't see the dots here, very well, let me make it ultramafic. So now we have a clearer dotted line here. So one thing I wanted to say is that you can make this dotted line either loosely dotted or densely dotted. To do this, we can write, then sleep like this and compiled. And now the line is densely dotted or you can write loosely. And now the line here is loosely dotted. The same thing works with the dashed command. So you can write dashed and loosely dashed, which make a loosely dashing here. So let me take it back to Donald and compile. So the final thing I wanted to talk about was how to place text in the image. And one way is to use the node command. And I want the text to be at. And then you write the point to where you want the text to be at, note to be at. In my case, I want the text to be at the center. So let me start by writing 0. And then I can use curly braces. And inside these curly braces I can place the text. So let me write the center and then remember the semicolon and compile. And now we have some text placed at the centre. So this looks not very good. So one way to fix it is to make an optional argument which tells you if you want the text above or below or left or right of the point. So let me place it above like this and compile. And now you have the text place above. But still, I think that the spacing here is a bit too small. So I will fix this by, instead of having it at 0, I will taste it at 0 comma 0.1. so let me compile. And now I have placed some text in the image. Of course, if I wanted to be below, I can use below here. And I can also place it left and right, like this. But I was really happy with above, so let me go back. So the final thing was that we had some flexed here, which said that radius of the circle is one. To do this, we can make another note. And I want to note B at the 0.1.5 comma 0, which is the midpoint between here and here. And the text is, the radius of the circle is one and semicolon. And this time I wanted to be placed below this point here. So if I now compile, I get the following. And now I have the problem that this text here is way too long for it to be placed on the single line to fix it, I can use a line break inside here, but if I tried to compile, then I don't get the line break. And that is because I need another optional argument here, which is the align optional argument. And this tells you how you want your text to be aligned. So let me, for instance, say that its left, so the text is left aligned. So now you see that the line break does something and it's probably too hard to see, but this text here is left aligned. You can also make it right aligned by saying right. And now this text is right line. So let me change the position here so you can see it for instance here and compile. So now does text is right aligned and you can also make it centered. So now this text is centered, but I wanted to be left aligned. So let me just go back to left and place this one here where I actually wanted like this. Ok, so here's our final picture. So this was everything I wanted to say in this video. So see you in the next video.
5. Basic Shapes Exercise: Hi and welcome back. In this video we are going to do an exercise which is to create the following picture. So stop the video and try to make this picture in later. And I will go through the solution in a second. Okay, so let me go through the solution of the exercise. First of all, as always, we begin in our text, speak for enlightenment. And the first thing we had in our picture was this black rectangle in the background. So let me start by making this with the drug mat. And then we could the optional argument fill to make it black. And then we need to make the rectangle which started at 0, and then the rectangle command. And then the upper right corner is going to be four comma two and semicolon. So if we compile, we have a black rectangle here. The next thing was that in this half here we have the circle. So let me draw that and let me use the Fill command this time. And I wanted to be white, and then I want to center it be at the 0.1 comma one. I wanted to make a circle. And the radius of the circle is going to be equal to one and with the semicolon. And now we have our white circle here in the center. We had a letter which was C. So let me denote acts. And the center of this circle is the 1.20 again. And we want to do letter C. So let me compile with the semicolon. And here we have our final shape. So see you again in the next video when we are going to go for flooding.
6. Plotting Functions: Hi and welcome. In this video, we are going to go through how to plot functions using texts. So this is the final image we are going to create. And as always, we're going to start by a completely banned canvas and tried to build this picture. Okay, so let's start by deleting everything here. And let me also delete this optional arguments like this and compile. And always remember that appear in the preamble. We have installed our tics package. So let's start creating our picture. So first of all, I'm going to go through how to create the X and the Y axis index. This should all be very familiar. First of all, I need to draw the lines. So let's start with the x axis. I'm going to start drawing from minus 0 comma one. And I want to draw until ten comma 0. And y axis is going to be from 0 comma 0 dot 120 comma five, like this with a minus here. So here we have our x axis and here is our y-axis. So when we draw axis, I like to have an arrowhead in each of the axis, so here and here. So the way to do this is with an optional argument like this. So now we have a small arrow here, and we can change the direction of the arrow by just letting it pointed in the other direction like this. So let's compile and let me also soon in here. So now we see that we have a small arrowhead here and we want both of them. So let me zoom out. So both here and here, we can have both the directions like this and compile. So now we have an arrowhead here and one here. Okay, but let me go back to deleting this one. And let me also add one here. And now we have our x and y-axis. The next thing I want to do is to add a grid in our figure here. To do this, we will, first of all, he used a draw command and then we will use to grit in the same way as we did with the rectangle. So first of all, we need to have the lower left corner of our grid, which I'm going to set two minus 0 comma 12 minus 0 comma one, like this. And then I'm going to write the grid, and then I'm going to write the upper right corner, which I'm going to set to ten comma five. And let me combine. So first of all, I don't like when the grid has this outline here. So let me remove it by having nine comma 94 comma nine and compile. So second of all, the grid is way too prevalent. I will make it weaker by saying that I wanted and I wanted ultra thin and compile. And now we have our grid. So this was how to create the X and the Y axis. So let's go towards plotting. To plot a function. We will begin by the draw command and then we will use the plot. And inside this parenthesis here, I'm going to write the x. And the corresponding y. So let's say that we want to plot the function x divided by two. So the x coordinate is going to be x, which I'm going to denote by backslash x in this case. And the corresponding y coordinate for each x is going to be x. And then I need to divide this x by two, which I'm going to do with the divide symbol and then two. So let us try to compile. And obviously that we get the line here, but it's not really filling inside our coordinate system. And the recent for this is that we did not specify the domain of the function. So we do not specify which X values can this function taken. To do this, we will use the domain optional argument and we want you to take in values from 0 to 9.9 or something. So 02, which is going to be a colon, 9.9, and that does not compile. And now we see that our graph is inside or coordinate system and it is plotted from 0 to 9.9. At the current point, I think that our function looks a little bit boring. So I'm going to add colors. So I wanted to be orange and I want it to be thick. And let me compile again. And now my line here is much more prevalent. So let me make another function. Again. I'm going to use to draw command and then plot. And let us make the function x squared divided by 25 plus one. So the x is going to be x. So this is the x coordinate, and then x squared is the same as x times x. And then we divide by 25 and then with plus one. So let us try to compile again. And then we have this one. Again. We need to specify the domain 0 to 9.9. We just take the same domain. And this is our function, and I would prefer it to be another color. So let's take blue and let's make it fit. And now we have our other function, x squared divided by 25 plus one. Okay, before we go on to the final function, I want to say that if you have the same domain on all your functions, it's quite a lot of text to write. So instead of writing the domain over and over again, you can write it once appear with an optional argument in the ticks picture. Let me write domain. And then the domain which is 0 to 9.9. And then I can delete this thing here. And then this thing here and compile. And you see that exactly the same thing happens. And if I want the third function now, I do not need to specify the domain, okay, so the third function is going to be x squared divided by 25. So let me write drawn and then plot again. And this time, instead of writing x times x, let me write x to the power of two. So my x-coordinate is going to be a backslash x, and my y coordinate is going to be x to the power of two. And to take the power, we reduced the power command. And it's going to take x. And it's going to take x to the power of two, like this. And we are going to divide by 25. Now, if we are tried to compile now, we will run into a problem. So let me just do that. And obviously that we have an arrow here and you get the bunch of numbers. The recent for this is that this parentheses here and the disk parenthesis. Do not make this happen. We will use curly braces and just take them around my function here. So if we now compile, then we have our plot that function. So let me again make it another color. Let's say rent and FEC. Okay, so now we have all our free function. So the final thing is to label the functions. To do this, we can find the coordinates of each of these points here and use the node command as we learned in the previous section. But instead, let us do it simpler. We just including node inside here. And then inside the curly braces, we can have our text. So my first function, I'm going to call f of x. And it's going to be x divided by two. So let me now compile. And then you have the label x divided by two here. But you see that it place it, it exactly at the point. So again, we will use the above optional argument here and compile to pace it slightly above. So let us do it for the second function with note. And let me place it, right. And this function is going to be called g of x. And it's going to be equal to x multiplied by x divided by 25 plus one. And that was compiled. So here we have our function and our final function is going to be, and I want to place it right again. And I'm going to call it h of x. And it's equal to x squared divided by 25. This is our final picture. I hope you enjoyed this video. So in the next video we are going to do our short exercise. So stay tuned.
7. Plotting Functions Exercise: Hi and welcome to this exercise. In this exercise we are going to plot the exponential function. So the code for the exponential function is going to be exp and then our variable backslash X. And this picture is the plot from minus 1.5 to 1.5. Additionally, I have used the color brown to plot the function with. So in this exercise, don't worry about the caption. Just worry about making the exact figure, which you can see here. Okay, just pause the video and see you in a minute for a solution. Hi again, and welcome to the solution. So let's begin by begin our environment, which is going to be tics picture. So let me go down here and press Enter. And first of all, I'm going to make the X and the Y axis. For the x axis, I will use the draw command and arrow. And I'm going to make the lines from minus 1.60.60 and Y axis. And y axis, I'm going to make from 0 comma 0 comma 12. And then I need something bigger than the exponential of 1.5. So let me write 0 comma 4.9 here and compile. And now we have created our x and y-axis. The next thing is to draw our function. So this is done with the document, and we wanted the color to be brown. And let me make it FEC. And all our planning is done with plot here. And then we need our x variable and then the function exp of x. So let me write xp and then backslash x here. Remember that we write the function inside these brackets here to make sure that ticks don't must understand and thinks that this parenthesis, and here, so let me compile this one. And then you see that it's made a very large brown line, which is because I forgot to include the domain, which is going to be from minus 1.5 to 1.5 here. So let me try to compile again. And now we have our plot. So the final thing is to make some description. This is done with node. And let me make the node to the right. And the text is going to say the exponential function of x. So let me compile once more. And now we have our final picture. Of course you can make it inside a finger environment and so on. That I'm not going to do this here.
8. Plotting Curves: Hi, and welcome to this video on how to plot curves in tics. So in this video, we are going to learn how to plot curves and we are going to make the following picture. And this is a picture of a cardioid and a cardiod in question have the following formula, which you can see here in the caption. So as before, we are going to delete everything. So let me keep the caption, but everything inside the tics picture, I'm going to delete and let me also delete this thing here and compile. And now remember that as always we have imported or ticks package in the preamble. Okay, so let's start. So first of all, I want to make the coordinate system, and according to this system, is going to be made exactly the same way as in the previous video. So first of all, let us draw the coordinate axis. So the y-axis is going to be from 0 comma minus 2.7 to 0 comma 2.7. And x axis is going to be from minus 4.5 comma 0 to 1.1 comma 0. So if we now compile, We have the x-axis and the y-axis. I also want this picture to have a grid. This is made the same way as before with draw and let me make it gray and ultrafine. And now we need to give the lower left corner, which is going to be minus 4.5, minus 2.6. And then we write grit and 0.92.5, which is the upper right corner of the grid. And let us compile. And now we have our coordinate system, which looks like this. The next thing I'm going to do is to actually draw the card rate. So the formula of the cardioid is down here. First of all, we do a draw command and then plot. And now we are going to give in this function for the x coordinate in parenthesis. So first of all, we have to and then times, then we have one minus. And then we need to know how we write the cosine function, which is coasts, and then backslash X, which is our variable. And if we let it stand like it is, it's going to be in degrees and we wanted in radians. So we are going to write an R here to denote that the cosine function here is in radiance and not to Greece. And finally, we need to multiply by another cosine function. And again, we have cosine x and we want to then radiance and end the parentheses here. And as before, we will need another set of curly brackets to make sure that takes actually understand or notation. So this is a function on the x axis. So let us write the y coordinates as well. So again, two times and then, and then a set of parenthesis, one minus cosine again, backslash x. And we'll want to did radiance and parentheses times. And the notation for the sine function is sine backslash x. And again, if we don't do something, it will be in-degrees. So let us make it ingredients like this, and let me have it all in some curly brackets. And again, I will need to have a domain. So let me say that the x variable here is going to go from 0 to two pi. So 0 is 0 and then two, and then we need to multiply with pi. And the notation for pi is simply writing pi. So actually takes understand the constant pi. So you can just write pi here and it will understand it. So let us compile. And now we see that we have our cardioid here. So let me zoom in a bit. So what you will notice that the cardiod here is not smooth at all. It's kind of straight lines all the way. So to make it smooth, what you can do is just given an optional argument, snoop here. And if we now compile, we see that the line here is much smoother. So finally, I want to color the function pink. And I wanted to be thick like this. And let me combine. And now we have the following curve here. So the last thing I wanted to do is to have this point here of marked out when the angle is two pi divided by three. So what I want is that two pi divided by three is going to be set in, in this function. And we are going to make a dotted line from here to here, and then some small circle here to mark the point, and then add line down here. So let's start with the line from the center to appear. So we are going to draw dotted. And I wanted to be also thick and the origin is 0 comma 0. And then I want it to be two. And I wanted to be to this point here, where the x-coordinate is this point here. So let me just copy it like this. And then instead of this backslash x, I'm going to write two times and then constant pi divided by three. And let me just do it all the places and compile. And now we see that we have a dotted line from the origin to when x is equal to two pi divided by free. So what I want now is to actually write the node, just explaining what this point here is. And in some of the previous video, we learned that we could write a note command here and just skip it in this point here. But we can do it did not away with just having node here. And then the text we want to have, which is going to be this point here, which has the coordinates three divided by two minus one. And I want to note to be above this last point here. So let me write above like this and compile. And now have written what point this is. Additionally, I want to have a small circle here, actually making it more prevalent where we are at, select to that as well. So we can use the draw command with the optional argument fill. And the point we want is exactly this one. So let me just copy it like this. And we want to make a circle centered at that point with radius 0.05 or some small number. So let us compile. And now we have a small circle there marking the point. And finally I wanted line from this point down here and then some text explaining what this point down here is. So we will need another line, which I'm going to make thick and dotted. And it's going to go from again, this point here to this point down here, which is only minus v divided by two comma 0, like this. So let me now compile. And here is our point. And let me also have a note explaining what this point areas and it's going to be blown. And it's just going to say minus three divided by two here. This is our final picture. I hoped you enjoyed this video. So in the next video, we are going to learn how to write ticks marks at all the points here using for loops. So see you next time.
9. For Loops: Hi and welcome. In this video we are going to make the following picture using mostly the same procedure as we have done in the last couple of videos. The only thing new is going to be how weak rate these fixed mark here, which we are going to do with a for loop. So lets begin like before by just deleting everything. And let me also delete this optional arguments here. And remember that as always, we have the tics package important inside our preamble. So let me compile. And all we are left with a completely blank document. So let's start by drawing the axis. I'm going to draw the axis would drop meant. And the trick is to have arrowheads in both direction here and create the following line. Two times pi to 0 comma 0. So this is going to be my x-axis. And then I'm going to continue creating my y-axis from 0 comma one like this. And if I now compile, I will get an x-axis and the y-axis would arrowheads in both directions. Okay, so the next thing is to plot our function. So let me begin by creating a domain. So my domain is going to be from 0 to two times pi here. And let me just compile. And I think that the axis look a bit small, so I want to scale it by one comma five, like this. Ok, but let's start for the plots. So the first plot is going to be the cosine function. So I have my x variable, my cosine function. And since I'm a decent human being, it's going to be in radiance. And remember that we need curly brackets around the cosine and the semicolon. So let us compile. So this is the cosine function. And let's do the sine function like this, and let's compile. And now we have both the cosine and the sine function in the same image. So if assume a bit and you can see that the graph doesn't look that smooth. So let us sort data out. So I'm just going to write smooth in an optional argument. And let me also make the cosine function t and thick like this. And if we now zoom in, we see that the graph of the cosine function has become a smooth function here. So let's do the same with the sine function. So the sign function, I want to be smooth and purple and FEC. And let's compile again. And now we have a purple sine function and cosine function. And the final thing is to write that the cosine function is the cosine function and the sine function is the sine function. This is done with a node and I want it to be right. And it's just going to say that this is the cosine function. Like this. So now we have the cosine function here. And for the sine function, I'm going to place it both above and slightly to the right, so it doesn't interfere with some of the axis here. So this is done by writing above. And right with a space between them. And I'm just going to say that this is the sine function and compile. And now we see that we have the sine function here and the cosine function here marked. So now for the ticks marks, so let me begin by drawing the first tick mark, and I want to draw it ultrathin. And this is basically going to be aligned from 10 to one comma minus 0.1. And then I just want to place a node below. And I want to say that this is one with dollar signs on both sides like this. And now if you compile and let me zoom in, then we have a single tick mark here when the number one under it. So if you want to more ticks marks here, you can just copy this line and make this 12 instead of one. And then you had another one. But it gets tiresome when you need to do it six times. So there's a better way to do this. And the better way is to use for loops. So if you're not familiar with a for loop from a previous course, a full loop helps you doing things which is repetitive, which follows a similar pattern. To create the for loop, you will write for each. And then you write your variable x in. And let me write x in one comma two. So what you want to do for each of these elements here is this thing below. Only that I wanted to do it for each x here, like this. So what this code does is it first sets x equal to one, and then plug in a one here and here and here and runs to coach. And secondly, it will set x equal to two and run the same code only when x equal to. So if we now compile and let us zoom in, then we have two ticks marks. One with 11 would do. And what you can do is continue with f3 and f4 and so on. So there's a simpler way to do this, which is simply using the dot, dot dot notation. So if we want all the whole numbers from one to four, what you can do is write dot-dot-dot like mathematics. And this will give you all the numbers in between 14. So let us compile. And you see that it's exactly the same. But this time what we can do is to write six here instead. And this will give you all the numbers between 16. So let us compare it. And now you have all the ticks marks on the x-axis. Finally, we have one more tick mark here on the y-axis, the terror, we do not need to use a for loop. So let me just copy this thing here, down here. And let's write 0 comma one, and then delete this thing here, comma one. And let us write one here and left here and compile. And this crate, the small line from this point here to this point here with the number one to the left of it. This is our final pictures. So I hope you enjoyed this video and the next video is a small exercise for you.
10. For Loops Exercise: Hi, and welcome to this exercise video. In this video, the exercise is to make the following x and y axis with the text marks of one to ten marched on each axis. Probably the easiest way to do this exercise is to divide it into three tasks. First of all, draw the X and the Y axis. The after drew all the texts marks at the x-axis. And finally draw the text marks at the y-axis. To draw the text marks, I hope that you can use for loops to make the task easier. Okay, see you in a minute for a solution to this exercise. Okay, welcome back. Let's start solving the exercise. First of all, let's draw the axis. So we are using the draw command, and let's do the trick with two arrowheads in each direction. And we're going from 10.2 to the origin. And then to ten No.2 comma 0, like this. And that's compiled. And now we have the x and the y-axis. Thereafter, we can start drawing the ticks marks. So first of all, we have a four each and we want the x n. And then N1 comma dot, dot, dot until ten. So we have all the natural numbers between 110 and then we have another curly brackets. And inside here you will have your drawing commands. So what I want to draw in ultra thin is depicts marks. So on the x-axis, I'm going to draw the ticks marks, which are going to be really thin lines like this. And let me compile. So now I have all the ticks marks on the x axis. At this point I had two options. Either I can create another folder and do the entire process on this line here, or I can just continue drawing these ticks marks here since we are running through the same numbers. So let me do the last approach. So this is the command for drawing ticks marks the y-axis. So let me compile. And this is our final image. So I really hope that you have enjoyed this series if you're interested in more Python or Laycock related content. So don't forget to follow us on skill share. So as a final thing, we have a project here which is simply to do these exercises and publish them. But otherwise, if you are particularly proud of one of the lower drawing syntax, don't forget to share it with the community here so other people can see your work. See you again for another crest.