Vector Functions and Space Curves
A vector function takes a number and returns a vector. Feed it every in an interval and the tips of the output vectors trace a curve in space. This lesson defines vector functions precisely, shows that limits and continuity work one component at a time, and practises turning geometric descriptions into parametrisations, the skill behind every camera path, projectile and spline in software.
For a gentler first look at curves given by parameters, see Parametric Curves; the plane version with calculus is in Curves Defined by Parametric Equations.
Definition
A vector-valued function (vector function) is a rule that assigns to each in a domain a vector in :
, and are the component functions. Unless a domain is stated, is the set of for which all three components are defined, that is, the intersection of their domains.
Example: needs (square root) and (logarithm), so .
Limits and continuity
The limit of a vector function is defined by components:
provided the three component limits exist. This is not an arbitrary convention. The -definition " whenever " is equivalent to it, because for any vector
The left inequality shows that if in length then each component converges; the right one shows that if every component converges then the length of the error goes to 0. So all the scalar limit laws carry over: the limit of a sum is the sum of limits, the limit of a dot product is the dot product of the limits, and so on.
is continuous at if as , which happens exactly when , and are all continuous at .
import sympy as sp
t = sp.symbols("t")
r = sp.Matrix([sp.sin(2*t) / t, (1 - sp.cos(t)) / t**2, t * sp.log(t)])
L = r.applyfunc(lambda c: sp.limit(c, t, 0, "+"))
print("limit as t -> 0+:", list(L))
# numerical check: the distance to L shrinks with t
for h in [0.1, 0.01, 0.001]:
v = [float(c.subs(t, h)) for c in r]
err = sum((vi - float(Li))**2 for vi, Li in zip(v, L)) ** 0.5
print(f"t = {h:<6} r(t) = [{v[0]:.5f}, {v[1]:.5f}, {v[2]:.5f}] |r - L| = {err:.5f}")limit as t -> 0+: [2, 1/2, 0]
t = 0.1 r(t) = [1.98669, 0.49958, -0.23026] |r - L| = 0.23064
t = 0.01 r(t) = [1.99987, 0.50000, -0.04605] |r - L| = 0.04605
t = 0.001 r(t) = [2.00000, 0.50000, -0.00691] |r - L| = 0.00691
The third component goes to 0 slowly (like , not like ), and it dominates the error. Defining would make this continuous from the right at 0.
Space curves
If is continuous on an interval , the set of points for is a space curve, and the equations , , are parametric equations of . The vector is the position vector of the point on at parameter .
Two facts to keep apart:
- A curve is a set of points. The same curve has infinitely many parametrisations: and for both give the unit circle (the second goes round once, the first only halfway). Speed, direction and starting point differ.
- A parametrisation carries timing. Two particles can move along paths that cross without ever colliding, because they reach the crossing at different times.
| Curve | Vector function | Shape |
|---|---|---|
| line through with direction | straight line | |
| circular helix | winds around the cylinder , rising per turn | |
| conical spiral | lies on the cone | |
| twisted cubic | crosses every plane at most three times | |
| torus knot | winds times around the axis, times through the hole |
To check that a curve lies on a surface, substitute: for the conical spiral, .
Curves as intersections of surfaces
A common task is to parametrise the curve where two surfaces meet. The strategy is to parametrise the surface that is easiest (often a cylinder), then solve the other equation for the remaining coordinate.
Intersection of the cylinder and the surface :
The curve goes up and down twice per trip around the cylinder, like the edge of a saddle-shaped potato crisp.
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0, 2 * np.pi, 400)
x, y, z = 2 * np.cos(t), 2 * np.sin(t), 2 * np.sin(2 * t)
print("max |x^2 + y^2 - 4| :", float(np.max(np.abs(x**2 + y**2 - 4))))
print("max |z - x*y| :", float(np.max(np.abs(z - x * y))))
print("highest point at t =", round(float(t[np.argmax(z)]), 3), "z =", round(float(z.max()), 3))
ax = plt.figure(figsize=(6, 4)).add_subplot(projection="3d")
ax.plot(x, y, z, color="crimson", lw=2)
ax.set_title("x² + y² = 4 meets z = xy")
ax.set_xlabel("x"); ax.set_ylabel("y"); ax.set_zlabel("z")max |x^2 + y^2 - 4| : 8.881784197001252e-16
max |z - x*y| : 4.440892098500626e-16
highest point at t = 0.787 z = 2.0
The residuals are at the level of floating-point rounding, which confirms the parametrisation; the peak is at , where .
Intersection versus collision
Paths and intersect where for some and ; the particles collide only if for the same . Solving these systems symbolically is routine:
import sympy as sp
t, s = sp.symbols("t s", real=True)
r1 = sp.Matrix([t, 2 - t, t**2]) # particle A
r2 = sp.Matrix([2*s, s, 4 - 2*s]) # particle B
print("path crossings (t, s):", sp.solve(list(r1 - r2), [t, s], dict=True))
print("collisions (same t) :", sp.solve(list(r1 - r2.subs(s, t)), [t], dict=True))
print("A at t = 4/3 :", list(r1.subs(t, sp.Rational(4, 3))))path crossings (t, s): []
collisions (same t) : []
A at t = 4/3 : [4/3, 2/3, 16/9]
Neither system has a solution. From the first two components and , so and , but then the -components are and , which differ. The paths pass over each other (the third line just shows where A is at ). In 3D, two random curves almost never meet: that is why collision detection tests closest distance, not exact equality.
In software
- Animation and camera paths. A keyframed camera is a vector function of time, usually a piecewise polynomial such as a Bézier curve or a Catmull-Rom spline. Continuity of (no jumps) is the minimum; the next lessons demand continuous derivatives too.
- Projectiles and particles. Every particle in an effects system has a position , often in closed form () so it can be evaluated at any frame without stepping.
- Procedural geometry. Tubes, cables, roads and roller-coaster tracks are generated by sweeping a cross-section along a space curve. Helices give springs and screw threads; torus knots are a classic shader and 3D-printing demo.
- Collision of moving objects. Continuous collision detection asks whether gets shorter than the sum of radii for some in a frame, the "same " condition above with a tolerance.
Exercises
Exercise 1: Domain
Find the domain of .
Answer
.
Solution
Exercise 2: A limit
Compute as .
Answer
.
Solution
Component by component: (it is the derivative of at 0, or use l'Hospital's rule); because and the extra factor ; .
import sympy as sp
t = sp.symbols("t")
print([sp.limit(c, t, 0) for c in [(sp.exp(3*t) - 1)/t, t**2*sp.log(sp.Abs(t)), sp.tan(t)/t]])[3, 0, 1]
Exercise 3: Cylinder meets plane
Find a vector function for the curve where the cylinder meets the plane .
Answer
, (an ellipse).
Solution
Parametrise the cylinder with , . The plane gives . The curve is a plane section of a cylinder, so it is an ellipse, tilted at 45°.
Exercise 4: Do they collide? (code)
Particle A moves on and particle B on . Do their paths cross? Do they collide? Use SymPy.
Answer
The paths cross only at , reached by A at and by B at . They never collide.
Solution
Crossing: , , . The first gives , then , so or . () satisfies the third equation; () gives . Collision would need , impossible.
import sympy as sp
t, s = sp.symbols("t s")
r1 = sp.Matrix([t, t**2, t**3])
r2 = sp.Matrix([1 + s, 1 + 3*s, 1 - s])
print("crossings:", sp.solve(list(r1 - r2), [t, s], dict=True))
print("collisions:", sp.solve(list(r1 - r2.subs(s, t)), t))crossings: [{s: 0, t: 1}]
collisions: []
Exercise 5: Which surface?
Show that the curve lies on a sphere, and name the sphere.
Answer
It lies on the unit sphere .
Solution
As goes from 0 to the point moves from the north pole to the south pole while circling the -axis five times: a spherical spiral.
Test yourself
When is a vector function continuous at ?
- When at least one component is continuous at
- When is continuous at
- Exactly when , and are all continuous at
- When
Particles on and collide when…
- for some single value
- for some and
- their paths lie on the same surface
Which surface contains the curve ?
- The sphere
- The cone
- The cylinder
- The plane