Skip to content

Commit 5a897cf

Browse files
docs: fix initialization tutorial example to use D(x) instead of y
The documentation example for a well-conditioned initialization system was using `[x => 1, y => 0.0, g => 1]` which results in a structurally singular system (returning NonlinearLeastSquaresProblem). Changed to `[x => 1, D(x) => 0.0, g => 1]` with `guesses = [λ => 1, y => 0]` which properly specifies the derivative and results in a well-conditioned NonlinearProblem (actually SCCNonlinearProblem) as intended. Also fixed "NonlinearSystem" -> "NonlinearProblem" which is the correct type. Fixes #4024 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 80d2645 commit 5a897cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/src/tutorials/initialization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,10 @@ In comparison, if we have a well-conditioned system:
477477

478478
```@example init
479479
iprob = ModelingToolkit.InitializationProblem(pend, 0.0,
480-
[x => 1, y => 0.0, g => 1], guesses = [λ => 1])
480+
[x => 1, D(x) => 0.0, g => 1], guesses = [λ => 1, y => 0])
481481
```
482482

483-
notice that we instead obtained a NonlinearSystem. In this case we have to use
483+
notice that we instead obtained a NonlinearProblem. In this case we can use
484484
different solvers which can take advantage of the fact that the Jacobian is square.
485485

486486
```@example init

0 commit comments

Comments
 (0)