# Math 141, Lesson 36: Multivariable Functions

The lesson page, with interactive tools and R in the browser: https://tangentspace.org/lessons/36/

This lesson is marked "Updates coming": parts of it are still being written.

Reading: MMAC Ch 1.2, pp 19-32

Practice: Optional HW 36 **[Q?? and Q??]**.

Interactive tools: [Surface and Held-Constant Graphs](https://tangentspace.org/tools/surface-slices/)

## Objectives

1. Given a multivariable function, evaluate it at a given point, by hand or in R.
2. Given a multivariable function in tabular or graphical form, evaluate it at given points and identify whether it is increasing or decreasing with respect to each input.
3. Given a surface or contour plot, estimate where extreme values (min/max) occur.
4. In R, use `makeFun()` to define a multivariable function.
5. In R, use `plotFun()` to generate a surface or contour plot for a two-input function on a specified domain.

## 1. Multivariable Functions

*Objective.* Given a multivariable function, evaluate it at a given point, by hand or in R.

**Definition 1** (Multivariable function).

A *multivariable function* is a function with two or more inputs and only one output. A function of the two inputs $x$ and $y$ is written

$$f(x,y).$$

A rule that gives both the temperature and the wind speed at the map location $(x,y)$ is not a multivariable function, because it has two outputs and the definition allows only one. The temperature at $(x,y)$ alone is a multivariable function.

A point $(a,b)$ gives the value $a$ to the input $x$ and the value $b$ to the input $y$. The value of $f$ at the point $(a,b)$ is $f(a,b)$, found by substituting $a$ for every $x$ and $b$ for every $y$. A point with more coordinates gives them to the inputs in the order the inputs are written: the point $(a,b,c)$ gives $a$ to $x$, $b$ to $y$, and $c$ to $z$ in $k(x,y,z)$.

### Example 1

Evaluate the function at $(3,2)$, $(0,-2.1)$, and $(-2.1,5)$, if possible:

$$f(x,y) = 4x^2 - 5y\sqrt{x+1}.$$

**Solution.**

By the definition of a multivariable function, $f$ has the two inputs $x$ and $y$, and each point $(x,y)$ gives one output. Substitute $x = 3$ and $y = 2$ into the formula for $f$:

$$f(3,2) = 4(3)^2 - 5(2)\sqrt{3+1} = 4(9) - 5(2)(2) = 36 - 20 = 16.$$

Substitute $x = 0$ and $y = -2.1$:

$$f(0,-2.1) = 4(0)^2 - 5(-2.1)\sqrt{0+1} = 0 - 5(-2.1)(1) = 0 + 10.5 = 10.5.$$

At $(-2.1,5)$, check the expression under the square root first:

$$x + 1 = -2.1 + 1 = -1.1.$$

The value $f(-2.1,5)$ is undefined, because no real number is the square root of $-1.1$.

### Example 2

Evaluate the function at $(3,8,4)$, $(1,9,-3)$, and $(5,2,0)$, if possible:

$$k(x,y,z) = 2x - \frac{y}{z}.$$

**Solution.**

Substituting each point into the formula gives

$$k(3,8,4) = 2(3) - \frac{8}{4} = 6 - 2 = 4,$$

$$k(1,9,-3) = 2(1) - \frac{9}{-3} = 2 + 3 = 5.$$

The value $k(5,2,0)$ is undefined, because $z = 0$ makes $\tfrac{y}{z}$ a division by zero.

Example 8 in section 4 evaluates $f$ and $k$ at these points in R.

## 2. Tables and Graphs

*Objective.* Given a multivariable function in tabular or graphical form, evaluate it at given points and identify whether it is increasing or decreasing with respect to each input.

*Tabular form.* A table of a two-input function lists the values of one input across the top row and the values of the other input down the left column. The corner cell names both inputs. In the corner cell $V \backslash T$ of the table in Example 3, the input $V$ left of the backslash labels the rows, and the input $T$ right of the backslash labels the columns. The output at a point sits in the cell where the point’s row and column cross.

**Definition 2** (Increasing and decreasing with respect to an input).

*Increasing with respect to an input* means that, on an interval of one input, the output always gets larger as that input increases while every other input is held constant at a given value.

*Decreasing with respect to an input* means that, on an interval of one input, the output always gets smaller as that input increases while every other input is held constant at a given value.

With every other input held constant, the output depends on one input alone, as for a function of one input.

A ball thrown straight up at $v$ meters per second has height

$$H(t,v) = vt - 4.9t^2$$

meters $t$ seconds after release. With $v = 19.6$, the function $H$ is neither increasing nor decreasing with respect to $t$ on $0 \le t \le 4$, because the output neither always gets larger nor always gets smaller on that interval. The output rises from $H(0,19.6) = 0$ to $H(2,19.6) = 19.6$ and falls back to $H(4,19.6) = 0$.

### Example 3

The table gives $WC(T,V)$, the wind chill ($^\circ$F) at air temperature $T$ ($^\circ$F) and wind speed $V$ (mph).

| $V \backslash T$ | $-10$ | $0$ | $10$ | $20$ | $30$ |
| --- | --- | --- | --- | --- | --- |
| $5$ | $-22$ | $-11$ | $1$ | $13$ | $25$ |
| $10$ | $-28$ | $-16$ | $-4$ | $9$ | $21$ |
| $20$ | $-35$ | $-22$ | $-9$ | $4$ | $17$ |
| $30$ | $-39$ | $-26$ | $-12$ | $1$ | $15$ |
| $40$ | $-43$ | $-29$ | $-15$ | $-1$ | $13$ |

Find $WC(10,20)$ and $WC(30,10)$. Then, over the inputs in the table, determine whether $WC$ is increasing or decreasing with respect to $T$ when $V = 20$, and with respect to $V$ when $T = 0$.

**Solution.**

Read the temperature $T$ from the top row and the wind speed $V$ from the left column. The column $T = 10$ and the row $V = 20$ give $WC(10,20) = -9$. The column $T = 30$ and the row $V = 10$ give $WC(30,10) = 21$.

By the definition of increasing with respect to an input, hold $V = 20$ constant and read the outputs as $T$ increases. The function $WC$ is increasing with respect to $T$ when $V = 20$, because the row $V = 20$ runs $-35, -22, -9, 4, 17$ as $T$ increases. Hold $T = 0$ constant and read down its column. The function $WC$ is decreasing with respect to $V$ when $T = 0$, because the column $T = 0$ runs $-11, -16, -22, -26, -29$ as $V$ increases.

Each graph plots the output against one input with the other input held constant. The first two graphs plot the wind chill $WC(T,V)$ ($^\circ$F) at air temperature $T$ ($^\circ$F) and wind speed $V$ (mph). Their points are the cells of the row $V = 5$ and the column $T = 30$ of the table in Example 3.

**Increasing**

![Figure](https://tangentspace.org/lessons/fig/ad9e5822c73a.svg)

With the wind speed held at 5 mph, the wind chill rises from $-22$ to $25\,^\circ$F as the temperature rises from $-10$ to $30\,^\circ$F.

**Decreasing**

![Figure](https://tangentspace.org/lessons/fig/c281b749de21.svg)

With the temperature held at $30\,^\circ$F, the wind chill falls from 25 to $13\,^\circ$F as the wind speed rises from 5 to 40 mph.

**Neither**

![Figure](https://tangentspace.org/lessons/fig/7ccb46005d8a.svg)

With the throwing speed $v$ held at 19.6 meters per second, the ball rises for 2 seconds and then falls for 2 seconds.

![Figure](https://tangentspace.org/lessons/fig/c7ebe65694ff.svg)

![Figure](https://tangentspace.org/lessons/fig/e48095094615.svg)

The figure shows two graphs of $s(x,y) = x^2 + y^2$. The left graph is its surface plot: each output is a height above its point $(x,y)$. The points of the surface at height 4 form the solid orange circle at the rim. Directly below that circle, the dashed circle $x^2 + y^2 = 4$ in the $xy$-plane contains every point where $s(x,y) = 4$, the level 4 contour. The right graph is the contour plot, with that contour in orange among the contours at levels 1, 2, and 3.

**Definition 3** (Surface plot).

A *surface plot* is a three-dimensional graph where the value of each $f(x,y)$ is plotted as a height $z = f(x,y)$ measured relative to the $z$-axis above or below the corresponding point $(x,y)$ on the $xy$-plane.

**Definition 4** (Contour).

A *contour* of $f(x,y)$ at level $C$ is a curve in the $xy$-plane containing all points where $f(x,y) = C$. A contour is also called a level curve.

For $s(x,y) = x^2 + y^2$, the line $y = x$ is not a contour, because the outputs on it differ: $s(1,1) = 2$ and $s(2,2) = 8$. Every point of a contour at level $C$ has the output $C$.

**Definition 5** (Contour plot).

A *contour plot* is a two-dimensional graph in the $xy$-plane of contours of $f(x,y)$ at various levels.

The left graph in the figure of $s(x,y) = x^2 + y^2$ is not a contour plot, because it is three-dimensional, and the definition requires a two-dimensional graph in the $xy$-plane. The right graph is not a surface plot, because it shows each output as the level of a contour instead of as a height $z = f(x,y)$.

The *plotted domain* is the rectangle of inputs $(x,y)$ that a surface plot or contour plot covers, such as $-3 \le x \le 3$, $-3 \le y \le 3$.

*Outputs on a contour plot.* As in the textbook, every function plotted in these Notes is continuous on the plotted domain. Two contours are adjacent along a straight path when the path meets no other contour between them. On every contour plot in these Notes, the contours lie close enough together that, between two adjacent contours of different levels, the output only rises or only falls. Read an output from the plot by these rules:

1. At a point on a contour, the output is that contour’s level.
2. At a point between two adjacent contours of different levels, the output lies between their two levels.
3. For a contour without a label on a plot with evenly spaced levels, find the level spacing, the difference between the levels of two adjacent labeled contours. Then count the contours out from a labeled contour, one level spacing per contour.

On a contour plot, $x$ increases straight to the right and $y$ increases straight up. The function is increasing with respect to $x$ when the contours along a path straight to the right rise in level, and decreasing with respect to $x$ when they fall in level. The function is increasing with respect to $y$ when the contours along a path straight up rise in level, and decreasing with respect to $y$ when they fall in level.

### Example 4

The figure is the contour plot of $g(x,y)$ on $-3 \le x \le 3$, $-3 \le y \le 3$, with contours at levels $-2$ to 3. Estimate $g(0,1)$, $g(-2,0)$, and $g(2,-1)$. Then determine whether $g$ is increasing or decreasing with respect to $x$ on $0 \le x \le 0.7$ when $y = -1$, and with respect to $y$ on $2 \le y \le 2.7$ when $x = 2$.

**Solution.**

By the definitions of a contour plot and a contour, the figure shows contours of $g$ at levels $-2$ to 3, and every point on the level 2 contour has output 2. The value $g(0,1)$ is approximately 2, because $(0,1)$ is on the level 2 contour. Likewise, $g(-2,0)$ is approximately $-1$, because $(-2,0)$ is on the level $-1$ contour. The value $g(2,-1)$ is between 0 and 1, because $(2,-1)$ is between the level 0 contour and the level 1 contour. The three points are the black dots in the figure.

The function $g$ is increasing with respect to $x$ on $0 \le x \le 0.7$ when $y = -1$, because the green path straight right from $(0,-1)$ starts between the level $-1$ and level 0 contours and crosses the level 0 contour toward higher levels. The function $g$ is decreasing with respect to $y$ on $2 \le y \le 2.7$ when $x = 2$, because the purple path straight up from $(2,2)$ starts between the level 2 and level 1 contours and crosses the level 1 contour toward lower levels.

![Figure](https://tangentspace.org/lessons/fig/548eca71967c.svg)

## 3. Extreme Values

*Objective.* Given a surface or contour plot, estimate where extreme values (min/max) occur.

**Definition 6** (Extreme values).

The *extreme values* are the maximum and minimum values of the function.

The *global maximum* of $f(x,y)$ on a plotted domain is the numeric value $f(a,b)$ for a point $(a,b)$ in the plotted domain such that $f(a,b) \ge f(x,y)$ for all $(x,y)$ in the plotted domain.

The *global minimum* of $f(x,y)$ on a plotted domain is the numeric value $f(a,b)$ for a point $(a,b)$ in the plotted domain such that $f(a,b) \le f(x,y)$ for all $(x,y)$ in the plotted domain.

On the plotted domain $0 \le x \le 3$, $0 \le y \le 3$, the value $r(3,0) = 3$ of $r(x,y) = x + y$ is not the global maximum, because $r(3,3) = 6$ is larger. The definition requires $f(a,b) \ge f(x,y)$ for every point $(x,y)$ in the plotted domain.

On a surface plot, the global maximum is the height of the highest point of the surface, and the global minimum is the height of the lowest point.

A *peak* is a point whose output is at least every output near it, and that output is a *local maximum*. A *basin* is a point whose output is at most every output near it, and that output is a *local minimum*. These are the two-input forms of the one-input definitions in section 3 of the [Lesson 28](https://tangentspace.org/lessons/28/) Notes. A global maximum at a peak inside the plotted domain is also a local maximum, and a global minimum at a basin inside the plotted domain is also a local minimum.

On a contour plot, an extreme value occurs in one of two places.

**Extreme value inside the plotted domain**

![Figure](https://tangentspace.org/lessons/fig/05fed1a9c9a3.svg)

A global maximum inside the plotted domain occurs at a peak, inside an innermost contour of the highest level, with an output above that level. The height $h(x,y) = 9 - x^2 - y^2$ in meters of a hill has its global maximum $h(0,0) = 9$ inside the level 8 contour: the summit is 9 meters high. A global minimum inside the plotted domain occurs at a basin, inside an innermost contour of the lowest level, with an output below that level.

**Extreme value on the edge of the plotted domain**

![Figure](https://tangentspace.org/lessons/fig/984ebbcbe5cf.svg)

When the outputs keep rising toward an edge of the plotted domain and no peak inside reaches higher, the global maximum occurs on that edge. The height $r(x,y) = x + y$ in meters of a ramp rises toward the corner $(3,3)$, and its global maximum is $r(3,3) = 6$: the top of the ramp is 6 meters high. When the outputs keep falling toward an edge and no basin inside reaches lower, the global minimum occurs on that edge.

### Example 5

The figures are the surface plot and the contour plot of $g(x,y)$ on $-3 \le x \le 3$, $-3 \le y \le 3$, with contours at levels $-2$ to 3. Estimate the global maximum and the global minimum of $g$ on this plotted domain, and where each occurs.

![Figure](https://tangentspace.org/lessons/fig/0a23aa20dc31.svg)

![Figure](https://tangentspace.org/lessons/fig/4c99746f20c9.svg)

**Solution.**

By the definition of extreme values, the global maximum is the output $g(a,b)$ that is at least every other output on the plotted domain. By the definition of a surface plot, each output is a height. The highest point of the surface is near $(1,1)$, and the innermost contour of the highest level is the level 3 contour, centered near $(1,1)$. The global maximum is therefore above 3, at approximately $(1,1)$.

The lowest point of the surface is near $(-1.5,-1)$, and the innermost contour of the lowest level is the level $-2$ contour, centered near $(-1.5,-1)$. As a result, the global minimum is below $-2$, at approximately $(-1.5,-1)$.

### Example 6

The figure is the contour plot of

$$p(x,y) = x^2 + xy + y^2 - 3x$$

on $-5 \le x \le 5$, $-5 \le y \le 5$, with contours at levels 5, 20, 50, and 80. Estimate the global minimum and the global maximum of $p$ on this plotted domain, and where each occurs. Then determine where $p$ is increasing and where it is decreasing with respect to $x$ when $y = 1$, as $x$ runs from $-5$ to 5.

![Figure](https://tangentspace.org/lessons/fig/93a321a2a75e.svg)

**Solution.**

The innermost contour of the lowest level is the level 5 contour, centered near $(2,-1)$. The global minimum is below 5 at approximately $(2,-1)$. Substitute $x = 2$ and $y = -1$ into the formula for $p$ to estimate the global minimum:

$$p(2,-1) = 2^2 + 2(-1) + (-1)^2 - 3(2) = 4 - 2 + 1 - 6 = -3.$$

The global minimum is approximately $-3$.

The level 80 contour appears only near the lower-left corner $(-5,-5)$. The global maximum on the plotted domain occurs at that corner, because the outputs keep rising past the level 80 contour toward it. Substitute $x = -5$ and $y = -5$ to find the global maximum:

$$\begin{align*}
p(-5,-5) &= (-5)^2 + (-5)(-5) + (-5)^2 - 3(-5)\\
 &= 25 + 25 + 25 + 15 = 90.
\end{align*}$$

The global maximum is 90, at the corner $(-5,-5)$.

The orange line $y = 1$ runs from $x = -5$ across the level 20 contour and then the level 5 contour, and later crosses the level 5 contour a second time. With $y = 1$ held constant, the function $p$ is first decreasing and then increasing with respect to $x$. Substitute $y = 1$ into the formula to find where the change from decreasing to increasing happens:

$$p(x,1) = x^2 + x(1) + 1^2 - 3x = x^2 - 2x + 1 = (x - 1)^2.$$

The square $(x - 1)^2$ is smallest at $x = 1$. When $y = 1$, the function $p$ is decreasing with respect to $x$ on $-5 \le x \le 1$ and increasing with respect to $x$ on $1 \le x \le 5$.

## 4. Defining a Multivariable Function in R

*Objective.* In R, use `makeFun()` to define a multivariable function.

To define a multivariable function, list every input after the tilde, joined by `&`. To evaluate the function, give a value for each input:

`name = makeFun(formula ~ x & y & z)`

`name(x = 3, y = 4, z = 5)`

Unnamed values in a call go to the inputs in the order written after the tilde. Named values, as in `name(z = 5, y = 4, x = 3)`, go to the named inputs, whatever their order.

### Example 7

Define the function in R and evaluate it at $(3,4,5)$ and $(1.813,-4.267,5.1)$:

$$m(x,y,z) = x^2 + 7y - z.$$

**Solution.**

Define $m$ with `makeFun()` and all three inputs after the tilde. Evaluate it at $(3,4,5)$ three ways (named inputs, named inputs in another order, and unnamed inputs) and then at the second point. Used R.

```r
m = makeFun(x^2 + 7*y - z ~ x & y & z)
m(x = 3, y = 4, z = 5)
#> [1] 32
m(z = 5, y = 4, x = 3)
#> [1] 32
m(3, 4, 5)
#> [1] 32
m(x = 1.813, y = -4.267, z = 5.1)
#> [1] -31.68203
```

R gives $m(3,4,5) = 32$ all three ways and $m(1.813,-4.267,5.1) \approx -31.682$.

### Example 8

Evaluate each function in R at the points given:

$$f(x,y) = 4x^2 - 5y\sqrt{x+1} \quad \text{at } (3,2),\ (0,-2.1),\ (-2.1,5),$$

$$k(x,y,z) = 2x - \frac{y}{z} \quad \text{at } (3,8,4),\ (1,9,-3),\ (5,2,0),\ (4,0,0).$$

**Solution.**

Define $f$ and $k$ with `makeFun()` as in Example 7, and evaluate each at its points. Used R.

```r
f = makeFun(4*x^2 - 5*y*sqrt(x + 1) ~ x & y)
f(x = 3, y = 2)
#> [1] 16
f(x = 0, y = -2.1)
#> [1] 10.5
f(x = -2.1, y = 5)
#> [1] NaN
#> Warning message:
#> In sqrt(x + 1) : NaNs produced
k = makeFun(2*x - y/z ~ x & y & z)
k(x = 3, y = 8, z = 4)
#> [1] 4
k(x = 1, y = 9, z = -3)
#> [1] 5
k(x = 5, y = 2, z = 0)
#> [1] -Inf
k(x = 4, y = 0, z = 0)
#> [1] NaN
```

R gives $f(3,2) = 16$, $f(0,-2.1) = 10.5$, $k(3,8,4) = 4$, and $k(1,9,-3) = 5$, the values Examples 1 and 2 find by hand. R returns `NaN` or `-Inf` in place of a number at the three points where a function is undefined, as it does for one input ([Lesson 2](https://tangentspace.org/lessons/2/) Notes, section 5).

## 5. Plotting a Function of Two Inputs

*Objective.* In R, use `plotFun()` to generate a surface or contour plot for a two-input function on a specified domain.

To plot a function of two inputs, give the formula, both inputs after the tilde, and the plotted domain:

`plotFun(f(x,y) ~ x & y, xlim = range(-5, 5), ylim = range(-5, 5))`

The formula ends in `~ x & y`, which names both inputs. Without that ending, R stops before drawing:

```r
> plotFun(f(x,y), xlim = range(-5, 5), ylim = range(-5, 5))
Error: object 'x' not found
```

The options `xlim` and `ylim` set the plotted domain, here $-5 \le x \le 5$ and $-5 \le y \le 5$, and the axes of the plot end at those values. To read the plotted domain from a finished plot, use the axis ends, which can lie past the last labeled tick mark.

By default, the command `plotFun` draws a shaded contour plot. Three options change the plot:

- with `surface = TRUE`, `plotFun` draws a surface plot in place of the contour plot;
- with `filled = FALSE`, `plotFun` draws the contours without shading;
- with `levels = c(5, 20, 50)`, `plotFun` draws the contours at those levels only.

### Example 9

Define the function in R and evaluate it at $(-1,1)$, $(1,1)$, and $(0,3)$:

$$p(x,y) = x^2 + xy + y^2 - 3x.$$

Then draw its surface plot and an unshaded contour plot at levels $-3$, 5, 20, 50, and 80, both on the plotted domain $-5 \le x \le 5$, $-5 \le y \le 5$. The figure is the unshaded contour plot.

![Figure](https://tangentspace.org/lessons/fig/967aa6fd969d.svg)

**Solution.**

Define $p$ with `makeFun()` and evaluate it at the three points. Used R.

```r
p = makeFun(x^2 + x*y + y^2 - 3*x ~ x & y)
p(-1, 1)
#> [1] 4
p(1, 1)
#> [1] 0
p(0, 3)
#> [1] 9
```

R gives $p(-1,1) = 4$, $p(1,1) = 0$, and $p(0,3) = 9$. On the contour plot, the points $(-1,1)$ and $(1,1)$ lie inside the level 5 contour, where the outputs are below 5. The point $(0,3)$ lies between the level 5 and level 20 contours, and its output 9 lies between 5 and 20. Draw the surface plot, and then the unshaded contour plot at the five levels, on the plotted domain. Used R.

```r
plotFun(p(x,y) ~ x & y, surface = TRUE,
xlim = range(-5, 5), ylim = range(-5, 5))
plotFun(p(x,y) ~ x & y, filled = FALSE,
xlim = range(-5, 5), ylim = range(-5, 5),
levels = c(-3, 5, 20, 50, 80))
```

R draws no level $-3$ contour, for the reason stated after this example.

*Missing levels.* The command `plotFun` draws a contour only at a level that the function reaches at more than one point of the plotted domain. In Example 9, `plotFun` draws no level $-3$ contour, because $p$ reaches $-3$ only at the point $(2,-1)$. Completing the square gives

$$p(x,y) = \left(x - 2 + \frac{y + 1}{2}\right)^2 + \frac{3}{4}(y + 1)^2 - 3.$$

Both squares are 0 only when $y = -1$ and $x = 2$, and every other point gives $p(x,y) > -3$. On the plotted domain $-2 \le x \le 2$, $-2 \le y \le 2$, `plotFun` draws no level 20, 50, or 80 contour, because the largest output there is $p(-2,-2) = 18$. That output sits at the lower-left corner, toward which the outputs rise in the figure of Example 9.

### Example 10

The National Weather Service models the wind chill $WC$ ($^\circ$F) at air temperature $T$ ($^\circ$F) and wind speed $V$ (mph), for $T \le 50$ and $V \ge 3$, by

$$WC(T,V) = 35.74 + 0.6215T - 35.75V^{0.16} + 0.4275TV^{0.16}.$$

Define $WC$ in R and evaluate $WC(10,20)$. Then draw an unshaded contour plot of $WC$ on the plotted domain $-10 \le T \le 30$, $5 \le V \le 40$, with contours at levels $-40$, $-30$, $-20$, $-10$, 0, 10, and 20.

**Solution.**

Define $WC$ with `makeFun()`, listing $T$ and $V$ after the tilde, and evaluate it at $(10,20)$. Used R.

```r
WC = makeFun(35.74 + 0.6215*T - 35.75*V^0.16 +
0.4275*T*V^0.16 ~ T & V)
WC(T = 10, V = 20)
#> [1] -8.876221
```

R gives $WC(10,20) \approx -8.876$. Rounded to a whole degree, the value is the $-9$ in the column $T = 10$ and the row $V = 20$ of the table in Example 3. Draw the contour plot on the plotted domain at the seven levels. With $T$ first after the tilde, R puts $T$ on the horizontal axis. The option `xlim` then sets the range of $T$, and `ylim` sets the range of $V$. Used R.

```r
plotFun(WC(T,V) ~ T & V, filled = FALSE,
xlim = range(-10, 30), ylim = range(5, 40),
levels = c(-40, -30, -20, -10, 0, 10, 20))
```

R labels each contour with its level, as in the figure. The point $(10,20)$ lies between the level $-10$ and level 0 contours, and its output $-8.876$ lies between $-10$ and 0. The function $WC$ is increasing with respect to $T$, because the contours along each path straight right rise in level.

![Figure](https://tangentspace.org/lessons/fig/ce746c721017.svg)
