Calculus
摘要
This chapter shows how to solve basic calculus problems using SymPy. Since the principles behind derivatives and integrals are based on the concept of limits, we first start with how to find the limit using SymPy. We then introduce how to find a function’s first and second derivatives. We also present an application for finding the local maxima and minima of a function with a single variable via derivatives. We assume that all functions for which we calculate the derivative are differentiable in their respective domains. In the final section of this chapter, we introduce how to compute integrals using SymPy and demonstrate how integration by substitution and integration by parts work. We can find limits of functions in SymPy by creating objects of the LimitSympy class. Consider a function \(f(x)=\frac{1}{x}\) . Let us find the result of \(\lim _{x \rightarrow \infty } \frac{1}{x}\) as shown in Listing 5.1, with the output of the listing shown immediately under the listing.