diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index eee0d9e..5456f51 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-08-28T08:24:47","documenter_version":"1.6.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-08-28T12:30:41","documenter_version":"1.6.0"}} \ No newline at end of file diff --git a/dev/application-surface-revolution-83f50555.svg b/dev/application-surface-revolution-2835b6d0.svg similarity index 91% rename from dev/application-surface-revolution-83f50555.svg rename to dev/application-surface-revolution-2835b6d0.svg index b0943c0..602ab9a 100644 --- a/dev/application-surface-revolution-83f50555.svg +++ b/dev/application-surface-revolution-2835b6d0.svg @@ -1,95 +1,95 @@ diff --git a/dev/application-surface-revolution-1817d4db.svg b/dev/application-surface-revolution-873f686f.svg similarity index 94% rename from dev/application-surface-revolution-1817d4db.svg rename to dev/application-surface-revolution-873f686f.svg index 9b18c42..7fc3aca 100644 --- a/dev/application-surface-revolution-1817d4db.svg +++ b/dev/application-surface-revolution-873f686f.svg @@ -1,210 +1,210 @@ diff --git a/dev/application-surface-revolution-c0955126.svg b/dev/application-surface-revolution-9382a039.svg similarity index 83% rename from dev/application-surface-revolution-c0955126.svg rename to dev/application-surface-revolution-9382a039.svg index 0137ea1..988c150 100644 --- a/dev/application-surface-revolution-c0955126.svg +++ b/dev/application-surface-revolution-9382a039.svg @@ -1,71 +1,71 @@ diff --git a/dev/application-surface-revolution-a55df7b3.svg b/dev/application-surface-revolution-a6e8ff9e.svg similarity index 84% rename from dev/application-surface-revolution-a55df7b3.svg rename to dev/application-surface-revolution-a6e8ff9e.svg index dfdff89..1c9dd67 100644 --- a/dev/application-surface-revolution-a55df7b3.svg +++ b/dev/application-surface-revolution-a6e8ff9e.svg @@ -1,149 +1,149 @@ diff --git a/dev/application-surface-revolution-57b97e52.svg b/dev/application-surface-revolution-e4bb4355.svg similarity index 83% rename from dev/application-surface-revolution-57b97e52.svg rename to dev/application-surface-revolution-e4bb4355.svg index 9bd3d97..3fae950 100644 --- a/dev/application-surface-revolution-57b97e52.svg +++ b/dev/application-surface-revolution-e4bb4355.svg @@ -1,70 +1,70 @@ diff --git a/dev/application-surface-revolution.html b/dev/application-surface-revolution.html index 611e130..1eab679 100644 --- a/dev/application-surface-revolution.html +++ b/dev/application-surface-revolution.html @@ -125,7 +125,7 @@ plot!(plt_u; xlabel="t", ylabel="u(t,p₀)", legend=false, ylims=(-2.5, 5)) plot!(plt_phase; xlabel="x(t,p₀)", ylabel="p(t,p₀)", legend=false, xlims=(0, 2), ylims=(-1, 2)) -plot(plt_x, plt_p, plt_u, plt_phase; layout=(2, 2), size=(800, 600))
Here, the shooting equation given by
\[ S({p₀}) = \pi(z(t_f,x_0,{p₀})) - x_f = 0,\]
with $\pi(x, p) = x$, has two solutions: $p₀ = -0.9851$ and $p₀ = 0.5126$.
π((x, p)) = x
+plot(plt_x, plt_p, plt_u, plt_phase; layout=(2, 2), size=(800, 600))
Here, the shooting equation given by
\[ S({p₀}) = \pi(z(t_f,x_0,{p₀})) - x_f = 0,\]
with $\pi(x, p) = x$, has two solutions: $p₀ = -0.9851$ and $p₀ = 0.5126$.
π((x, p)) = x
# Shooting function
S(p0) = (π ∘ ocp_flow)(t0, x0, p0, tf) - xf
@@ -169,7 +169,7 @@
plot!(plt2_u; xlabel="t", ylabel="u(t,p₀)", legend=false, ylims=(-6, 5))
plot!(plt2_phase; xlabel="x(t,p₀)", ylabel="p(t,p₀)", legend=false, xlims=(0, 2.5), ylims=(-1, 5))
-plot(plt2_x, plt2_p, plt2_u, plt2_phase; layout=(2, 2), size=(800, 600))
Now, we can compute the conjugate points along the two extremals. We have to compute the flow $\delta z(t, p₀)$ of the Jacobi equation with the initial condition $\delta z(0) = (0, 1)$. This is given solving
\[ \delta z(t, p₀) = \dfrac{\partial}{\partial p₀}z(t, p₀).\]
Note that to compute the conjugate points, we only need the first component:
\[ \delta z(t, p₀)_1.\]
using ForwardDiff
+plot(plt2_x, plt2_p, plt2_u, plt2_phase; layout=(2, 2), size=(800, 600))
Now, we can compute the conjugate points along the two extremals. We have to compute the flow $\delta z(t, p₀)$ of the Jacobi equation with the initial condition $\delta z(0) = (0, 1)$. This is given solving
\[ \delta z(t, p₀) = \dfrac{\partial}{\partial p₀}z(t, p₀).\]
Note that to compute the conjugate points, we only need the first component:
\[ \delta z(t, p₀)_1.\]
using ForwardDiff
function jacobi_flow(t, p0)
x(t, p0) = (π ∘ ocp_flow)(t0, x0, p0, t)
@@ -198,11 +198,11 @@
#
plt_conj = plot(plt_conj1, plt_conj2;
- layout=(1, 2), size=(800, 300), leftmargin=25px, bottommargin=15px)
We compute the first conjugate point along the first extremal and add it to the plot.
tau0 = Roots.find_zero(tau -> jacobi_flow(tau, sol1_p0), (0.4, 0.6))
+ layout=(1, 2), size=(800, 300), leftmargin=25px, bottommargin=15px)
We compute the first conjugate point along the first extremal and add it to the plot.
tau0 = Roots.find_zero(tau -> jacobi_flow(tau, sol1_p0), (0.4, 0.6))
println("For p0 = ", sol1_p0, " tau_0 = ", tau0)
-plot!(plt_conj[1], [tau0], [jacobi_flow(tau0, sol1_p0)]; seriestype=:scatter)
To conclude on this example, we compute the conjugate locus by using a path following algorithm. Define $F(\tau,p₀) = \delta x(\tau,p₀)$ and suppose that the partial derivative $\partial_\tau F(\tau,p₀)$ is invertible, then, by the implicit function theorem the conjugate time is a function of $p₀$. So, since here $p₀\in\R$, we can compute them by solving the initial value problem for $p₀ \in [\alpha, \beta]$:
\[ \dot{\tau}(p₀) = -\dfrac{\partial F}{\partial \tau}(\tau(p₀),p₀)^{-1}\, +plot!(plt_conj[1], [tau0], [jacobi_flow(tau0, sol1_p0)]; seriestype=:scatter)
To conclude on this example, we compute the conjugate locus by using a path following algorithm. Define $F(\tau,p₀) = \delta x(\tau,p₀)$ and suppose that the partial derivative $\partial_\tau F(\tau,p₀)$ is invertible, then, by the implicit function theorem the conjugate time is a function of $p₀$. So, since here $p₀\in\R$, we can compute them by solving the initial value problem for $p₀ \in [\alpha, \beta]$:
\[ \dot{\tau}(p₀) = -\dfrac{\partial F}{\partial \tau}(\tau(p₀),p₀)^{-1}\, \dfrac{\partial F}{\partial p₀}(\tau(p₀),p₀), \quad \tau(\alpha) = \tau_0.\]
For the numerical experiment, we set $\alpha = -0.9995$, $\beta = -0.5$.
function conjugate_times_rhs_path(tau, p0)
dF = ForwardDiff.gradient(y -> jacobi_flow(y...), [tau, p0])
@@ -236,4 +236,4 @@
#
plot(plt_x, plt_conj_times;
- layout=(1,2), legend=false, size=(800,300), leftmargin=25px, bottommargin=15px)
Settings
This document was generated with Documenter.jl version 1.6.0 on Wednesday 28 August 2024. Using Julia version 1.10.5.