Bungee Jumping Project

library(deSolve)
Warning: package 'deSolve' was built under R version 4.5.2
library(ggplot2)
Warning: package 'ggplot2' was built under R version 4.5.2
library(dplyr)
Warning: package 'dplyr' was built under R version 4.5.2

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Bungee Jumping Project

In this project, we use differential equations to model the motion of a bungee jumper.
The jumper free falls until the cord becomes taut, after which a spring force pulls back.
By solving this piecewise system numerically and visualizing it, we can explore how cord stiffness affects safety, maximum extension, and the overall motion.

The bungee jump is modeled as a piecewise system: the jumper free falls until the cord becomes taut, after which a spring force acts in addition to gravity and air resistance.

This function models the motion of a bungee jumper using a piecewise differential equation.

bungee <- function(t, state, parameters) {
  with(as.list(c(state, parameters)), {

    dx1 <- x2

    if (x1 < 0) {
      dx2 <- g - b * x2
    } else {
      dx2 <- g - k * x1 - b * x2
    }

    list(c(dx1, dx2))
  })
}

At the moment the jumper steps off the bridge, their position is 100 feet above the cord’s natural length and their velocity is zero. Let’s then code for where the jumper starts and how strong the forces are:

state <- c(
  x1 = -100,
  x2 = 0
)

parameters <- c(
  g = 32,
  b = 1,
  k = 10.7
)

times <- seq(0, 20, by = 0.01)

Now, I have to solve the system to track the jumper’s position and velocity over time, including the moment when the cord begins to stretch.

out <- ode(
  y = state,
  times = times,
  func = bungee,
  parms = parameters
)

out <- as.data.frame(out)

This plot shows how the jumper’s position changes over time, highlighting when the cord becomes taut and whether the jumper safely avoids the water.

ggplot(out, aes(time, x1)) +
  geom_line(linewidth = 1.2) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  geom_hline(yintercept = 68, color = "red") +
  labs(
    title = "Bungee Jump: Position vs Time",
    x = "Time (seconds)",
    y = "Position x(t) (feet)"
  ) +
  theme_minimal()

The phase space plot just shows how position and speed change at the same time.

ggplot(out, aes(x1, x2)) +
  geom_path(linewidth = 1.2) +
  labs(
    title = "Phase Space: Velocity vs Position",
    x = "Position x(t)",
    y = "Velocity x'(t)"
  ) +
  theme_minimal()

A loop that spirals inward that’s damping.

By changing the spring constant, we can directly see how cord stiffness affects maximum extension and safety.

k_values <- c(8.5, 10.7, 16.4)

results <- lapply(k_values, function(kval) {
  parameters["k"] <- kval
  sol <- ode(state, times, bungee, parameters)
  df <- as.data.frame(sol)
  df$k <- kval
  df
})

all_data <- do.call(rbind, results)

ggplot(all_data, aes(time, x1, color = factor(k))) +
  geom_line(linewidth = 1.2) +
  labs(
    title = "Effect of Spring Constant on Bungee Jump",
    x = "Time (seconds)",
    y = "Position (feet)",
    color = "Spring constant k"
  ) +
  theme_minimal()

This code simulates the jump for three different bungee cords and plots them on the same graph. It lets us see which cords are safe (don’t hit the water) and how stiffness changes the motion.