Class 12

Between Class Sessions - Prep for Day 12

Please spend around 2 hours working between class sessions, focusing on the tasks below. Use any extra time to complete KnewtonAlta assignments and/or work on Project tasks.

Pick something from your prep today that you can share with your group in class. It might be something new that you learned. It might be questions you have that are still unanswered, or a question along with what helped you eventually answer it. It might be something tricky that you solved. It might be a review topic that helped you remember something. It might be a conversation you had with AI that was helpful. You will have a chance to share this with your peers during class. Come ready to articulate your thinking and questions.

Preparation

(1) Activity - Operations on Functions

  • Throughout the semester we will rely on 4 types of function operations. (Multiply by a Constant, Add/Substract, Multiply/Divide, Compose)
  • Throughout the semester we will study 3 types of functions. (Power, Exponential, Logarithmic) We can use function operations to create new functions or to better understand a function by recognizing parts.
  1. Multiply by a Constant
    • \(cf(x)\)
  2. Add/Subtract
    • \((f + g)(x) = f(x) + g(x)\)
    • \((f - g)(x) = f(x) - g(x)\)
  3. Multiply/Divide
    • \((f \cdot g)(x) = f(x) \cdot g(x)\)
    • \(\left( \frac{f}{g} \right)(x) = \frac{f(x)}{g(x)}\)
  4. Compose
    • \((f \circ g)(x) = f(g(x))\)
Definition: Algebraic Function

An algebraic function is a function that is described by basic algebraic operations (addition/subtraction, multiplication, division, and rational powers).

Examples: Power Functions, Polynomials, Rational Functions, Root Functions, and other functions built up from these functions and the 4 function operations (constant multiple, add/subtract, multiply/divide, composition).

All algebraic functions can be built using only power functions and the 4 function operations.

  • For each function given below, identify the power functions and operations used to build (or construct) the function.
    1. \(f(x) = 4\sqrt[3]{x-1}\)
    2. \(g(x) = \frac{6x+5}{3x}\)
    3. \(h(x) = 7(x+3)^2 = 7x^2 + 42x +63\)
  • Given \(h(x)\), find two functions \(f(x)\) and \(g(x)\) so that \((f \circ g)(x) = h(x)\). There are multiple options for each.
    1. \(h(x) = \sqrt{x+5}\)
    2. \(h(x) = 2(x-1)^5\)
    3. \(h(x) =\frac{4}{x-1}\)
    4. \(h(x) =\frac{3}{x+2}\)
    5. \(h(x) =(5x+4)^2\)

Regular Reminders

Skill Practice (KA Homework)

  • Finish any of the function assignments you have not completed already.

Applied Practice (Project Work)

  • Complete and Submit Project 1 Task 3
  • Start Project 1 Task 4

During Class

Brain Gains

  • For the function \(f(x) = -2\sqrt[3]{x+6}\), identify some power functions and then use appropriate operations to show how to construct \(f\) from these power functions. (There are many correct ways to do this.)
  • Let \(f(t) = \log_2(3t-2)\).
    • Compute \(f(2)\)
    • Solve \(f(t) = 2\) for \(t\)
      • Check your answer using uniroot() in R.
      • Construct a plot in R that shows where \(f(t)\) and \(y=2\) intersect.
Answers
  1. \(f(x) = -2\sqrt[3]{x+6} = -2(x+6)^{1/3}\)
    • Power function: \(u^{1/3}\) where \(u = x+6\)
    • Operations: composition, shift, constant multiple
    • Build it: Start with \(p(u) = u^{1/3}\), then \(g(x) = p(x+6) = (x+6)^{1/3}\), then \(f(x) = -2g(x)\)
  2. \(f(t) = \log_2(3t-2)\):
    • \(f(2) = \log_2(3 \cdot 2 - 2) = \log_2(4) = 2\)
    • Solve \(f(t) = 2\): \(\log_2(3t-2) = 2\)\(3t-2 = 2^2 = 4\)\(3t = 6\)\(t = 2\)
    • Check in R:
    f <- function(t){log2(3*t - 2)}
    f(2)  # Returns 2
    g <- function(t){log2(3*t - 2) - 2}
    uniroot(g, c(1, 5))$root  # Returns 2
Note: Be careful with domain - need \(3t-2 > 0\), so \(t > \frac{2}{3}\).
  • Rewrite the following expressions using the properties of logarithms.
    • \(\log \left( \prod_{j=1}^{3} (x + j) \right)\)
    • \(\log_4 \left( \prod_{k=1}^{5} (y_k + b x_k)^2 \right)\)
    • \(\ln \left( \prod_{k=1}^{4}(100-k^2) \right)\)
    • \(\ln \left( \prod_{i=1}^{500} (y_i + a x_i)^2 \right)\)
Possible Solutions
  1. \[\sum_{j=1}^{3} \log(x + j)\]

  2. \[\begin{align*} \log_4 \left(\prod_{k=1}^{5}(y_k + bx_k)^2\right) &= \sum_{k=1}^{5} \log_4\!\left((y_k + bx_k)^2\right) \\ &= \sum_{k=1}^{5} 2\log_4(y_k + bx_k) \\ &= 2\sum_{k=1}^{5} \log_4(y_k + bx_k) \end{align*}\]

  3. \[\sum_{k=1}^{4} \ln(100-k^2)\]

  4. \[\begin{align*} \ln\!\left(\prod_{i=1}^{500}(y_i + ax_i)^2\right) &= \sum_{i=1}^{500} \ln\!\left((y_i + ax_i)^2\right) \\ &= \sum_{i=1}^{500} 2\ln(y_i + ax_i) \\ &= 2\sum_{i=1}^{500} \ln(y_i + ax_i) \end{align*}\]

Group Meeting

Start by giving each person a moment to share what they chose to prepare for class. Help each other address any questions. When each person has had a chance to share, move on the other activities.

See the Pieces

For each function given below, identify power functions and operations used to build (or construct) the function.

  1. \(f(x) = 7\sqrt[5]{4x-6}\)

  2. \(g(x) = \frac{7x^2 + 42x +63}{3x-5}\)

  3. \(h(x) = \frac{4}{x-1}\)

Uniroot Practice

Remember that one key to using uniroot is to pick two \(x\)-values where you know the values of the function differ in sign. If needed, start by constructing a plot to help you pick these values.

  • Let’s solve \(3x - 15 = e^{-x+6}\) using uniroot. Note that this function doesn’t have a by-hand solution technique. We’ll have to update the bounds in uniroot below, using the graph. You will obtain an error on the second line of the code below. Use the last 3 lines to create a plot, and then update the bounds in uniroot.
g <- function(x){ 3*x-15-exp(-x+6) }
uniroot(g,c(0,5))$root

x <-seq(0,30,1)
plot(x,g(x), type="l")
abline(h=0, col = "lightgray")

Now practice using uniroot to solve some of the equations below. Remember, we start by defining the function that you wish to equal zero (you might need to subtract), and then use uniroot. If needed, make a plot first to figure out an interval where the zero should appear.

  1. \(3x-5=0\)

  2. \(3x-5=7\)

  3. \(3x-5=e^{-x}\) (Remember to use exp(-x)) for \(e^{-x}\) )

  4. \(3x-5=\ln(x)\) (Remember to use log(x) for \(\ln(x)\)).

  5. \(x^2+x-6=0\). There are two different solutions. See if you can capture both by choosing different lower and upper limits.

  6. \(x^2-8x+12=0\). There are two different solutions. See if you can capture both by choosing different lower and upper limits.

  • What happens when we try to solve something impossible, such as \(\frac{1}{x} = 0\).
f <- function(x){
  1/x
}

uniroot(f,c(-10,-3))$root

uniroot(f,c(-1,1))$root

uniroot(f,c(-1,1))

Using a model

Consider the following fitted models. These models were fit to the data for Project 1 Task 3 using seed=123.

  • \(f_2(x) = 100 + 0.0011x - 0.00000015x^2\) where \(x \geq 0\)
  • \(f_3(x) = 101.9 - 1.9e^{-0.00114x}\) where \(x \geq 0\)
  • \(f_4(x) = 100 - 0.000181x + 0.83\ln(0.005x+1)\) where \(x \geq 0\)
  • \(f_5(x) = (100 + 0.00623x)e^{-0.0000506x}\) where \(x \geq 0\)
Graphs of these Functions in R
rm(list=ls())
library(data4led)
bulb <- led_bulb(1,seed = 123)

t <- bulb$hours
y <- bulb$percent_intensity

f0 <- function(x,a0=100 + 0*x ){ a0 }
f1 <- function(x,a0=100,a1=7e-4){ a0 + a1*x }
f2 <- function(x,a0=100,a1=1.1e-3,a2=-1.5e-7){ a0 + a1*x + a2*x^2 }
f3 <- function(x,a1=-1.9,a2=0.00114){ (100-a1) + a1*exp(-a2*x) }
f4 <- function(x,a0=100,a1=-1.81e-4,a2=0.83){a0+a1*x+a2*log(0.005*x+1)}
f5 <- function(x,a0=100,a1=6.23e-3,a2=5.06e-5){ (a0 + a1*x)*exp(-a2*x) }

x <- seq(-10,80001,2)
y0 <- f0(x)
y1 <- f1(x)
y2 <- f2(x)
y3 <- f3(x)
y4 <- f4(x)
y5 <- f5(x)

par(mfrow=c(1,2),mar=c(2,2,3,0.25),oma=rep(0.5,4))
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16,main='f0')
lines(x,y0,col=2)
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16, xlim = c(-10,80000),ylim = c(-10,120))
lines(x,y0,col=2)

par(mfrow=c(1,2),mar=c(2,2,3,0.25),oma=rep(0.5,4))
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16,main='f1')
lines(x,y1,col=2)
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16, xlim = c(-10,80000),ylim = c(-10,120))
lines(x,y1,col=2)

par(mfrow=c(1,2),mar=c(2,2,3,0.25),oma=rep(0.5,4))
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16,main='f2')
lines(x,y2,col=2)
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16, xlim = c(-10,80000),ylim = c(-10,120))
lines(x,y2,col=2)

par(mfrow=c(1,2),mar=c(2,2,3,0.25),oma=rep(0.5,4))
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16,main='f3')
lines(x,y3,col=2)
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16, xlim = c(-10,80000),ylim = c(-10,120))
lines(x,y3,col=2)

par(mfrow=c(1,2),mar=c(2,2,3,0.25),oma=rep(0.5,4))
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16,main='f4')
lines(x,y4,col=2)
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16, xlim = c(-10,80000),ylim = c(-10,120))
lines(x,y4,col=2)

par(mfrow=c(1,2),mar=c(2,2,3,0.25),oma=rep(0.5,4))
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16,main='f5')
lines(x,y5,col=2)
plot(t,y,xlab="Hour ", ylab="Intensity(%) ", pch=16, xlim = c(-10,80000),ylim = c(-10,120))
lines(x,y5,col=2)

The code above provides, for each model, a plot of the data along with the model (similar to Task 3) and the line \(y=80\) in light gray. As a group, answer the following questions. For some of these questions, you will need to use uniroot.

  1. Use the model \(f_4\) to answer the question, What is the intensity of the bulb after 12000 hours?

  2. Use the model \(f_3\) to answer the question, When is the intensity of the bulb 90% of its original intensity?

  3. Use the model \(f_2\) to answer the question, When is the intensity of the bulb 97% of its original intensity?

  4. Use the model \(f_5\) to answer the question, When is the intensity of the bulb 95% of its original intensity?

  5. Use the model \(f_5\) to answer the question, What is the intensity of the bulb after 25000 hours?

  6. For each model (all 6), answer the question, “When does the bulb burn out (the intensity is 80% of the original)?”

Answers

Using the fitted models (seed=123):

  1. Intensity after 12000 hours using \(f_4\):

    f4 <- function(x){100 - 0.000181*x + 0.83*log(0.005*x+1)}
    f4(12000)
    # Approximately 99.59%
  2. When intensity = 90% using \(f_3\):

    f3 <- function(x){101.9 - 1.9*exp(-0.00114*x)}
    g3 <- function(x){f3(x) - 90}
    uniroot(g3, c(0, 50000))$root
    # Approximately 2046 hours
  3. When intensity = 97% using \(f_2\):

    f2 <- function(x){100 + 0.0011*x - 0.00000015*x^2}
    g2 <- function(x){f2(x) - 97}
    uniroot(g2, c(0, 10000))$root
    # Two solutions possible - check plot first
  4. When intensity = 95% using \(f_5\):

    f5 <- function(x){(100 + 0.00623*x)*exp(-0.0000506*x)}
    g5 <- function(x){f5(x) - 95}
    uniroot(g5, c(0, 50000))$root
    # Approximately 37668 hours
  5. Intensity after 25000 hours using \(f_5\):

    f5(25000)
    # Approximately 101.8%
  6. When does bulb burn out (80% intensity) for each model:

    • Plot each function first to find appropriate interval
    • Use uniroot() with function - 80
    • Some models may not reach 80% within realistic timeframe
Common mistake: Not checking plot first - may choose wrong interval for uniroot().

Discussion

We’ll wrap up today by having a discussion about the topics you discussed in your Group Meeting.


Source: Class.12 on byuimath.com