Skip to content

Commit

Permalink
Fix in docs and README.
Browse files Browse the repository at this point in the history
  • Loading branch information
michakraus committed Feb 8, 2024
1 parent bcaebb5 commit 2a4fed5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
```

Expand Down
2 changes: 1 addition & 1 deletion docs/src/integrators/vprk.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}) , &
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
```
Expand Down

0 comments on commit 2a4fed5

Please sign in to comment.