This image demonstrates what Euler’s method does, it is a numerical approximation of an analytical solution. It is an incredibly useful tool, which we will see demonstrated in this presentation, for cases where data must be quickly approximated as a smooth curve rather than a discontinuous set of data points.
Calculated Graph with ggplot
ggplot(aes(x = x, y = y), data = euler) +
geom_point(aes(color = "blue"), size = 0.1, alpha = 1) +
xlab("Input x Values") +
ylab("Calculated y Values") +
geom_hline(aes(yintercept = mean(y)), size = 0.5, color = "red", linetype = 4) +
labs(shape = "Calculated", color = "Calculated",
caption = "*This is a plot of calculated values", title = "Calculated Figure") +
theme_rbook()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0. ## ℹ Please use `linewidth` instead. ## This warning is displayed once every 8 hours. ## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was ## generated.
## Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0. ## ℹ Please use the `linewidth` argument instead. ## This warning is displayed once every 8 hours. ## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was ## generated.
## Warning: The `size` argument of `element_rect()` is deprecated as of ggplot2 3.4.0. ## ℹ Please use the `linewidth` argument instead. ## This warning is displayed once every 8 hours. ## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was ## generated.
Analytical Graph with ggplot
ggplot(aes(x = x, y = Solution), data = euler) +
geom_point(size = 0.1, alpha = 1) +
xlab("Input x Values") +
ylab("Exact y Values") +
geom_hline(aes(yintercept = mean(Solution)), size = 0.5, color = "red", linetype = 4) +
labs(shape = "Exact", color = "Exact",
caption = "*This is a plot of exact values", title = "Analytical Figure") +
scale_y_continuous()+
scale_color_gradientn(colors = c("#1252ED", "#12ED3F", "#EDAD12", "#ED12C0"),
values = c(0, 0.25, 0.5, 0.75, 1)) +
theme_rbook()
3D Plot of Solutions
readeuler <- read.csv("EulerFun.csv")
euler <- readeuler[, 1:5]
X = euler$Solution
Y = euler$y
Z = euler$x
fig <- plot_ly(x=X, y=Y, z=Z,
type="scatter3d", mode="markers", color = Z)
fig <- fig %>% layout(list(
scene = list(camera = list(eye = list(x = 100, y = 50, z = 10)))
))
fig <- fig %>% layout(
scene = list(
xaxis = list(range = c(0, 100)),
yaxis = list(range = c(0, 100)),
zaxis = list(range = c(0, 5))
)
)
fig
Finding General Solution
\[ Differential\:Equation: 3y'' + 4y' - 4y = 0 \\ \:\\ Characteristic\:Equation: 3r^2 + 4r - 4 = 0 \\ \:\\ Roots: r =\:-2,\:\frac{2}{3} \\ \:\\ Case: Real\:and\:Unique\:Roots \\ \:\\ General\:Solution:\: C_1e^{-2x}\:+\:C_2e^{2/3x} \]
Finding Specific Solution
\[ General\:Solution:\: C_1e^{-2x}\:+\:C_2e^{2/3x} \\ \:\\ Initial\:Conditions:\: y(0)=0,\; y'(0)=6 \\ \:\\ 0=C_1+C_2,\:\:C_1=-C_2 \:\\ 6 = -2C_1+\frac{2}{3}C_2 \:\\ 6 = 2C_2+\frac{2}{3}C_2 \:\\ C_1 = -\frac{9}{4},\:\:C_2 = \frac{9}{4}\\ \:\\ Specific\:Solution: y(x) =-\frac{9}{4}e^{-2x}\:+\:\frac{9}{4}e^{2/3x} \]
Euler Engine Excel File
A caption