WOLFRAM NOTEBOOK

Template Notebook
Generate

Mathematica Lesson 8: Differentiation Basics

In the menu at the top, click Make Your Own Copy to work in Mathematica Online, or click Download to use it in Mathematica.​
​​
​When asked "Do you want to automatically evaluate all the initialization cells in the notebook...?" I recommend "No" so that you can work through each cell one-at-a-time.

Before we begin, here's a Mathematica tip: If you want to wipe out all the variables you have created (to start afresh), go to (menu bar) Evaluation -> Quit Kernel -> Localto quit all the variables.Opening a new notebook will not erase your variables, because Mathematica allows you to pass information from one notebook to another.If you just want to clear one variable name (like f), try Clear[f] above the code you want to use.

Partial derivatives

Question 1

Differentiation of a single-variable function in Mathematica is simple. For example, try
F[x_]:=x^3+Log[1+x^2]D[F[x],x]
or more directly,
D[x*Sin[2*x]-x^5,x]
To evaluate a single-variable derivative at a point, append Slash-Dot ( ./ ) to the end of the command. To compute F'(4) try
D[F[x],x]/.x4
Give this answer on Moodle to the nearest hundredth (use //N):

Question 2

The D command generalizes to partial derivatives.​
​​
​Define a function of two variables using the usual "function definition" syntax (square brackets, underscores, colons):
f[x_,y_]:=x*Sin[x^2*y] + y^3
To ask for the partial derivative with respect to x, try
D[f[x,y],x]
(I read this as "D of f with respect to x".)

Question 3

What command will you run to get the partial derivative of f with respect to y instead?
After you run your answer, you should get 3y^2+x^3Cos[x^2y].

Question 5

To evaluate a derivative (of any order) at a specific point, use "slash dot". For example, fxx(1,π) is
D[D[f[x,y],x],x]/.x1/.yPi
That tells Mathematica to compute fxx, then plug in x=1, then plug in y=π.​
​​
(This "slash-dot" set up can be used to plug into a computation in other contexts too, not just differentiation.)
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.