\[R(Q) = 5,000Q - 25Q^{2} \] Use the quad function to find the roots, the quantity that maximizes revenue, and the maximum revenue.
QUAD <- function(a,b,c) {
possol <- (-b+sqrt(b^2-4*a*c))/(2*a)
negsol <- (-b-sqrt(b^2-4*a*c))/(2*a)
vertex <- -b/(2*a)
optval <- a*(vertex^2) + b*vertex + c
print(paste0("Positive Root = ",possol))
print(paste0("Negative Root = ", negsol))
print(paste0("Vertex = ",vertex))
print(paste0("Max Value = ",optval))
}
QUAD(-25,5000,0)
## [1] "Positive Root = 0"
## [1] "Negative Root = 200"
## [1] "Vertex = 100"
## [1] "Max Value = 250000"
\[ C(Q) = 1000Q + 400\]
Find an expression for profits for the firm (Hint: \(\pi = R(Q) - C(Q)\)) and determine the quantity and level of profits when profits are maximized. Use the QUAD function to solve for these values.
# Fill in the values for a,b, and c for your expression for profits in the line below here.
# Profit = -25Q^2 + 4000Q - 400
QUAD(-25,4000,-400)
## [1] "Positive Root = 0.10006257824728"
## [1] "Negative Root = 159.899937421753"
## [1] "Vertex = 80"
## [1] "Max Value = 159600"
#Plot profits
q <- seq(from = 0, to = 160,by = 5)
profit <- -25*q^2 + 4000*q - 400
plot(profit ~ q, type = "l")
Because profits include costs it is not the case that revenues and costs are maximized at the same quantity. Often times the level of output that maximizes revenue does not maximize profit.
FV_fun <- function(PV,r,t) {
FV <- PV*(1+r)^t
print(FV)
}
PV_fun <- function(FV,r,t) {
PV <- FV/((1+r)^t)
print(PV)
}
r_fun <- function(FV,PV,t) {
r <- ((FV/PV)^(1/t))-1
print(r)
}
t_fun <- function(FV,PV,r) {
t <- log(FV/PV)/log(1+r)
print(t)
}
FV_fun(10000,.07,5)
## [1] 14025.52
PV_fun(5000000,.08,40)
## [1] 230154.7
t_fun(20,10,.10)
## [1] 7.272541
FV <- 200 #Future Value
PV <- 100 #Present Value
tm <- seq(from = 0, to = 40, by = 1)#Time variable sequence
rate <- r_fun(FV,PV,tm) #Use r_fun
## [1] Inf 1.00000000 0.41421356 0.25992105 0.18920712 0.14869835
## [7] 0.12246205 0.10408951 0.09050773 0.08005974 0.07177346 0.06504109
## [13] 0.05946309 0.05476608 0.05075664 0.04729412 0.04427378 0.04161601
## [19] 0.03925923 0.03715504 0.03526492 0.03355778 0.03200828 0.03059554
## [25] 0.02930224 0.02811383 0.02701805 0.02600448 0.02506421 0.02418956
## [31] 0.02337389 0.02261144 0.02189715 0.02122661 0.02059591 0.02000161
## [37] 0.01944064 0.01891028 0.01840809 0.01793188 0.01747969
plot(rate ~ tm,type = "l")