Skip to content

Commit b1225be

Browse files
committed
Fix punctuation and improve code formatting in singular control example
- Fix double punctuation in mathematical explanations (remove duplicate colons) - Improve code formatting: add explicit return nothing in shoot! function - Add blank line for better readability in function definition - Make sentences more fluid by combining with commas instead of line breaks
1 parent c3c5f3b commit b1225be

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

docs/src/example-singular-control.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,13 @@ For the arc to remain singular, $\dot{H}_{01} = 0$, which gives:
134134
u_s = -\frac{H_{001}}{H_{101}},
135135
```
136136

137-
whenever $H_{101} \neq 0$. Computing $H_{001} = \{H_0, H_{01}\}$ with $H_{01} = -p_1 \sin\theta + p_2 \cos\theta$:
138-
139-
The only non-zero contribution comes from the $(x, p_1)$ pair:
137+
whenever $H_{101} \neq 0$. Computing $H_{001} = \{H_0, H_{01}\}$ with $H_{01} = -p_1 \sin\theta + p_2 \cos\theta$, the only non-zero contribution comes from the $(x, p_1)$ pair:
140138

141139
```math
142140
H_{001} = \frac{\partial H_0}{\partial x} \frac{\partial H_{01}}{\partial p_1} - \frac{\partial H_0}{\partial p_1} \frac{\partial H_{01}}{\partial x} = p_2 \cdot (-\sin\theta) - \cos\theta \cdot 0 = -p_2 \sin\theta.
143141
```
144142

145-
Computing $H_{101} = \{H_1, H_{01}\}$ with $H_1 = p_3$ and $H_{01} = -p_1 \sin\theta + p_2 \cos\theta$:
146-
147-
The only non-zero contribution comes from the $(\theta, p_3)$ pair:
143+
Computing $H_{101} = \{H_1, H_{01}\}$ with $H_1 = p_3$ and $H_{01} = -p_1 \sin\theta + p_2 \cos\theta$, the only non-zero contribution comes from the $(\theta, p_3)$ pair:
148144

149145
```math
150146
H_{101} = \frac{\partial H_1}{\partial \theta} \frac{\partial H_{01}}{\partial p_3} - \frac{\partial H_1}{\partial p_3} \frac{\partial H_{01}}{\partial \theta} = 0 - 1 \cdot (-p_1 \cos\theta - p_2 \sin\theta) = p_1 \cos\theta + p_2 \sin\theta.
@@ -276,6 +272,7 @@ Define the shooting function. We have 5 unknowns: the initial costate $p_0 \in \
276272
t0 = 0
277273
278274
function shoot!(s, p0, θ0, tf)
275+
279276
q_t0, p_t0 = [0, 0, θ0], p0
280277
q_tf, p_tf = f(t0, q_t0, p_t0, tf)
281278
@@ -289,6 +286,8 @@ function shoot!(s, p0, θ0, tf)
289286
pyf = p_tf[2]
290287
θf = q_tf[3]
291288
s[5] = pxf * cos(θf) + pyf * (sin(θf) + 1) - 1
289+
290+
return nothing
292291
end
293292
nothing # hide
294293
```

0 commit comments

Comments
 (0)