10 Working with symbolic expressions

 

This chapter covers

  • Modeling algebraic expressions as data structures
  • Writing code to analyze, transform, or evaluate algebraic expressions
  • Finding the derivative of a function by manipulating the expression that defines it
  • Writing a Python function to compute derivative formulas
  • Using the SymPy library to compute integral formulas

If you followed all of the code examples and did all the exercises in chapter 8 and chapter 9, you already have a solid grasp of the two most important concepts in calculus: the derivative and the integral. First, you learned how to approximate the derivative of a function at a point by taking slopes of smaller and smaller secant lines. You then learned how to approximate an integral by estimating the area under a graph with skinny rectangles. Lastly, you learned how to do calculus with vectors by simply doing the relevant calculus operations in each coordinate.

10.1 Finding an exact derivative with a computer algebra system

10.1.1 Doing symbolic algebra in Python

10.2 Modeling algebraic expressions

10.2.1 Breaking an expression into pieces

10.2.2 Building an expression tree

10.2.3 Translating the expression tree to Python

10.2.4 Exercises

10.3 Putting a symbolic expression to work

10.3.1 Finding all the variables in an expression

10.3.2 Evaluating an expression

10.3.3 Expanding an expression

10.3.4 Exercises

10.4 Finding the derivative of a function

10.4.1 Derivatives of powers

10.4.2 Derivatives of transformed functions

10.4.3 Derivatives of some special functions