From 4d8f75fcd32bd804093bfafb5dffce94924b8757 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Tue, 30 Dec 2025 10:10:31 -0500 Subject: [PATCH] Fix syntax errors in documentation code examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed missing multiplication operators in exponential function (exp(1.01t) -> exp(1.01 * t)) - Fixed missing multiplication operators in Lorenz equations (10.0(u[2] -> 10.0 * (u[2]) - Fixed missing multiplication in HH_acceleration function (2x -> 2 * x) - Fixed duplicate package name in import statement (OrdinaryDiffEqOrdinaryDiffEqRKN -> OrdinaryDiffEqRKN) - Changed "inplace" to "in-place" for correct hyphenation These fixes ensure all code examples will run correctly when copied by users. Files modified: - README.md - docs/src/usage.md - docs/src/dynamicalodeexplicit/SymplecticRK.md - docs/src/dynamicalodeexplicit/RKN.md šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- README.md | 10 +++++----- docs/src/dynamicalodeexplicit/RKN.md | 4 ++-- docs/src/dynamicalodeexplicit/SymplecticRK.md | 2 +- docs/src/usage.md | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7d7e1ac20e..e5c5c8edee 100644 --- a/README.md +++ b/README.md @@ -39,15 +39,15 @@ sol = solve(prob, Tsit5(), reltol = 1e-8, abstol = 1e-8) using Plots plot(sol, linewidth = 5, title = "Solution to the linear ODE with a thick line", xaxis = "Time (t)", yaxis = "u(t) (in μm)", label = "My Thick Line!") # legend=false -plot!(sol.t, t -> 0.5 * exp(1.01t), lw = 3, ls = :dash, label = "True Solution!") +plot!(sol.t, t -> 0.5 * exp(1.01 * t), lw = 3, ls = :dash, label = "True Solution!") ``` -That example uses the out-of-place syntax `f(u,p,t)`, while the inplace syntax (more efficient for systems of equations) is shown in the Lorenz example: +That example uses the out-of-place syntax `f(u,p,t)`, while the in-place syntax (more efficient for systems of equations) is shown in the Lorenz example: ```julia using OrdinaryDiffEq function lorenz!(du, u, p, t) - du[1] = 10.0(u[2] - u[1]) + du[1] = 10.0 * (u[2] - u[1]) du[2] = u[1] * (28.0 - u[3]) - u[2] du[3] = u[1] * u[2] - (8 / 3) * u[3] end @@ -64,7 +64,7 @@ Very fast static array versions can be specifically compiled to the size of your ```julia using OrdinaryDiffEq, StaticArrays function lorenz(u, p, t) - SA[10.0(u[2] - u[1]), u[1] * (28.0 - u[3]) - u[2], u[1] * u[2] - (8 / 3) * u[3]] + SA[10.0 * (u[2] - u[1]), u[1] * (28.0 - u[3]) - u[2], u[1] * u[2] - (8 / 3) * u[3]] end u0 = SA[1.0; 0.0; 0.0] tspan = (0.0, 100.0) @@ -78,7 +78,7 @@ For "refined ODEs", like dynamical equations and `SecondOrderODEProblem`s, refer function HH_acceleration!(dv, v, u, p, t) x, y = u dx, dy = dv - dv[1] = -x - 2x * y + dv[1] = -x - 2 * x * y dv[2] = y^2 - y - x^2 end initial_positions = [0.0, 0.1] diff --git a/docs/src/dynamicalodeexplicit/RKN.md b/docs/src/dynamicalodeexplicit/RKN.md index 8f0d437f80..20c4d09037 100644 --- a/docs/src/dynamicalodeexplicit/RKN.md +++ b/docs/src/dynamicalodeexplicit/RKN.md @@ -100,11 +100,11 @@ you will need to install some of the other libraries listed in the navigation ba ## Example usage ```julia -using OrdinaryDiffEqOrdinaryDiffEqRKN +using OrdinaryDiffEqRKN function HH_acceleration!(dv, v, u, p, t) x, y = u dx, dy = dv - dv[1] = -x - 2x * y + dv[1] = -x - 2 * x * y dv[2] = y^2 - y - x^2 end initial_positions = [0.0, 0.1] diff --git a/docs/src/dynamicalodeexplicit/SymplecticRK.md b/docs/src/dynamicalodeexplicit/SymplecticRK.md index c72a2293b5..f331d7c80c 100644 --- a/docs/src/dynamicalodeexplicit/SymplecticRK.md +++ b/docs/src/dynamicalodeexplicit/SymplecticRK.md @@ -100,7 +100,7 @@ using OrdinaryDiffEqSymplecticRK function HH_acceleration!(dv, v, u, p, t) x, y = u dx, dy = dv - dv[1] = -x - 2x * y + dv[1] = -x - 2 * x * y dv[2] = y^2 - y - x^2 end initial_positions = [0.0, 0.1] diff --git a/docs/src/usage.md b/docs/src/usage.md index 85e81ddd18..70bf40e736 100644 --- a/docs/src/usage.md +++ b/docs/src/usage.md @@ -12,15 +12,15 @@ sol = solve(prob, Tsit5(), reltol = 1e-8, abstol = 1e-8) using Plots plot(sol, linewidth = 5, title = "Solution to the linear ODE with a thick line", xaxis = "Time (t)", yaxis = "u(t) (in μm)", label = "My Thick Line!") # legend=false -plot!(sol.t, t -> 0.5 * exp(1.01t), lw = 3, ls = :dash, label = "True Solution!") +plot!(sol.t, t -> 0.5 * exp(1.01 * t), lw = 3, ls = :dash, label = "True Solution!") ``` -That example uses the out-of-place syntax `f(u,p,t)`, while the inplace syntax (more efficient for systems of equations) is shown in the Lorenz example: +That example uses the out-of-place syntax `f(u,p,t)`, while the in-place syntax (more efficient for systems of equations) is shown in the Lorenz example: ```julia using OrdinaryDiffEq function lorenz(du, u, p, t) - du[1] = 10.0(u[2] - u[1]) + du[1] = 10.0 * (u[2] - u[1]) du[2] = u[1] * (28.0 - u[3]) - u[2] du[3] = u[1] * u[2] - (8 / 3) * u[3] end @@ -37,7 +37,7 @@ Very fast static array versions can be specifically compiled to the size of your ```julia using OrdinaryDiffEq, StaticArrays function lorenz(u, p, t) - SA[10.0(u[2] - u[1]), u[1] * (28.0 - u[3]) - u[2], u[1] * u[2] - (8 / 3) * u[3]] + SA[10.0 * (u[2] - u[1]), u[1] * (28.0 - u[3]) - u[2], u[1] * u[2] - (8 / 3) * u[3]] end u0 = SA[1.0; 0.0; 0.0] tspan = (0.0, 100.0) @@ -51,7 +51,7 @@ For ā€œrefined ODEsā€, like dynamical equations and `SecondOrderODEProblem`s, r function HH_acceleration(dv, v, u, p, t) x, y = u dx, dy = dv - dv[1] = -x - 2x * y + dv[1] = -x - 2 * x * y dv[2] = y^2 - y - x^2 end initial_positions = [0.0, 0.1]