 In lecture 3, we're going to look at doing derivatives in Sympi. So first of all, as always, opening a new notebook, we're going to say import Sympi as SYM. Just an abbreviation for our namespace there. And we're going to initialize pretty printing. Sum.init underscore printing, open and close parentheses. And I'm going to map the variable A to the symbol A, and then B, X, Y and Z to the appropriate symbols on the right-hand side. So let's just run that by hitting Shift, Enter, or just hitting the Run button there. And this code gets executed. There's nothing to be printed to the screen. Nothing happens. We've just run that piece of code. Now I'm going to introduce this variable, name F, and I warn here that I'm only using F as a variable here. That's not defined as a function. In future lecture, we're going to look at defining a function as opposed to a variable. So this is symbolic Python. So I have referred to Sympi as SYM. So if I want to use trigonometric functions such as cosine and sine, I have to invoke this namespace, Sum dot cosine X times Y, and Sum dot sine Z times X. X, Y and Z are symbols here. So this expression here, I've attached to the variable F, and I'm just going to print out the variable F. And there we have the sine of X times Z plus the cosine of X times Y. And it's printed in this pretty printing format because I've initialized that printer up here. So let's look at just printing the first derivative. So SYM dot capital D, we saw that in the previous lecture. The derivative of F, now F is a variable referring to this expression up here with respect to X. Lo and behold, it's going to do a partial derivative for us because there's not only an X in our expression, there is Y and Z as well. The second derivative, remember how to do that. I can put two X's there. Let's execute that code so we have the second partial derivative. Or instead of putting the two X's, I could say X comma two. And there we go, it looks exactly the same. Now partial derivatives need not only B with respect to a single variable. We can have the following. I'm going to have my expression F there. And I'm going to do the derivative, partial derivative with respect to X once, with respect to Y three times and with respect to Z twice. Let's execute that code. And you see this long partial derivative here and it's going to be to the order and in series as I put it down there. First X, then Y three times and Z twice. Now let's actually do that first derivative. Now perhaps I should start down here. We've already done that by using the derivative. That's the printing statement. And just adding a dot, do it at the end. And if I execute that, I'm going to see it's negative Y times the sine of X, Y plus Z times the cosine of X, Z. This is the proper way of doing it though. I'm just going to use this keyword Diff with a lowercase D, I, F, F. So I'm going to take the derivative of F with respect to X and I'm just going to print that out. It's just going to do the equation or get the solution for me. So in essence I can say something like sym.diff, ti, ff. And let's give it a function. Let's say it's X cubed with respect to X and we know that should be 3x squared and if we execute that, indeed it is 3x squared. So I can either do the printing part and just do it instead of printing out the function itself or properly just calling the di, ff function there and just executing the code.