# Introduction

In Blocks 1 through 3, you learned how to formulate calculus questions in terms of functions and the two main operations of calculus, differentiation and anti-differentiation, which transform one function into another. You also learned the primary use of anti-differentiation, to accumulate the output of a function over an interval of the input variable.

The functions we’ve studied have had one or more inputs, but only a single quantity as output. For many uses, such as to record the trajectory of an object moving through space, we need to coordinate multiple functions, for instance the $$x(t), y(t)$$, and $$z(t)$$ coordinates of the moving object. For velocity there are three corresponding functions: $$\partial_t x(t)$$, $$\partial_t y(t)$$, and $$\partial_t z(t)$$. If we use function graphs to display velocity functions, we end up having three different graphics frames: $$\partial_t x$$ versus $$t$$ as well as $$\partial_t y$$ versus $$t$$ and also $$\partial_t z$$ versus $$t$$. Spreading out the information about the object’s velocity among three graphics frames makes it hard to see the relationship among those quantities.

To streamline thinking about velocity and other things that consist of multiple functions, it’s useful to introduce a new concept: vectors.

For now, we’ll define a vector as a simple set of coordinates such as position on a plane $$(x, y)$$ or position in the three-dimensional world $$(x, y, z)$$. Allowing the output of a function to be vector valued is very much a book-keeping convention. Rather than using separate $$x(t)$$ and $$y(t)$$ functions to represent position, we can use just a single function, say $$\text{pos}(t)$$, that translates the input $$t$$ into an output with $$(x, y)$$ components. One small advantage of this is that functions names can be more meaningful and relationships more concise, for instance $$\text{vel}(t) \equiv \partial_t \text{pos}(t)$$ or $$\text{accel}(t) \equiv \partial_{tt} \text{pos}(t)$$. There’s no magic in applying operations like $$\partial_t$$ or $$\partial_{tt}$$ to vector-valued functions; just apply the operations separately to each component of the vector output.

Vectors will be particularly useful for visualization, both graphical and mental. The graphical convention for presenting vectors is a simple arrow whose direction and length are immediately evident. This contrasts the the usual presentation of a $$(x, y)$$-coordinate as a point in space. The coordinate-point and vector-arrow conventions (Figure 0.1) are both useful, but for different purposes. Figure 0.1: The vector-arrow and coordinate-point presentation of $$(3,2)$$ (blue) and $$(-1, 1.5)$$.

One setting where a vector representation is useful is velocity. In Chapter 33 there’s an example involving a robot arm moving in an $$(x, y)$$-plane. At each instant, the arm has both a $$(x, y)$$-position and an $$(x, y)$$-velocity. Figure 0.2 shows the separate components of position ($$x(t)$$ and $$y(t)$$) and velocity ($$\partial_t x(t)$$ and $$\partial_t y(t)$$) and acceleration ($$\partial_{tt} x(t)$$ and $$\partial_{tt} y(t)$$) in six graphic frames. 0.3

pos_x <- spliner(x ~ t, data = Zcalc::Robot.stations)
pos_y <- spliner(y ~ t, data = Zcalc::Robot.stations)
vel_x <- D(pos_x(t) ~ t)
vel_y <- D(pos_y(t) ~ t)
accel_x <- D(pos_x(t) ~ t & t)
accel_y <- D(pos_y(t) ~ t & t) Figure 0.2: The position, velocity, and acceleration of the robot arm as a function of time. The x-coordinate is the left column, the y-coordinate the right column.

It’s hard to form an image of the motion from these graphs. Better to show the $$x-$$ and $$y-$$ components of position in a single frame, as in Figure 0.3 Figure 0.3: The three coordinate properties of the robot arm motion: position (thin black curve), velocity (blue vector) and acceleration (magenta vector).

Figure 0.3 consolidates into one graphical frame the relationships spread out over six frames in 0.2. The consolidated graph makes it easy to see what the path is, as well as how speed varies along the path and the direction of instantaneous velocity relates to movement along the path. You can also see the relationship between velocity and acceleration; where straight-line motion is slowing down, acceleration points opposite velocity, where speed is increasing, acceleration points in the same direction as velocity. And where the motion is changing direction, acceleration is not aligned with velocity but points toward the curving path.

In Chapter 24 we worked with function having multiple inputs but a single output—not a vector. But differentiation of multiple-input functions involves partial derivatives: there is one partial derivative for each of the inputs. In other words, the output of differentiation of a function of multiple inputs is a vector. For a function $$f(x,y)$$, the vector is $$\left({\large\strut}\partial_x f(x, y),\ \ \partial_y f(x, y)\right)$$. This is called the gradient vector, as described in 24.

To display a function with gradient vectors, calculate the gradient at many different points in the domain. This collection of vectors illustrates a vector field, that is, a vector-valued function of continuous inputs.

The gradient vector is particularly useful when searching for argmaxes or argmins of functions with multiple inputs. (See Chapter 34.) As an example, consider the function of two inputs shown as a gradient field in Figure 0.4. For your convenience, we’ve labelled the local argmin and argmaxes with a dot. Note that the vectors point toward the argmaxes and away from the argmin. Figure 0.4: The gradient field for a function. The gradient vector points the way uphill.

The gradient vector provides a straightforward and intuitive way to locate argmaxes and argmins. Start at some point in the domain of interest. Follow the direction of the gradient vector to find an argmax. For an argmin, walk always against the gradient vector.

The gradient vector carries much the same information as do the contours locally. Figure 0.5 plots the gradient field of the function on top of the contours. At each point in the domain, the gradient vector is perpendicular to the contour through that point. Figure 0.5: Gradient fields carry much the same information as a set of contours. Note that the gradient vector at each point is perpendicular to the contour through that point.

While the contours carry information about the output value of the function, the gradient field shows how steep the function is at any point.