Calculus:  Part 1 -- Limits and Derivatives

Comp110 Course Module 3a

Basic Concepts

Calculus was developed to solve two fundamental problems:

Given a function d[t] that returns a distance traveled as a function of time t, compute a function v[t]that returns the instantaneous velocity at a particular time t.

Given a function v[t] that returns the instantaneous velocity at a time t, compute the distance traveled d[t] during the interval from time a to time b.

The solution to the first problem is the derivative. The solution to the second problem is the integral.  Our first scientific exploration in Mathematica focuses on understanding these concepts.

Problems

In this problem, the function D took as input an expression and a variable and took the derivative of the expression with respect to the variable.  Mathematica has a second function Derivative that takes as input a function and returns the function that is the derivative of the input function with respect to its input.  To use D and Derivative correctly, you first need to understand the distinction between expressions and functions.

An expression is simply what you would like Mathematica to evaluate. For example, 1+1 and Sin[(π/2)] are examples of expressions.  A function is a specific type of expression that requires extra input (its parameters) placed inside square brackets.  For example, Plus and Sin are examples of functions.  For novice students distinguishing functions from expressions can be tricky.  Here is a simple test: an expression is a function if you can provide it input enclosed in square brackets.  For example, Plus is a function because it needs the numbers to be added as input.

Plus[1,1]

From another point of view, a function is a name;  an expression is a value.  Thus Sin is a name and therefore a function;  Sin[x] is a value and therefore an expression.  The function Sin takes a single angle (in radians) as input

Sin[(π/2)]

When you define your own functions, the same distinction holds.  For example, if foo[x_]:=2x+3, then foo is a function while  foo[1] is an expression formed by evaluating foo with 1 as its input.

Now, returning to problem 1, we can compute the derivative of the expression Sin[t] with respect to t via

D[Sin[t],t]

On the other hand, we can compute the Derivative of the function Sin via

Sin'

Here, the apostrophe is shorthand for Derivative.  The output of derivative is another function, Cos.  We can verify that this is a function by giving it some input, say the variable t.

Sin'[t]

With this distinction in mind, work the next two problems.

Exercises

Plotting

Mathematica can be used to draw the graph of a single function or of several functions simultaneously.  Below we will learn how to use the Plot function.

Problems

Scientific Exploration and Analysis

In the previous section, we looked up Mathematica functions that compute derivatives and integrals.  We next revisit the definitions of these concepts and derive many of their important properties from first principles.  Our derivation consists of a four-step analysis.

1. Given a physical problem, decide on a set of discrete relations that model solutions to the problem.

2. Next, construct a function that computes the solution to these discrete relations.

3. Then, visualize the behavior of these discrete solutions as the size of the discretization goes to zero.

4. Finally, derive a continuous variant of discrete relations.

This four-step process can be used to analyze and understand a remarkable range of problems.

Limits

Limits are the foundation of calculus.  An infinite sequence of numbers {(Subscript[a, 1]), (Subscript[a, 2]), …} converges to a limit (Subscript[a, ∞]) if for all ϵ>0, there exists an integer j such that for all k>j, |(Subscript[a, k])-(Subscript[a, j])| < ϵ.   This definition means that as j and k get large, the distance between (Subscript[a, k])and (Subscript[a, j]) gets small.  The following problem illustrate some interesting examples of limits.

Problems

Continuous Functions

The preceding section dealt with a discrete sequence of numbers.  In the case of a function, the analogous concept is continuity.  A function f[t] is continuous at a point (Subscript[t, 0])if for all ϵ>0 there exists a δ>0 such that for all t∈[(Subscript[t, 0])-δ,(Subscript[t, 0])+δ], |f[t]-f[(Subscript[t, 0])]|<ϵ.
This definition means that as t gets closer and closer to (Subscript[t, 0]), the distance between f[t] and f[(Subscript[t, 0])] gets smaller and smaller.

A function f[t] is continuous over an interval [a,b] if f[t] is continuous at all points in the interval.  Intuitively, a function f[t] is continuous on the interval [a, b] if the graph of the function f[t] has no holes or jumps on the interval [a, b].  One typical technique for determining whether a function is continuous on an interval is to compute the values of the function on a discrete grid of points and then consider the difference of adjacent values.  If the maximum of the absolute values of these differences converges to zero as the grid gets finer and finer, then the function is continuous on the interval.

Problems

Derivatives

Recall our original motivating problem.  Given a function d[t] that measures the distance traveled in time t, we desire a function v[t] that measures the instantaneous velocity at a given time t.  The average velocity between two distinct times (Subscript[t, 2]) and (Subscript[t, 1])is simply the change in d[t] divided by the time interval (Subscript[t, 2])-(Subscript[t, 1]),

((d[t+ϵ]-d[t])/ϵ).

Now, the derivative of the function d[t] is simply the limit of this expression as ϵ->0,

d'[t]=(Underscript[limit, ϵ->0])((d[t+ϵ]-d[t])/ϵ).

If d[t] is distance traveled, the instantaneous velocity v[t] is just the derivative d'[t] of d[t].  In Mathematica, we can compute the derivative of an expression d[t] with respect to variable t via D[d[t],t] or we can compute the derivative of a function d with respect to its argument using the function Derivative[d] (with shorthand d').

Problems