1  L1: Applic. leading to diffeq

1.1 What is a differential equation?

Definition:

A differential equation is an equation relating an unknown function and any of its derivatives or differentials

1.2 Example: Growth and Decay

Modeling: Growth and Decay

Model \[\boxed{y'=ay}\]
Initial Condition (i.c.): \[y(0)=y_0\]

\[\begin{align} y'&=ay \\ \frac{dy}{dt} &= a y \quad{\text{(Separation of variables)}}\\ \frac{dy}{y} &= a dt \\ \int \frac{1}{y}\,dy &=\int a \,dt\\ \ln y &= at + c\\ y&=e^{at+c}\\ y&=e^{at}e^{c}\\ y(0)&=y_0\quad\text{(Initial condition)}\\ \therefore y&=y_0e^{at} \end{align}\]

Question: How the value of \(a\) affect the solution?

# Load the plotly library
library(plotly)

# Initial data setup
y0 <- 100
t <- seq(0, 10, length.out = 100)
a1 <- 1
y1 <- y0 * exp(a1 * t)

# Create the plot for exponential growth
plot_ly(x = t, y = y1, type = 'scatter', mode = 'lines',
        name = 'Exponential Growth (a > 0)',
        line = list(color = 'blue')) %>%
    layout(title = 'Exponential Growth (a > 0)',
           xaxis = list(title = 'Time'),
           yaxis = list(title = 'y'))

Note: You want to see a video example? Click here: Section 1.10

1.3 Example: Newton’s law of cooling

Newton’s law of cooling

\[\boxed{\frac{dT}{dt}=-k(T-T_{env})}\quad T(0)=T_0;\quad k>0\]

\[\begin{align} \int \frac{1}{T-T_{env}}dT&=\int -kdt\\ \ln (T-T_{env}) &= -kt+C\\ T-T_{env} &= e^{-kt+C}\\ T-T_{env} &= e^{-kt}e^{C}\quad\Rightarrow\text{(Initial conditions)}\\ T-T_{env} &= e^{-kt}(T_0-T_{env})\\ T&=T_{env}+(T_0-T_{env})e^{-kt} \end{align}\]
library(plotly)

# Define initial parameters
T0 <- 1000
Tenv <- 300
k <- 1
t <- seq(0, 10, length.out = 100)

# Function to generate plot with hover text
generate_plot <- function(T0, Tenv) {
  y <- Tenv + (T0 - Tenv) * exp(-k * t)
  
  # Create a text vector for hover information
  hover_text <- paste("Time:", round(t, 2), "<br>Temp:", round(y, 2))

  plot_ly(x = ~t, y = ~y, type = 'scatter', mode = 'lines', text = ~hover_text, hoverinfo = 'text') %>%
    layout(title = paste("Temperature Convergence (T0 =", T0, ", Tenv =", Tenv, ")"),
           xaxis = list(title = 'Time'),
           yaxis = list(title = 'Temperature'))
}

# Generate and display the plot
generate_plot(T0, Tenv)

1.4 Newton’s Second Law

Newton’s Second Law

“Force is equal to the rate of change of momentum” \[\boxed{F=\frac{d}{dt}(mv)}\] If mass is constant then \(F=m\frac{dv}{dt}=ma\)

\[\begin{align} \frac{d^2x}{dt^2}&=\frac{F(t)}{m}\\ \text{Integrating:}\\ v(t)&=v_0+\frac{1}{m}\int_0^t F(\tau)d\tau \end{align}\]

1.5 Definition to be a solution of diffyeq

Definition

A function \(y(x)\) is said to be a solution to a differential equation \(\Leftrightarrow\) an identity results when the corresponding values for \(y(x)\) and its derivatives are substituted into the equation.

1.5.1 Example

Example . Verify is a solution

Verify that \(y=e^x+x+7\) is a solution to \[\frac{dy}{dx}-y+x=-6\]

\[\begin{align} \frac{dy}{dx}-y+x&=-6\quad\text{(expanding the left side:)}\\ \frac{d}{dx}(e^x+x+7)-(e^x+x+7)+x&=-6\\ e^x+1-e^x-x-7+x&=-6\\ -6&=-6 \end{align}\]

😁

1.6 Explicit and Implicit form of a solution

Definition
  1. A solution is in an explicit form \(\Leftrightarrow y=f(x)\)
  2. A solution is in an implicit form \(\Leftrightarrow f(x,y)=0\)

1.7 Is the sol. of a diffeq always unique?

A: No

Example

\[\frac{d^2y}{dx^2}+y=0\]

By inspection we observe that two different functions satisfy:

\[\begin{align} y_1&=\cos x\\ y_2&=\sin x\\ \end{align}\]

Therefore the most General Solution is a Linear Combination of the particular solutions:

\[ \boxed{y = C_1\cos x + C_2\sin x }\]

1.8 Does every diffeq have a sol\(^\underline{n}\) ?

A: No

Example

\[\left(\frac{dy}{dx}\right)^2+1=0\]

Any solution to this eq\(^\underline{n}\) would have an imaginary slope!

Thus no-real solution!2

1.9 Have questions ?

Schedule Office Hours with your Instructor Here!

1.10 References

  1. Exponential growth and decay. https://en.wikipedia.org/wiki/Exponential_growth
  2. Newton law of cooling. https://en.wikipedia.org/wiki/Newton%27s_law_of_cooling
  3. Harmonic oscillator. https://en.wikipedia.org/wiki/Harmonic_oscillator
  4. Khan: Modeling population with simple differential equation. https://youtu.be/IYFkXWlgC_w?feature=shared

  1. https://en.wikipedia.org/wiki/Harmonic_oscillator↩︎

  2. interested in imaginary? \(\Rightarrow\) PHY:455https://syllabi.oru.edu/?id=28002↩︎