Derivatives of Exponential, Logarithmic and Trigonometric Functions
The following table provides the derivatives of commonly used exponential, logarithmic and trigonometric functions −
Function | Derivative |
---|---|
ca.x | ca.x.ln c.a (ln is natural logarithm) |
ex | ex |
ln x | 1/x |
lncx | 1/x.ln c |
xx | xx.(1 + ln x) |
sin(x) | cos(x) |
cos(x) | -sin(x) |
tan(x) | sec2(x), or 1/cos2(x), or 1 + tan2(x) |
cot(x) | -csc2(x), or -1/sin2(x), or -(1 + cot2(x)) |
sec(x) | sec(x).tan(x) |
csc(x) | -csc(x).cot(x) |
Example
Create a script file and type the following code into it −
syms x y = exp(x) diff(y) y = x^9 diff(y) y = sin(x) diff(y) y = tan(x) diff(y) y = cos(x) diff(y) y = log(x) diff(y) y = log10(x) diff(y) y = sin(x)^2 diff(y) y = cos(3*x^2 + 2*x + 1) diff(y) y = exp(x)/sin(x) diff(y)
When you run the file, MATLAB displays the following result −
y = exp(x) ans = exp(x) y = x^9 ans = 9*x^8 y = sin(x) ans = cos(x) y = tan(x) ans = tan(x)^2 + 1 y = cos(x) ans = -sin(x) y = log(x) ans = 1/x y = log(x)/log(10) ans = 1/(x*log(10)) y = sin(x)^2 ans = 2*cos(x)*sin(x) y = cos(3*x^2 + 2*x + 1) ans = -sin(3*x^2 + 2*x + 1)*(6*x + 2) y = exp(x)/sin(x) ans = exp(x)/sin(x) - (exp(x)*cos(x))/sin(x)^2
Following is Octave equivalent of the above calculation −
pkg load symbolic symbols x = sym("x"); y = Exp(x) differentiate(y,x) y = x^9 differentiate(y,x) y = Sin(x) differentiate(y,x) y = Tan(x) differentiate(y,x) y = Cos(x) differentiate(y,x) y = Log(x) differentiate(y,x) % symbolic packages does not have this support %y = Log10(x) %differentiate(y,x) y = Sin(x)^2 differentiate(y,x) y = Cos(3*x^2 + 2*x + 1) differentiate(y,x) y = Exp(x)/Sin(x) differentiate(y,x)
Octave executes the code and returns the following result −
y = exp(x) ans = exp(x) y = x^(9.0) ans = (9.0)*x^(8.0) y = sin(x) ans = cos(x) y = tan(x) ans = 1+tan(x)^2 y = cos(x) ans = -sin(x) y = log(x) ans = x^(-1) y = sin(x)^(2.0) ans = (2.0)*sin(x)*cos(x) y = cos(1.0+(2.0)*x+(3.0)*x^(2.0)) ans = -(2.0+(6.0)*x)*sin(1.0+(2.0)*x+(3.0)*x^(2.0)) y = sin(x)^(-1)*exp(x) ans = sin(x)^(-1)*exp(x)-sin(x)^(-2)*cos(x)*exp(x)