2024-01-31

#Physics ## By: smyles4 — #What To Prepare For In these slides, I will be presenting that I can accomplish (using kinetic and potential energy from physics):

\[
KE = \frac{1}{2} m v^2
\]

#Potential Engery Equation

\[
PE = mgh
\]

Create a dataset with values for mass, velocity, and height

set.seed(123) energy_data <- data.frame( Mass = runif(10, min = 1, max = 10), Velocity = runif(10, min = 5, max = 20), Height = runif(10, min = 1, max = 5) )

Calculate kinetic and potential energy

energy_data\(KineticEnergy <- 0.5 * energy_data\)Mass * energy_data\(Velocity^2 energy_data\)PotentialEnergy <- energy_data\(Mass * 9.8 * energy_data\)Height

print(energy_data)

library(plotly)

Your dataset

energy_data <- data.frame( Mass = 7, Velocity = 15, Height = 3, KineticEnergy = 787.5, PotentialEnergy = 2018.21 )

Scatter plot using plot_ly

scatter_plot <- plot_ly( data = energy_data, x = ~KineticEnergy, y = ~PotentialEnergy, mode = “markers”, type = “scatter”, text = ~paste(“Mass:”, Mass, “
Velocity:”, Velocity, “
Height:”, Height) )

The Plot

scatter_plot

library(ggplot2)

energy_data <- data.frame( Mass = c(7), Velocity = c(15), Height = c(3), KineticEnergy = c(787.5), PotentialEnergy = c(2018.21) )

Scatter plot for Kinetic Energy

ggplot(energy_data, aes(x = Mass, y = KineticEnergy)) + geom_point(size = 3, color = “blue”) + labs(title = “Scatter Plot of Kinetic Energy”, x = “Mass”, y = “Kinetic Energy”) + theme_minimal() — # Your dataset energy_data <- data.frame( Mass = c(7), Velocity = c(15), Height = c(3), KineticEnergy = c(787.5), PotentialEnergy = c(2018.21) )

Scatter plot for Potential Energy

ggplot(energy_data, aes(x = Mass, y = PotentialEnergy)) + geom_point(size = 3, color = “green”) + labs(title = “Scatter Plot of Potential Energy”, x = “Mass”, y = “Potential Energy”) + theme_minimal() — #How Did I Do It? In slide I wrote a code and it went like “energy_data\(KineticEnergy <- 0.5 * energy_data\)Mass * energy_data\(Velocity^2 energy_data\)PotentialEnergy <- energy_data\(Mass * 9.8 * energy_data\)Height

print(energy_data)” and that is how I created that slide :)

GOODBYE