```{julia}
#| echo: false
import CalculusWithJulia
logo_url = "https://raw.githubusercontent.com/jverzani/CalculusWithJulia.jl/master/CwJ/misc/logo.png"
txt = """
<div class="card" style="width: 18rem; mx-auto;">
  <img class="card-img-top" src="$logo_url" alt="Card image cap">
</div>
"""
CalculusWithJulia.WeaveSupport.HTMLoutput(txt)
```

{{< include ../_common_code.qmd >}}

# Calculus with Julia


`CalculusWithJulia.jl` is a package for a set of notes for learning [calculus](http://en.wikipedia.org/wiki/Calculus) using the `Julia` language. The package contains some support functions and the files that generate the notes being read now.


Since the mid 90s there has been a push to teach calculus using many different points of view. The [Harvard](http://www.math.harvard.edu/~knill/pedagogy/harvardcalculus/) style rule of four says that as much as possible the conversation should include a graphical, numerical, algebraic, and verbal component. These notes use the programming language [Julia](http://julialang.org) to illustrate the graphical, numerical, and, at times, the algebraic aspects of calculus.


There are many examples of integrating a computer algebra system (such as `Mathematica`, `Maple`, or `Sage`) into the calculus conversation. Computer algebra systems can be magical. The popular [WolframAlpha](http://www.wolframalpha.com/) website calls the full power of `Mathematica` while allowing an informal syntax that is flexible enough to be used as a backend for Apple's Siri feature. ("Siri what is the graph of x squared minus 4?") For learning purposes, computer algebra systems model very well the algebraic/symbolic treatment of the material while providing means to illustrate the numeric aspects. Theses notes are a bit different in that `Julia` is primarily used for the numeric style of computing and the algebraic/symbolic treatment is added on. Doing the symbolic treatment by hand can be very beneficial while learning, and computer algebra systems make those exercises seem kind of pointless, as the finished product can be produced much easier.


Our real goal is to get at the concepts using technology as much as possible without getting bogged down in the mechanics of the computer language. We feel `Julia` has a very natural syntax that makes the initial start up not so much more difficult than using a calculator. The notes restrict themselves to a reduced set of computational concepts. This set is sufficient for working many of the problems in calculus, but do not cover thoroughly many aspects of programming. (Those who are interested can go off on their own and `Julia` provides a rich opportunity to do so.) Within this restricted set, are operators that make many of the computations of calculus reduce to a function call of the form `action(function, arguments...)`. With a small collection of actions that can be composed, many of the problems associated with introductory calculus can be attacked.


These notes are presented in pages covering a fairly focused concept, in a spirit similar to a section of a book. Just like a book, there are try-it-yourself questions at the end of each page. All have a limited number of self-graded answers. These notes borrow ideas from many sources including [Strang](https://ocw.mit.edu/resources/res-18-001-calculus-online-textbook-spring-2005/), [Knill](http://www.math.harvard.edu/~knill/teaching), [Schey](https://www.amazon.com/Div-Grad-Curl-All-That/dp/0393925161/), Thomas Calculus, Rogawski and Adams, and several Wikipedia pages.


## Getting started with Julia


Before beginning, we need to get started with Julia. This is akin to going out and buying a calculator, though it won't take as long.


  * [Getting started](misc/getting_started_with_julia.html)


---


[launch binder](https://mybinder.org/v2/gh/CalculusWithJulia/CwJScratchPad.git/master)


Julia can be used through the internet for free using the [mybinder.org](https://mybinder.org) service. Click on the `CalculusWithJulia.ipynb` file after launching Binder by clicking on the badge.


## Precalculus


Many of the necessary computational skills needed for employing `Julia` successfully to assist in learning calculus are in direct analogy to concepts of mathematics that are first introduced in precalculus or prior. This precalculus *review*, covers some of the basic materials mathematically (though not systematically). More importantly it illustrates the key computational mechanics we will use throughout.


A quick rundown of the `Julia` concepts presented in this section is in a [Julia overview](precalc/julia_overview.html).


### Number systems


Taking for granted a familiarity with basic calculators, we show in these two sections how `Julia` implements the functionality of a calculator in a manner not so different.


  * [Calculator](precalc/calculator.html)
  * [Variables](precalc/variables.html)


Calculators really only use one type of number - floating point numbers. Floating point numbers are a model for the real numbers. However, there are many different sets of numbers in mathematics. Common ones include the integers, rational numbers, real numbers, and complex numbers.  As well, we discuss logical values and vectors of numbers. Though integers are rational numbers, rational numbers are real numbers, and real numbers may be viewed as complex numbers, mathematically, these distinctions serve a purpose. `Julia` also makes these distinctions and more.


  * [Number systems](precalc/numbers_types.html)
  * [Inequalities and Boolean values](precalc/logical_expressions.html)


Vectors as a mathematical object could be postponed for later, but they are introduced here as the `Julia` implementation makes an excellent choice for a container of one or more values. We also see how to work with more than one value at a time, a useful facility in future work.


  * [Vectors](precalc/vectors.html)


An arithmetic progression is a sequence of the form $a, a+h, a+2h, \dots, a+kh$. For example $3, 10, 17, 24, .., 52$. They prove very useful in describing collections of numbers. We introduce the range operator that models these within `Julia` and broadcasting, mapping, and comprehensions – various styles that allow one to easily modify the simple sequences.


  * [Arithmetic progressions](precalc/ranges.html)


### Functions


The use of functions within calculus is widespread. This section shows how the basic usage within `Julia` follows very closely to common mathematical usage. It also shows that the abstract concept of a function is quite valuable.


  * [Functions](precalc/functions.html)


A graphing calculator makes it very easy to produce a graph. `Julia`, using the `Plots` package, makes it even easier and more flexible.


  * [Graphs of functions](precalc/plotting.html)
  * [Transformations of functions](precalc/transformations.html)
  * [Inverse functions](precalc/inversefunctions.html)


#### Polynomials


Polynomials play an important role in calculus. They give a family of functions for which the basic operations are well understood. In addition, they can be seen to provide approximations to functions. This section discusses polynomials and introduces the add-on package `SymPy` for manipulating expressions in `Julia` symbolically. (This package uses the SymPy library from Python.)


  * [Polynomials](precalc/polynomial.html)


The roots of a univariate polynomial are the values of $x$ for which $p(x)=0$. Roots are related to its factors. In calculus, the zeros of a derived function are used to infer properties of a function. This section shows some tools in `SymPy` to find factors and roots, when they are available, and introduces the `Roots` package for estimating roots numerically.


  * [Polynomial roots](precalc/polynomial_roots.html)


The `Polynomials` package provides methods for working with polynomials of different types.


  * [The `Polynomials` package](precalc/polynomials_package.html)


A rational expression is the ratio of two polynomial expressions. This section covers some additional details that arise when graphing such expressions.


  * [Rational functions](precalc/rational_functions.html)


#### Exponential and logarithmic functions


  * [Exponential and logarithmic functions](precalc/exp_log_functions.html)


#### Trigonometric functions


Trigonometric functions are used to describe triangles, circles and oscillatory behaviors. This section provide a brief review.


  * [Trigonometric functions](precalc/trig_functions.html)


## Limits and Continuity


The notion of a limit is at the heart of the two main operations of calculus: differentiation and integration.


  * [Limits](limits/limits.html)
  * [Examples and extensions of the basic limit definition](limits/limits_extensions.html)


Continuous functions are at the center of any discussion of calculus concepts. These sections define them and illustrate a few implications for continuous functions.


  * [Continuity](limits/continuity.html)
  * [Implications of continuity](limits/intermediate_value_theorem.html) includes the intermediate value theorem, the extreme value theorem and the bisection  method.


## Derivatives


The derivative of a function is a derived function that for each $x$ yields the slope of the *tangent line* of the graph of $f$ at $(x,f(x))$.


  * [Derivatives](derivatives/derivatives.html)
  * [Numeric derivatives](derivatives/numeric_derivatives.html)
  * [Symbolic derivatives](derivatives/symbolic_derivatives.html)


The derivative of a function has certain features. These next sections explore one of the first uses of the derivative - using its zeros to characterize the original function.


  * [The Mean Value Theorem](derivatives/mean_value_theorem.html)
  * [Optimization](derivatives/optimization.html)
  * [First and second derivatives](derivatives/first_second_derivatives.html)
  * [Curve sketching](derivatives/curve_sketching.html)


The tangent line to the graph of a function at a point has slope given through the derivative. That the tangent line is the best linear approximation to the curve yields some insight to the curve through knowledge of just the tangent lines.


  * [Linearization](derivatives/linearization.html)
  * [Newton's method](derivatives/newtons_method.html)
  * [Derivative-free zero-finding methods](derivatives/more_zeros.html)
  * [L'Hospital's rule](derivatives/lhospitals_rule.html)


The derivative finds use outside of the traditional way of specifying a function or relationship. These two sections look at some different cases.


  * [Implicit differentiation](derivatives/implicit_differentiation.html)
  * [Related rates](derivatives/related_rates.html)


A generalization of the tangent line as the "best" approximation to a function by a line leads to the concept of the Taylor polynomial.


  * [Taylor polynomials](derivatives/taylor_series_polynomials.html)


## Integration


The integral is initially defined in terms of an associated area and then generalized. The Fundamental Theorem of Calculus allows this area to be computed easily through a related function and specifies the relationship between the integral and the derivative.


  * [Area](integrals/area.html)
  * [The Fundamental Theorem of Calculus](integrals/ftc.html)


Integration is not algorithmic, but rather problems can involve an array of techniques. Many of these are implemented in `SymPy`. Theses sections introduce the main techniques that find widespread usage.


  * [Substitution](integrals/substitution.html)
  * [Integration by parts](integrals/integration_by_parts.html)
  * [Partial fractions](integrals/partial_fractions.html)
  * [Improper integrals](integrals/improper_integrals.html)


### Applications


Various applications of the integral are presented. The first two sections continue with the idea that an integral is related to area. From there, it is seen that volumes, arc-lengths, and surface areas may be expressed in terms of related integrals.


  * [Mean Value Theorem for integrals](integrals/mean_value_theorem.html)
  * [Area between curves](integrals/area_between_curves.html)
  * [Center of mass](integrals/center_of_mass.html)
  * [Volumes by slicing](integrals/volumes_slice.html)
  * [Arc length](integrals/arc_length.html)
  * [Surface Area](integrals/surface_area.html)


### Ordinary differential equations


Ordinary differential equations are an application of integration and the fundamental theorem of calculus.


  * [ODEs](ODEs/odes.html)
  * [Euler method](ODEs/euler.html)
  * [The problem-algorithm-solve interface](ODEs/solve.html)
  * [The DifferentialEquations suite of packages](ODEs/differential_equations.html)


## Multivariable calculus


Univariate functions take a single number as an input and return a number as the output. Notationally, we write $f: R \rightarrow R$. More generally, a function might have several input variables and might return several output variables, notationally $F: R^n \rightarrow R^m$, for positive, integer values of $n$ and $m$. Special cases are when $n=1$ (a space curve) or when $m=1$ (a scalar-valued function). Many of the concepts of calculus for univariate functions carry over, with suitable modifications.


Polar coordinates are an often useful alternative to describing location in the $x$-$y$ plane.


  * [Polar Coordinates](differentiable_vector_calculus/polar_coordinates.html)


The calculus of functions involving more than $1$ variable is greatly simplified by the introduction of vectors and matrices. These objects, and their associated properties, allow many of the concepts of calculus of a single variable to be carried over.


  * [Vectors](differentiable_vector_calculus/vectors.html)


### Differentiable vector calculus


In general we will consider multivariable functions from $R^n$ into $R^m$ (functions of $n$ variables that return $m$ different values), but it is helpful to specialize to two cases first. These are vector valued functions ($f: R \rightarrow R^n$) and scalar functions ($f:R^n \rightarrow R$).


  * [Vector-valued functions](differentiable_vector_calculus/vector_valued_functions.html)
  * [Scalar functions and their derivatives](differentiable_vector_calculus/scalar_functions.html)


We discuss applications of the derivative for scalar functions. These include linearization, optimization, and constrained optimization.


  * [Applications for scalar functions](differentiable_vector_calculus/scalar_functions_applications.html)


The derivative of a mulitvariable function is discussed here. We will see that with the proper notation, many formulas from single variable calculus will hold with slight modifications.


  * [Vector fields](differentiable_vector_calculus/vector_fields.html)


### Integral vector calculus


Integral vector calculus begins with a generalization of integration to compute area to integration to compute volumes (and its generalization to higher dimensions). The integration concept is then extended to  integration over curves and surfaces. With this, generalizations of the fundamental theorem of calculus are discussed.


We begin with the generalization of the Riemann integral to compute area to the computation of volume and its higher dimensional interpretations.


  * [Double and triple integrals](integral_vector_calculus/double_triple_integrals.html)


Line and surface integrals are computed by 1- and 2-dimensional integrals, but offer new interpretations, especially when vector fields are considered.


  * [Line and surface integrals](integral_vector_calculus/line_integrals.html)


There are three main operations in differential vector calculus, the gradient, the divergence, and the curl. This is an introduction to the two latter ones.


  * [Divergence and curl](integral_vector_calculus/div_grad_curl.html)


The fundamental theorem of calculus states that a definite integral over an interval can be computed using a related function and the boundary points of the interval. The fundamental theorem of line integrals is a higher dimensional analog. In this section, related theorems are considered: Green's theorem in $2$ dimensions and Stokes' theorem and the divergence theorem in $3$ dimensions.


  * [Green's theorem, Stokes' theorem, and the divergence theorem](integral_vector_calculus/stokes_theorem.html)


---


Here is a quick review of the math topics discussed on vector calculus.


  * [Review of vector calculus](integral_vector_calculus/review.html)


For reference purposes, there are examples of creating graphics for `Plots`,`Makie`, and `PlotlyLight`.


  * [Two- and three-dimensional graphics with Plots](differentiable_vector_calculus/plots_plotting.html)
  * [Two- and three-dimensional graphics with Makie](alternatives/makie_plotting.html)
  * [Two- and three-dimensional graphics with PlotlyLight](alternatives/plotly_plotting.html)


## Bibliography


  * [Bibliography](misc/bibliography.html)


## A quick review


  * [Quick notes](misc/quick_notes.html)


A review of the `Julia` concepts used within these notes.


## Miscellaneous


  * Some different [interfaces](misc/julia_interfaces.html)  to `Julia`.
  * The [CalculusWithJulia](misc/calculus_with_julia.html) package.
  * [Unicode symbol](misc/unicode.html) usage in `Julia`.


---


## Contributing, commenting, ...


This is a work in progress. To report an issue, make a comment, or suggest something new, please file an [issue](https://github.com/jverzani/CalculusWithJulia.jl/issues/). In your message add the tag `@jverzani` to ensure it is not overlooked. Otherwise, an email to `verzani` at `math.csi.cuny.edu` will also work.


To make edits to the documents directly, a pull request with the modified `*.jmd` files in the `CwJ` directory should be made. Minor edits to the `*.jmd` files should be possible through the GitHub web interface. In the footer of each page a pencil icon accompanying "suggest an edit" when clicked should cause the opening of the corresponding `*.jmd` file on GitHub for suggesting modifications. The html files will be generated independently, that need not be done.
