Tutorial on Derivatives
A. derivative of a function of one variable.
The basic form of the derivitave command is D. It is used as
D[function,{var,n}] where n is n^th derivative of the function with respect
to a single variable.
Example1.
Define f(x)= x^2. Take the 1st, 2nd and the third derivative.
Solution:
Please type the following into Mathematica notebook and hit the enter
key.
f[x_]=x^2 d1=D[f[x],{x,1}] (*this gives the first derivative*) d2=D[f[x],{x,2}] (*2nd derivative*) d3=D[f[x],{x,3}] (*3rd derivative*) (*Remember d1,d2 and d3 are names that you choose.*) 2 x 2 x 2 0
Example 2.
Define g(x)=cos kx where k is a constant. Take the 1st derivative .
Solution :
Type in
g[x_]=Cos[k x] d4=D[g[x],{x,1}] Cos[k x] -(k Sin[k x])
Example 3.
Differentiate f(x)=cot(sqrt(x^2+1)).
Solution :
Type in
f[x_]=Cot[Sqrt[x^2+1]] d5=D[f[x],{x,1}] 2 Cot[Sqrt[1 + x ]] 2 2 x Csc[Sqrt[1 + x ]] -(--------------------) 2 Sqrt[1 + x ]
B. Derivative of the function of several variables.
The derivative f(x,y) with respect to x and y is D[f(x,y], {var,n}]
where n is nth partial derivative.
Example4
Find the derivative of
f(x,y)=x^3 +y^3 once with respect to x and then once with respect to y
Solution:
Type in
f[x,y]=x^3+y^3 d1=D[f[x,y],{x,1}] (*once with respect to x*) d2=D[f[x,y],{y,1}] (*once with respect to y*) 3 3 x + y 2 3 x 2 3 y
Example 5.
Take the 2nd partial derivative of f(x,y) with respect to x
Solution
Type in
d3=D[f[x,y],{x,2}] (*twice with respect to x*) 6 x
Example 6
Find the third derivative of f(x,y) with respect to y
Solution
Type in
Clear[f,x,y] (* This clears all of the previous variable*)
f[x_,y_]=x^3+y^3 Cos[k Sqrt[y]] d4=D[f[x,y],{y,3}] 3 3 x + y Cos[k Sqrt[y]] 2 15 k y Cos[k Sqrt[y]] 6 Cos[k Sqrt[y]] - ---------------------- - 8 3 3/2 57 k Sqrt[y] Sin[k Sqrt[y]] k y Sin[k Sqrt[y]] --------------------------- + ---------------------- 8 8