```{r data generation, echo = FALSE, results = "hide"}
sol <- 0
while(sol > -0.11) {
## p = a - b * x
p <- sample(5:15, 1)
fctr <- sample(c(2, 4, 5, 10), 1)
x <- sample(5:15, 1) * fctr
b <- sample(1:5, 1) / fctr
a <- p + b * x
## elasticity
sol <- -1/b * p/x
}
## single-choice incl. typical errors
err <- c(1/sol, sol/p, p/sol)
err <- err[(err > -5) & (err < -0.2) & abs(err - sol) > 0.01]
rng <- c(min(1.5 * sol, -1), -0.01)
sc <- num_to_schoice(sol, wrong = err, range = rng,
delta = 0.017, method = "delta", digits = 3)
sc$questions[5] <- "None of the above."
```
Question
========
Consider the following inverse demand function:
$p(x) = `r a` - `r b` \cdot x$
for the price $p$ given the demanded quantity $x$.
What is the price elastiticy of demand at a price of
$p = `r p`$?
```{r questionlist, echo = FALSE, results = "asis"}
answerlist(sc$questions, markup = "markdown")
```
Solution
========
First, we obtain the demand function by inverting the
inverse demand function:
$x = D(p) = (`r a` - p)/`r b` = `r fmt(a/b, 6)` - `r fmt(1/b, 6)` \cdot p$.
Then, at $p = 5$ the price elasticity of demand is
$$
\frac{D'(p)}{D(p)} p = \frac{-`r fmt(1/b, 6)`}{`r x`} `r p` = `r fmt(sol, 6)`.
$$
```{r solutionlist, echo = FALSE, results = "asis"}
answerlist(ifelse(sc$solutions, "True", "False"), markup = "markdown")
```
Meta-information
================
extype: schoice
exsolution: `r mchoice2string(sc$solutions)`
exname: price elasticity of demand