Title: Composite Functions
Required Skills: Basic math operations, defining and calling functions,
In this activity students will write their own composite functions. They will also write a few composite functions based on real-world type situations. The answers are included below, but students would be given only the comments as a guide.
# Create two functions f and g
# Create the composite function f(g(x)) and call it composite_fg. You can solve for f(g(x)) on paper.
# Compute f(g(3)) using both functions f and g separately and by using composite_fg. Are they equal?
# Create the composite function g(f(x)) and call it composite_gf.
# Compute g(f(5)) using both functions g and f separately and by using composite_gf. Are they equal?
# You work forty hours a week at a furniture store. You receive a $220 weekly salary, plus a 3% commision on sales over $5000. Assume that you sell enough this week to get the commission. Use composite functions to calculate how much you take home in commission when you sell $8000.
return sales - 5000
# You make a purchase at a local hardware store, but what you've bought is too big to take home in your car. For a small fee, you arrange to have the hardware store deliver your purchase for you. You pay for your purchase, plus the sales taxes, plus the fee. The taxes are 7.5% and the fee is $20.
# Part a - Write a function t(x) for the total, after taxes, on the purchase amount x. Write another function d(x) for the total, including the delivery fee, on the purchase amount x.
return(x + 0.075*x)
# Part b - Calculate and interpret d(t(x)) and t(d(x)). Which results in a lower cost to you?
# ANSWER d(t(x)) results in a lower cost because the tax is not being applied to the delivery fee
# Part c - Suppose taxes, by law, are not to be charged on delivery fees. Which composite function must then be used?
# ANSWER d(t(x) must be used