Skip to main content
Mathematics LibreTexts

4.4: Differentiation Using Computer Algebra

  • Page ID
    83934
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    As we noted in chapter 1, in this book we are limiting ourselves to mathematical tools that the student can reasonably expect to find in a generic work environment. That is one of the reasons for focusing on using spreadsheets and Excel. However, we will also look at using free web tools, particularly as a means of doing symbolic manipulation. Differentiation is one of those operations that can be done with free tools available on the web. The student in this course will be expected to routinely do symbolic differentiation by hand. However, it is good to be able to check your work. We also want tools that will work reliably with messier problems.

    In working with derivatives, we have looked at three basic problems:

    • Given a function, find a formula for its derivative. This corresponds to finding the marginal function.
    • Given a function, find the value of the derivative at a particular point. We do this when we want a rate of change at a particular point.
    • Given a function, find where the derivative is 0. We do this when we are trying to find minimum or maximum values of the function.

    There are a number of websites that will take symbolic derivatives. We start with Wolfram|Alpha, which is available at http://www.wolframalpha.com.

    Example 4.4.1: A Simple Derivative with Alpha.

    : Use Wolfram|Alpha to find the derivative of \(x^3+5x+7\text{.}\)

    Solution

    When you call the website, you get an input bar much as you would with your favorite search engine.

    clipboard_e1b79f5176fd7fcb57ee00358400ca1cb.png

    The interface for Wolfram|Alpha is rather robust. We can ask the question in plain English. In our case we would like to find the derivative of x^3+5x+7 with respect to x. Some of the ways of asking that question are:

    • find the derivative of (x^3+5x+7)
    • find the derivative of (x^3+5x+7) with respect to x
    • derivative of (x^3+5x+7)
    • differentiate (x^3+5x+7) with respect to x
    • differentiate (x^3+5x+7)
    • D (x^3+5x+7)
    • d/dx (x^+5x+7)
    • (x^3+5x+7)'

    For all of these, the website provides the same answer.

    clipboard_e0499b8b8720957eae41893f5d4fb37cf.png

    Note that the response tells us the question that Wolfram|Alpha is answering. This helps us check that we have been properly understood.

    It is worthwhile to note that Wolfram|Alpha has an option to show step-by-step solutions.

    clipboard_e2a2806cf54f66e0f4b61aa4002257888.png

    Wolfram|Alpha understands the convention that the variable for math problems is typically x. If we don't specify the variable with respect to which we are differentiating, it will guess that x is our variable. Other letters are treated as constants unless we use function notation with parentheses. Thus we can use Wolfram|Alpha to check our differentiation rules.

    Example 4.4.2: Recalling the Quotient Rule.

    Use Wolfram|Alpha to recall the quotient rule.

    Solution

    clipboard_ed47b78c061d184004168102140dc6c11.png

    It should be noted that Wolfram|Alpha will not work with long variable names like Principal or MonthlyPayment. We simply need to change variables to work with Wolfram|Alpha.

    Example 4.4.3: Working with Long Variable Names.

    The cost of widgets is given by:

    \(cost=2000+10*quantity+.001*quantity^2\)

    Find the rate of change of cost with respect to quantity when quantity=1000. (We are using the derivative to estimate the marginal cost.)

    Solution

    Since we will use Wolfram|Alpha, we want to convert the equation to use single letter variables.

    c=2000+10*q+.001*q^2.

    We want to evaluate the derivative with respect to q when q=1000.

    clipboard_ebd7524a7791bd606df80e9c042307bd3.png

    Thus, when quantity=1000, increasing production by 1 widget increases cost by $12.

    The third basic derivative problem was to find a maximum or minimum. For extrema problems, we want to find where the derivative is 0, since the extrema can only occur at endpoints and critical points.

    Example 4.4.4: Exploring a Business Example.

    The cost and demand price functions of widgets are given by:

    \[ cost=2000+10*quantity+.001*quantity^2 \nonumber \]

    \[ revenue=\frac{100*quantity}{1+.01*quantity} \nonumber \]

    Find the quantity that maximizes profit.

    Solution

    We simplify variable names to q, c, p, and r for quantity, cost, profit and revenue, respectively. Our formula for profit is:

    \[ p=r-c=100q/(1+.01q)-(2000+10q+.001q^2 ) \nonumber \]

    When looking for a maximum, we always start by looking at a graph of the function in question.

    clipboard_e0e3eec16c91b74cac333ec986c673b95.png

    From the graph, it is clear that we have a single maximum for the profit function and it occurs near q=200. To find this point, we want to take the derivative and set it equal to zero, or we want to use the solve command on the derivative. We enter the command

    solve(derivative 100q/(1+.01q)-(2000+10q+.001q^2 ) with respect to q)

    clipboard_e672d7d8f9bbecf93cf3b1a31744931e6.png

    We need to do a bit of interpretation since Wolfram|Alpha is using numerical methods with complex numbers. In particular, the answers have a zero imaginary part. We are also looking for a positive number. Thus, we conclude profit is maximized at 209.8 widgets.

    In looking at free software on the web for taking derivatives we started with Wolfram|Alpha because we can use it throughout the book when Excel does not solve our needs. It is also supported by the company that produces Mathematica®, so it should stay available for the foreseeable future. Another useful source are the solvers from Symbolab https://www.symbolab.com/solver. Symbolab has a collection of solvers for the topics in this course.

    clipboard_e406b918348a4f8da24314ad77f3e2189.png

    It also has a section that lets you do drill and practice with the techniques we have learned. Like WolframAlpha, it gives the option of step-by-step solutions. I find the site a bit more user friendly for math students.

    For individual problems we may want to use other software. For finding derivatives, a quick web search found http://www.derivative-calculator.net/ which is nicer if you are simply checking your work. As with Wolfram|Alpha, the derivative calculator shows you the problem in math form so you can check your syntax.

    clipboard_e722ff5d41dcfca3b8ae70b0cc8760e1d.png

    However, the show steps formatting is nicer since hovering over one step shows the change for that step in the next line.

    clipboard_e327751f1ffb61e09be33d8794805b226.png

    You may find other websites for doing derivatives as well.

    class="

    Exercises: Differentiation Using Computer Algebra Problems

    For 1-12, find the derivative of the given function

    Exercise 1:

    \(f(x)=x \ln(x)\)

    Answer
    clipboard_e508c5399c19fa1c9b003667825993237.png

    So \(f' (x)= \ln(x)+1\text{.}\)

    Exercise 2:

    \(g(t)=e^{.07t} (-t^2+3t+5)\)

    Exercise 3:

    \(h(t)=t^2 e^{-0.06t}\)

    Answer
    clipboard_e1cae4701d99b1d8aad34efc45299aeac.png

    Wolfram returns several forms (they differ by some simple algebra). We can choose the one that has the form we find most useful. In this case we could choose for instance:

    \[ h' (t)=e^{-0.06t} (2t-0.06 t)^2 \nonumber \]

    It’s a nice compact answer that avoids decimal approximations.

    Exercise 4:

    \(k(x)=(2x+5)^{37}\)

    Exercise 5:

    \(m(x)=\ln(\ln(\ln(x^2+3)))\)

    Answer

    Wolfram writes ln as log but still means base \(e\text{.}\) the common log of x would be log(10,x). To stick with our notation we would say

    \[ m'(x)=\frac{2 x}{(x^2+3)ln(x^2+3)ln(ln(x^2+3))} \nonumber \]

    Note that Wolfram allows us to copy the text. Hoover over the answer and under “A” and you will find plaintext that can be copied. This can be edited into a word document or an Excel document.

    Exercise 6:

    \(n(x)=\frac{e^x}{\ln(x^2+3)}\)

    Exercise 7:

    \(price=10-\frac{quantity}{100} -\frac{quantity^2}{10000}\)

    Answer

    Wolfram does not work well with whole word variables. Edit the equation (you can do this in Wolfram) and let \(Price = P(q)\) and \(quantity = q\text{.}\) This gives the following derivative:

    clipboard_ee8c95abd7731a5de0bfb6822cf4cd2bc.png

    This page titled 4.4: Differentiation Using Computer Algebra is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Mike May, S.J. & Anneke Bart via source content that was edited to the style and standards of the LibreTexts platform.