From eab578348695cf074f8c19e62d5932f305db6c68 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Wed, 28 Jun 2023 11:47:40 +0200 Subject: [PATCH] improve docs (#146) * make output of build_function tutorial more readable * bump version * mention AverageVectorFieldMethod in docs * fix printing of benchmarks * update commend on Requires.jl * fix docstring of energy_preserving_order --- Project.toml | 2 +- docs/src/benchmark_python_orderconditions.py | 3 ++- docs/src/tutorials/bseries_creation.md | 8 ++++++++ docs/src/tutorials/code_generation.md | 2 +- src/BSeries.jl | 11 ++++++----- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index 6063b58b..bfb60bbb 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "BSeries" uuid = "ebb8d67c-85b4-416c-b05f-5f409e808f32" authors = ["Hendrik Ranocha and contributors"] -version = "0.1.54" +version = "0.1.55" [deps] Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" diff --git a/docs/src/benchmark_python_orderconditions.py b/docs/src/benchmark_python_orderconditions.py index 31c1e1ed..67cb11aa 100644 --- a/docs/src/benchmark_python_orderconditions.py +++ b/docs/src/benchmark_python_orderconditions.py @@ -40,7 +40,8 @@ print("", end_time - start_time, "seconds", file=io) -print("\nModifying integrator") +with open(io_file, 'a') as io: + print("\nModifying integrator", file=io) start_time = time.time() BSeries.set_order(up_to_order) diff --git a/docs/src/tutorials/bseries_creation.md b/docs/src/tutorials/bseries_creation.md index 348224b6..cdac34c2 100644 --- a/docs/src/tutorials/bseries_creation.md +++ b/docs/src/tutorials/bseries_creation.md @@ -204,6 +204,14 @@ series = bseries(5) do t, series end ``` +[BSeries.jl](https://github.com/ranocha/BSeries.jl) also offers a +convenience constructor using the type [`AverageVectorFieldMethod`](@ref) +as follows. + +```@example ex:AVF +series == bseries(AverageVectorFieldMethod(), 5) +``` + We can check that this method is second-order accurate by comparing it to the B-series of the exact solution, truncated at the same order. diff --git a/docs/src/tutorials/code_generation.md b/docs/src/tutorials/code_generation.md index 7e0874c4..050f0184 100644 --- a/docs/src/tutorials/code_generation.md +++ b/docs/src/tutorials/code_generation.md @@ -39,7 +39,7 @@ Finally, we generate a C function that evaluates the expressions above. ```@example code-generation -build_function(du, α, p, q, h, target = Symbolics.CTarget()) +println(build_function(du, α, p, q, h, target = Symbolics.CTarget())) ``` The [Symbolics.jl](https://github.com/JuliaSymbolics/Symbolics.jl) function `build_function` diff --git a/src/BSeries.jl b/src/BSeries.jl index fb4f7e2e..57cabdbd 100644 --- a/src/BSeries.jl +++ b/src/BSeries.jl @@ -1394,7 +1394,8 @@ Internal function specialized on symbolic variables and expressions from - [SymPy.jl](https://github.com/JuliaPy/SymPy.jl), and - [Symbolics.jl](https://github.com/JuliaSymbolics/Symbolics.jl) -if these packages are loaded (via Requires.jl). +if these packages are loaded (via Requires.jl or weak dependencies on +Julia v1.9 and newer). """ function compute_derivative end @@ -1546,12 +1547,12 @@ function renormalize!(series) end """ - energy_preserving(rk::RungeKuttaMethod, max_order) + energy_preserving_order(rk::RungeKuttaMethod, max_order) -This function checks up to which order a Runge-Kitta method 'rk' is +This function checks up to which order a Runge-Kutta method `rk` is energy-preserving for Hamiltonian problems. -It requires a 'max_order' so that it does not run forever if the order up to -which the method is energy_preserving is too big or infinite. +It requires a `max_order` so that it does not run forever if the order up to +which the method is energy-preserving is too big or infinite. See also [`is_energy_preserving`](@ref) """