Skip to content

Commit 7837ece

Browse files
committed
add t0 in flow
1 parent e37a793 commit 7837ece

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/src/tutorial-free-times-initial.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ The **shooting function** encodes:
155155

156156
```@example initial_time
157157
function shoot!(s, p0, t1, t0)
158-
x1, p1 = f_pos(t0, x0, p0, t1)
159-
x2, p2 = f_neg(t1, x1, p1, tf)
158+
x1, p1 = f_pos(t0, x0, p0, t1, t0)
159+
x2, p2 = f_neg(t1, x1, p1, tf, t0)
160160
161-
s[1:2] = x2 - xf # Final state match
162-
s[3] = H(x0, p0, u_pos) - 1 # Hamiltonian normalization
163-
s[4] = p1[2] # Switching condition
161+
s[1:2] = x2 - xf # Final state match
162+
s[3] = H(x0, p0, u_pos) - 1 # Hamiltonian normalization
163+
s[4] = p1[2] # Switching condition
164164
end
165165
nothing # hide
166166
```
@@ -211,6 +211,6 @@ Compare with the direct solution:
211211

212212
```@example initial_time
213213
f = f_pos * (t1, f_neg) # Concatenate bang-bang flow
214-
indirect_sol = f((t0, tf), x0, p0; saveat=range(t0, tf, 200))
214+
indirect_sol = f((t0, tf), x0, p0, t0; saveat=range(t0, tf, 200))
215215
plot!(plt, indirect_sol; label="indirect", color=:red, linestyle=:dash)
216216
```

0 commit comments

Comments
 (0)