This project is based on a project by Brian Winkel. https://www.simiode.org/resources/625

$a(t)=$ number of iPhones "needed" at time $t$ ($t=0$ is the date of the first iPhone)

$f(t)=$ the fraction of iPhones that were operating at $t=t_*$ that are still operating at time $t=t_*+t$

$r(t)=$ the number of replacement iPhones on the interval $[0,t]$ so that there are always $a(t)$ iPhones in servise

Goal: Given the function $a(t)$, find the replacement plan function $r(t)$

Some assumptions:

  • iPhones are replaced only when the cease to operate
  • once you have an iPhone you will replace it when your iPhone with a new iPhone when the old one stops working
  • the function $f$ is dependent only on the length of time the phone is in service and not when the phone began service

Thinking about the problem:

  • Sketch what you think $a(t)$ might look like
  • Sketch what you think $r(t)$ might look like
  • Sketch what you think $f(t)$ might look like

Notice $r(t)$ is the total number of replacement phones on the interval $[0,t]$.

Approximate the number of phones replaced during a subinterval: $[t_k, t_{k+1}]$ where $0 \leq t_k \leq t_{k+1} < t$.
Picture $t_{k+1}-t_k$ being not too big.

number of phones replaced on the subinterval $[t_k, t_{k+1}]$ is about $$r^\prime(t_{k+1})\cdot (t_{k+1}-t_k)$$

Now, "fix" a time $t$. How many phones in service at $t=0$ are still in service at time $t$?

$a(0)\cdot f(t)$

Subdivide the interval $[0,t]$:

$$0 < \tau_1 < \tau_2 < \tau_3 \dots <\tau_{n-1} < \tau_n=t$$

(the reason we use $\tau$ instead of $t$ will become clear later)

Harder:

How many phones introduced during the interval $(0, \tau_1)$ are still in service at time $t$?

this will be an approximation

$$f(t-\tau_1)\cdot r^\prime(\tau_1)\cdot \Delta \tau$$

How many phones introduced during $(\tau_1, \tau_2)$ are still in service at time $t$?

$$f(t-\tau_2)\cdot r^\prime(\tau_2)\cdot \Delta \tau$$

Write down the number of phones in service at time $t$ as a function of $f(t)$ and $r(t)$.

$$a(0)f(t)+\sum_{k=1}^{n-1}f(t-\tau_k)\cdot r^\prime(\tau_k)\Delta \tau$$

We want this expression to equal $a(t)$:

$$a(t)=a(0)f(t)+\sum_{k=1}^{n-1}f(t-\tau_k)\cdot r^\prime(\tau_k)\Delta \tau$$

Let $$\Delta \tau \rightarrow 0$$

$$a(t)=a(0)f(t)+\int_0^t f(t-\tau)\cdot r^\prime(\tau) d\tau$$

We want to solve for $r(t)$.

Strategy:

  • take the Laplace transform
  • solve for $R(s)$
  • find the inverse Laplace transfrom

New problem: finding the Laplace transform of the integral term.

We'll solve it in a more general setting. Find the Laplace transform of $$\int_0^t f(t-\tau)g(\tau)d\tau$$ for any functions $f$ and $g$.

\begin{align*} \mathscr{L}\left(\int_0^t f(t-\tau)g(\tau)d\tau \right)&= \int_0^\infty e^{-st}\left( \int_0^t f(t-\tau)g(\tau)d\tau\right)dt \\ \\ &\vdots \\ &=\text{ see Trench section 8.6, Theorem 8.6.2 }\\ \\ &\vdots \\ &=F(s) \cdot G(s)\\ \end{align*}

We'll write this as:

$$\mathscr{L}(f \star g)=F\cdot G.$$
$$a(t)=a(0)f(t)+\int_0^t f(t-\tau)\cdot r^\prime(\tau) d\tau$$

has Laplace transform:

$$A(s)=a(0)F(s)+F(s)\cdot \mathscr{L}(r^\prime(t))$$$$A(s)=a(0)F(s)+F(s)\cdot(-r(0)+sR(s))$$

assume $r(0)=0$ and solve for $R(s)$:

$$R(s)=\frac{A(s)-a(0)F(s)}{sF(s)}$$

Before we continue with the iPhone example, let's see how this new tool provides an alternative way to analyze circuits if we have a transfer function. From the circuit in exercise one we have $$i(t)=\frac{v_c}{R}+C\frac{dv_c}{dt}.$$ The Laplace transform is then $$I=\frac{1}{R}V+sCV$$ or $$V=\frac{1}{\frac{1}{R}+sC}I.$$ So the transfer function is $$T(s)=\frac{1}{\frac{1}{R}+sC}$$ which we'll write in a form that makes it easy to see what the inverse transfrom is: $$T=\frac{1}{C}\cdot \frac{1}{s+\frac{1}{RC}}.$$ We have, in the $s$-domain: $$V=T\cdot I$$ and from the above discusion:

$$v_c(t)=\mathscr{L}^{-1}(T) \star i(t).$$

The important thing to notice is that the inverse transform of the transfer function, $T(s)$ is easy to find and we avoid the need to find the transform of $i(t)$ or (more critically) the inverse transform of $T\cdot I$ which could be difficult.

Below is the matlab implementation of this convolution approach.

In [4]:
syms s omega R C T(s) V_c(s) I(s) alpha(t) t i(t) tau
T(s)=(1/C)*(1/(1/(C*R)+s))
alpha(t)=ilaplace(T(s), s, t)
i(t)=exp(-t)*cos(omega*t)
v_c(t)=int(i(tau)*alpha(t-tau), tau, 0, t)
%i(tau)*alpha(t-tau)
v_cplot=subs(v_c(t),[R,C,omega],[200,1/100, 25])
fplot(v_cplot)
xlim([0 10])
ylim([-1 1])
 
T(s) =
 
1/(C*(s + 1/(C*R)))
 
 
alpha(t) =
 
exp(-t/(C*R))/C
 
 
i(t) =
 
exp(-t)*cos(omega*t)
 
 
v_c(t) =
 
(R*exp(-t/(C*R))*(C*R - 1))/(C^2*R^2*omega^2 + C^2*R^2 - 2*C*R + 1) + (R*exp(-t)*(cos(omega*t) - C*R*cos(omega*t) + C*R*omega*sin(omega*t)))/(C^2*R^2*omega^2 + C^2*R^2 - 2*C*R + 1)
 
 
v_cplot =
 
(200*exp(-t/2))/2501 - (200*exp(-t)*(cos(25*t) - 50*sin(25*t)))/2501
 

Below is the approach without the convolution technique. Matlab is able to do both, but compare the expressions for solnplot below to v_cplot above. The graphs indicate they are the same but the one below involves imaginary numbers. So, it's always nice to have more than one way to solve a problem.

In [6]:
I(s)=laplace(i(t),t,s)
V_c(s)=T(s)*I(s)
soln(t)=ilaplace(V_c(s),s,t)
solnplot=subs(soln(t),[R,C,omega],[200,1/100, 25])
fplot(solnplot)
xlim([0 10])
ylim([-1 1])
 
I(s) =
 
(s + 1)/((s + 1)^2 + omega^2)
 
 
V_c(s) =
 
(s + 1)/(C*((s + 1)^2 + omega^2)*(s + 1/(C*R)))
 
 
soln(t) =
 
(R*exp(-t/(C*R))*(C*R - 1))/(C^2*R^2*omega^2 + C^2*R^2 - 2*C*R + 1) + (exp(-t)*(- C*R^2 + R)*(cosh(omega*t*1i) - (sinh(omega*t*1i)*((C*R^2*omega^2 - C*R^2 + R)/(- C*R^2 + R) - 1)*1i)/omega))/(C^2*R^2*omega^2 + C^2*R^2 - 2*C*R + 1)
 
 
solnplot =
 
(200*exp(-t/2))/2501 - (200*exp(-t)*(cosh(t*25i) + sinh(t*25i)*50i))/2501
 

Homework:

Trench section 8.6:

1b) d) f)

3b) d) f)

4b) d) f)

In [ ]: