At any point, you can submit your answers by collecting them and uploading them to the class site.

No answers yet collected

Link to upload site

If requested by your instructor, please identify here the people from whom you received assistance on this assignment.

If the answers that have been loaded automatically are not yours, press this button before starting your work:

5 Exercises: Functions

Exercise 5. 1  

graph LR
  X(X)
  Y(Y)
  Z(Z)
  U(U)
  V(V)
  W(W)

  X --> W
  Z --> W
  W --> U
  Y --> U
  U --> V
  Y --> V

  
classDef exogenous fill:#fff,stroke-width:1px



class X exogenous
class Y exogenous
class Z exogenous

  1. Which quantities are exogenous?
jos-1-ekf
X Y Z       U V W       X W U V       V      

For the endogenous quantities, each of the round-cornered, shaded boxes is a function. The output of the function is the quantity named in the box. The inputs to the function are the names of the quantities that are connected to the box by incoming arrows.

  1. What are the inputs to the function V()?
jos-2-hgw
U       W & U & Y       U & Y       none. V is exogenous      

  1. What are the inputs to the function W()?
jos-3-s4w
U       X only       X & Z       none. W is exogenous      

  1.    jos-4-dw
    True     or       False      
    Is this collection of functions consistent with the system diagram?
    1. U(W, Y)
    2. V(U, Y)
    3. W(X, Z)
  2. Consider a new system consisting of these functions and their inputs.
    1. B(A, E)
    2. D(B, F)
    3. F(B)
    4. C(F, A)

Which are the exogenous quantities?

jos-5-was

C & A

B & F

A & E

C & F


Exercise 5. 2 Here are several quantities related to the function and economics of a solar power system.

For each of these system quantities, say whether the quantity is exogenous or endogenous. Keep in mind that the distinction is entirely about which quantities are connected to which. You will have to read through the whole list of system quantities to be able to say which are exogenous. Since you are not yet a solarphotaic engineer or financier, you’ll have to use your best judgement about which quantities are connected as inputs to any given quantity.

  1. latitude (degrees) of the site    cfs-1-iynwq

    endogenous     or       exogenous      

  2. electricity price (USD/kWh) at which you can sell the power generated.   cfs-2-btuqn

    endogenous     or       exogenous      

  3. average cloudiness (%)    cfs-3-ujkzw

    endogenous     or       exogenous      

  4. interest rate (%)    cfs-4-jzieq

    endogenous     or       exogenous      

  5. system cost (USD)    cfs-5-tbamv

    endogenous     or       exogenous      

  6. area (m2) of the solar panels    cfs-6-rqlvw

    endogenous     or       exogenous      

  7. inclination (degrees) of the solar panels    cfs-7-oecki

    endogenous     or       exogenous      

  8. instantaneous power maximum capacity (kW)    cfs-8-txjdw

    endogenous     or       exogenous      

  9. yearly energy production (MWh)    cfs-9-rgehu

    endogenous     or       exogenous      

  10. return on investment (%)    cfs-1-vclxo

    endogenous     or       exogenous      

Perhaps there was one or more quantities that you weren’t sure was related to the others. Identify one and write briefly about which possible input quantities you were ambivalent about and whence stems your ambivalence. Or, pick one of the quantities and explain which other quantities you regarded as an input.

How many inputs must the function producing a quantity have in order to consider the quantity exogenous?

cfs-exo
0       1       two or more       no more than 1      


Exercise 5. 3 Consider an everyday kind of question: Which is more to blame for discomfort in hot weather, the temperature or the humidity?

The blame question makes sense only if we think that humidity and temperature have something to do with comfort. Everyday experience strongly suggests that they do. For quantitative understanding, we can translate “something to do with …” into a mathematical framework: that comfort is a function of humidity and temperature. Functions are not the only way to represent the idea of “something to do with,” but experience has shown that they are powerful ways to do so. Knowing how functions are constructed and how to extract information from them is an essential component of quantitative analysis.

In Steadman’s model, sultriness is constructed as a function of temperature and relative humidity. That is, the inputs to the function are temperature and humidity. The output is sultriness. You can calculate the sultriness corresponding to the values of the inputs in Fig E5. 1.

Inputs:


Figure E5. 1: The sultriness function. Set the inputs with the sliders and the corresponding output is shown below.

Fig E5. 1 shows three values. When you change the inputs, the output changes accordingly. That is the characteristic of a function. The presentation in Fig E5. 1 is adequate for someone who wants to compute the sultriness for given weather conditions. We gain more insight into sultriness if we present the output of the function for many different sets of inputs. Steadman’s paper displayed the function as a printed table, which was the only practical way of communicating such a complicated function in 1979 (that is, before the widespread availability of calculators or computers).

  1. True or false: there are temperature/humidity combinations at which the output temperature (that is, the sultriness index) is lower than the input ambient temperature?    gcb-1-kwe

    True     or       False      

  2. At an input temperature of 37 C (that is, body temperature) what is the highest humidity level for which the inputs are in bounds?

gcb-2-e4kf
60       62       64       65      

  1. Set the inputs to 37 degrees C and zero humidity. Note the function output.

3a. What’s the greatest amount you can change the humidity input without changing the function output?

gcb-3a-ekxe

9 percentage points

11 percentage points

13 percentage points

15 percentage points

3b. At 0% humidity, there is some input temperature where the output temperature is greater than the input.    gcb-3b-2se
True     or       False      

3c. At 50% humidity, there is some input temperature where the output temperature is greater than the input.    gcb-3c-2se
True     or       False      

  1. At 50% humidity, what’s the highest possible value for the output?
gcb-4-chsle
49       51       53       55      

  1. At 100% humidity, set the input temperature to 20 deg C. The output will be 15 deg C. Now raise the input temperature slowly. Use the up-and-down triangles in the box showing the input temperature, so that you can change temperature by 0.1 deg C each click.

5a. How many clicks are required to raise the output temperature to 16 deg C?

gcb-5a-oeie
4       5       6       7      

5b. What is the rate of change of output temperature with respect to the input temperature at with the inputs (20 C, 100%)?

gcb-5b-oeie

0.4 deg C

2.5 deg C per percentage point

2.5 (dimensionless)

2.5 deg C


Exercise 5. 4 Graphs of a function of one input, as in Figure 5.4, are familiar to many students from high school math courses. They are easily constructed with a computer. For our purposes, we use a package called {mosaicCalc} which provides several utilities for making graphics. To make a graph of a function with one input, you will need three pieces of information:

  1. What is the function you want to graph?
  2. What name you want to use for the input to the function?
  3. What graphics domain you want to show in the graph?

The command to use in R/mosaic is slice_plot(). It takes two arguments. For demonstration purposes, we’ll plot the hillside() function, using z as the name of the input and displaying the graph over the domain from -4 to 5.

The first argument is called a ☞ tilde expression ☜, the name of which comes from the character ~. Put the input name to be used on the right side of the tilde. On the left size, give an R expression for the function you want to graph (hillside) as well as the input name to use: hillside(z).

The second argument always looks like domain(z = -4:5), but of course you need to substitute in your input name and the lower and upper bounds that define the graphics domain. These are formatted using a colon to separate the lower from the upper bound.

You are welcome to place the whole command on one line. We’ve used multiple lines so that there is space for a # comment that describes the line. (You don’t need to do this.)

For each of the following item, put the appropriate command in the R chunk, verify that it works, and copy the command to the text-entry box. There will be one line in the text-entry box for each. Please keep them in order.

  1. Plot osc() using t as the input name with the graphics domain extending from zero to five.
  2. Plot hill() using z as the input name. The graphics domain should go from -3 to 3.
  3. Plot doublings() using fish as the input name. The graphics domain is zero to three.
  4. Plot osc() * hill() using x as the input name. The graphics domain is -4 to 4. (Hint: The x will appear altogether three times in the tilde expression.)

In the textbox, put your answers to each of (a) - (d) on a separate line.


Exercise 5. 5 We have defined for your convenience several one-input functions named f1() through f5(). Graph each of them, one at a time, on the domain -5 to 5 and, from the graph, read off the requested information. (Hint: All you need is the name of the function, you don’t have to worry about how we constructed it.)

  1. For f1(), for what input does the output reach its maximum value? (Select the closest value.)
gmc-1-lesle
-4       -3       -2       0       2       3       4      

  1. For f2(), what is the input where the output crosses zero? [Pick the closest answer.]
gmc-2-loie
-3       -1       0       1       3      

  1. For f3(), what is the minimum value of the output? [Pick the closest answer.]
gmc-3-yee
0       -10       -20       -30      

  1. For f4(), at what input does the output cross zero? [Pick the closest answer.]
gmc-4-rwsle
-4       -3       -2       0       2       3       4      

  1. For f5(), at how many different inputs does the output cross zero?
gmc-5-qdr
0       1       2       3       4      


Exercise 5. 6 Consider this plot of the hillside function:

Figure E5. 2
  1. What R function is being used to make the plot?
dek-1-gmek
plot()       slice_plot()       plotfun()       sliceplot()       plot_fun()      

  1. Immediately following the name of the function, there is an opening parenthesis. The matching closing parenthesis is at the very end of the command. In R (as in many computer languages) the arguments to the function are contained inside the parentheses. If there is more than one argument, successive arguments are separated by commas. How many arguments are there to slice_plot()?
dek-2-z38d
1       2       3       4      

The first argument to slice_plot() tells which function you want to graph. In the example, the first argument is hillside(z) ~ z. This is called a ☞ tilde expression ☜ so named because the tilde character (~) appears.

Left Middle Right
hillside(z) ~ (tilde) z
  1. The left part of the tilde expression is a formula written in more or less conventional algebraic form. Other examples for this formula: 2*z + 3, osc(z), hillside(z) * osc(z).

  2. The right part of the tilde expression gives the name of the input variable. In the example, the name is z, but you can use whatever name you think appropriate. Note that the formula in (i) must be written in terms of the input-variable name.

  3. The middle part of the tilde expression is merely punctuation, but it is essential punctuation. Among other things, the tilde makes clear what are the left and right sides of the tilde expression.

  1. Suppose that you want to call the input quantity x. You can easily modify the command to do this, just substitute x for z. In how many places do you have to make the change?
dek-3-jwkd
1       2       3       4      

Focus now on the graphic itself—Fig E5. 2. The name of the input variable appears as a label on the horizontal axis. The label on the vertical axis, in contrast, is just a reminder that we are plotting the output of the function versus the input quantity.

The vertical scale will be created automatically by slice_plot(), taking into account the range of function output values. But the horizontal axis is different: the user specifies this. The numerical extent of the horizontal axis is called the graphics domain.

The second argument to slice_plot() is used for the graphics domain specification.

  1. What is the graphics domain in Fig E5. 2?
dek-4-p3n2
0 to 4       -2 to 2       -2 to 4       -4 to 4      

In the example, the second argument is domain(z = -2:4). The graphics domain specification will always look like this, and uses the R function domain().

  1. How many arguments does domain() take in this example?
dek-4-7s2r
0       1       2       3      

There are two punctuation symbols in the argument to domain(). The colon (:) is placed between the two limits to be used for the domain. -2:4 means “minus 2 to 4.” The graphics domain zero to ten would be 0:10. The other punctuation mark is =. To the left of the = goes the name of the input variable. The expression z = -2:4 means “the graphics domain of z is to be -2 to 4.

  1. Using the “graphing a function” interactive R chunk, write an expression to plot out the function osc() over the graphics domain 0 to 5. Use whatever you like as the input name. After checking that your expression works, copy the expression into the following answer block.


Exercise 5. 7  

Here is a contour plot of a function \(f(x, y)\), annotated with several letters. At each of the letters, say what is the direction of the gradient vector. As names for directions, we will use the eight major compass points: N, NE, E, SE, S, SW, W, NW. Choose Zero if the gradient vector is so short that the direction is essentially meaningless.

  1. At point A: dbk-A-dkws

    N       NE       E       SE       S       SW       W       NW       Zero      

  2. At point B: dbk-B-dkws

    N       NE       E       SE       S       SW       W       NW       Zero      

  3. At point C: dbk-C-dkws

    N       NE       E       SE       S       SW       W       NW       Zero      

  4. At point D: dbk-D-dkws

    N       NE       E       SE       S       SW       W       NW       Zero      

  5. At point E: dbk-E-dkws

    N       NE       E       SE       S       SW       W       NW       Zero      


Exercise 5. 8 Accounting professionals have a busy quarter year connected to the end of each fiscal year up through the deadline for filing taxes. Large accounting firms typically bring on extra workforce during this period, and recruit college students to work long hours over a couple of months. One recent graduate told me she was paid $25/hr for such work. But, by US Federal law, the wage rate is increased by 150% for any hours worked over 40 per week. (This is called, “time and a half for overtime.”) The graduate reported working sometimes 90 hours per week.

Consider these two functions where the input is the number of hours accumulated during a week.

(a) Hourly wage rate
(b) Total earned
Figure E5. 3: Two functions relating to wages.
  1. What is the wage rate at 75 hours? (pick the closest)
sss-1-dkwe
25       37.5       1000       2000      

  1. What is the total earnings (in dollars) at 75 hours? (pick the closest)
sss-2-dwe
25       37.5       1000       2000      

The two functions in ?@fig-wage-overtime are closely related. But their outputs have different dimensions.

  1. What’s the dimension of the output of the earnings function?
sss-3-dkwl
W       W T       W T-1       T W-1      

  1. Consider the rate of change of earnings with respect to hours worked. What is the dimension of this rate of change?
sss-4-kwl
W       W T       W T-1       T W-1      

  1. The rate of change of a function’s output with respect to its input is, graphically, the slope of the function’s graph. Often, this rate of change is different at different input values. Is that the case for the rate of change of earnings with respect to hours worked?
sss-5-kes

Yes

No

Can’t tell from the info given.

The question makes no sense.

  1. One of these statements is true, the others are false. Which one is true?
sss-6t43w

The rate of change of the wage rate with respect to hours worked gives the total earnings.

The rate of change of the earnings with respect to hours worked gives the wage rate.

The earnings function is unrelated to the wage rate function.

It makes sense to create a new function by adding the outputs function from the two functions in ?@fig-wage-overtime.


Exercise 5. 9 Home chefs are advised that there is a safe temperature for cooking poultry: a thermometer inserted into the deepest part of the flesh should reach 165 deg F. This often leads to dry meat. In contrast, “rotisserie chicken,” the sort of fresh, pre-cooked chicken sold by grocery stores, is almost always moist and tasty. How does the rotisserie method achieve this?

There is actually a wide range of temperatures at which chicken can be cooked safely. The key is to hold the meat at that temperature for long enough. At 165 deg F, safety is achieved instantly.
Fig E5. 4 shows the required holding time at a range of temperatures:

Poultry |>
  gf_line(c_time ~ temp) |>
  gf_labs(x = "Safe temperature (deg F)", y = "Holding time") |>
  gf_theme(theme_minimal())
Figure E5. 4
  1. Suppose you determine to cook your chicken at 140 deg F. Assuming it takes two hours of cooking to ensure that the entire chicken reaches that temperature, how much longer do you need to cook the chicken in order to make it safe?
kcc-1-kes
25 minutes       30 minutes       35 minutes       40 minutes       No such time.      

Naturally, you want to avoid any risk of food poisoning. This could happen, for instance, if your oven runs cool. For instance, an oven set to 140 deg F might actually have cold spots at, say, 135 deg F.

There are two ways to guard against this. One is simply to hold the chicken at the cooking temperature for longer than the answer in Question (1).

  1. If you want to guard against the possibility of an oven temperature of 135 deg F, how long do you need to hold the chicken at cooking temperature for safety? (Remember, this is the time beyond the original two hours needed to get the bird up to the cooking temperature.)
kcc-2-kes
40 minutes       60 minutes       80 minutes       No such time shown in graph.      

Home chefs are used to a cooking method where the temperature is set very high (e.g. 350 deg F) and the time carefully regulated to avoid overcooking. Better results can be had at much lower temperatures so long as you take care to hold the bird at the temperature for long enough and check and calibrate your oven to ensure that it is at the right temperature. Commercial rotisseries have ovens set up for this purpose.


:::