From 2a4fed56d14a79e8152dbc18132d8e5608cd3120 Mon Sep 17 00:00:00 2001 From: Michael Kraus Date: Thu, 8 Feb 2024 14:01:13 +0100 Subject: [PATCH] Fix in docs and README. --- README.md | 16 ++++++++-------- docs/src/integrators/vprk.md | 2 +- docs/src/tutorial.md | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0d6265146..bb5043153 100644 --- a/README.md +++ b/README.md @@ -35,24 +35,24 @@ Before any use, we need to load `GeometricIntegrators`, ```julia using GeometricIntegrators ``` -Then we can create an `ODE` object for the equation ẋ(t) = x(t) with initial condition x(0)=1 by -```julia -ode = ODE((t, x, ẋ) -> ẋ[1] = x[1], [1.0]); +Then we can create an ODE problem for the equation $\dot{x} (t) = x(t)$ with integration time span $(0, 1)$. a time step of $\Delta t = 0.1$, and initial condition $x(0) = 1$, +```@example 1 +prob = ODEProblem((ẋ, t, x, params) -> ẋ[1] = x[1], (0.0, 1.0), 0.1, [1.0]) ``` -An integrator for this ODE, using the tableau for the explicit Euler method and a time step of Δt=0.1, is obtained by +An integrator for this ODE, using the explicit Euler method is obtained by ```julia -int = Integrator(ode, TableauExplicitEuler(), 0.1); +int = GeometricIntegrator(prob, ExplicitEuler()) ``` -With that, the solution for nₜ=10 time steps is simply computed by +With that, the solution is simply computed by ```julia -sol = integrate(ode, int, 10); +sol = integrate(int) ``` which returns an object holding the solution for all time steps. With the help of the *[Plots.jl](https://github.com/JuliaPlots/Plots.jl)* package we can visualise the result and compare with the exact solution: ```julia using Plots plot(xlims=[0,1], xlab="t", ylab="x(t)", legend=:bottomright) -plot!(sol.t, sol.q[1,:], label="numeric") +plot!(sol.t, sol.q[:,1], label="numeric") plot!(sol.t, exp.(sol.t), label="exact") ``` diff --git a/docs/src/integrators/vprk.md b/docs/src/integrators/vprk.md index e150438a0..461c768ce 100644 --- a/docs/src/integrators/vprk.md +++ b/docs/src/integrators/vprk.md @@ -4,7 +4,7 @@ CurrentModule = GeometricIntegrators.Integrators # [Variational Partitioned Runge-Kutta Integrators](@id vprk) -Variational partitioned Runge-Kutta methods solve Lagranian systems in implicit form, i.e., +Variational partitioned Runge-Kutta methods solve Lagrangian systems in implicit form, i.e., ```math \begin{aligned} p &= \dfrac{\partial L}{\partial \dot{q}} (q, \dot{q}) , & diff --git a/docs/src/tutorial.md b/docs/src/tutorial.md index d4729caf0..861bb7587 100644 --- a/docs/src/tutorial.md +++ b/docs/src/tutorial.md @@ -33,7 +33,7 @@ Before any use, we need to load GeometricIntegrators, ```@example 1 using GeometricIntegrators ``` -Then we can create an ODE object for the equation $\dot{x} (t) = x(t)$ with initial condition $x(0) = 1$, integration time span $(0, 1)$ and a time step of $\Delta t = 0.1$, +Then we can create an ODE problem for the equation $\dot{x} (t) = x(t)$ with integration time span $(0, 1)$. a time step of $\Delta t = 0.1$, and initial condition $x(0) = 1$, ```@example 1 prob = ODEProblem((ẋ, t, x, params) -> ẋ[1] = x[1], (0.0, 1.0), 0.1, [1.0]) ```