Skip to content

Conversation

ChrisRackauckas
Copy link
Member

Summary

This PR adds comprehensive docstrings to all major problem constructors in ModelingToolkit.jl that reference the appropriate solver documentation for extended keyword arguments.

Changes Made

DifferentialEquations.jl References

  • ODEProblem: Added docstring with reference to DifferentialEquations.jl solve documentation
  • SDEProblem: Added docstring with reference to DifferentialEquations.jl solve documentation
  • DAEProblem: Added docstring with reference to DifferentialEquations.jl solve documentation
  • BVProblem: Added docstring with reference to DifferentialEquations.jl solve documentation
  • DDEProblem: Added docstring with reference to DifferentialEquations.jl solve documentation
  • JumpProblem: Added docstring with reference to DifferentialEquations.jl solve documentation

NonlinearSolve.jl References

Other Solver References

Motivation

Previously, users had no clear indication that ModelingToolkit problem constructors accept additional keyword arguments beyond those explicitly listed. This led to confusion about available solver options.

Each docstring now includes:

  1. Clear documentation of the explicit parameters
  2. A prominent "Additional Keyword Arguments" section
  3. Direct links to the relevant solver documentation
  4. Explanation that kwargs... are passed through to the solver

Test Plan

  • Formatted code with JuliaFormatter
  • All changes are documentation-only (no functional changes)
  • Verified docstrings render correctly in Julia help system

🤖 Generated with Claude Code

claude added 4 commits July 30, 2025 10:39
…tors

This adds comprehensive docstrings to all major problem constructors in ModelingToolkit.jl
that reference the appropriate solver documentation for extended keyword arguments:

- ODEProblem, SDEProblem, DAEProblem, BVProblem, DDEProblem, JumpProblem → DifferentialEquations.jl docs
- NonlinearProblem → NonlinearSolve.jl docs
- OptimizationProblem → Optimization.jl docs
- LinearProblem → LinearSolve.jl docs

Each docstring now clearly indicates that additional keyword arguments are supported
beyond those listed, with links to the relevant solver documentation for complete
details on available options.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Instead of only referencing generic solver documentation, the docstrings now
point to ModelingToolkit's own problem building documentation as the primary
reference, with solver-specific docs as secondary references.

This provides better context for MTK-specific features and workflows while
still pointing users to the underlying solver documentation for advanced options.

All problem constructor docstrings now reference:
1. ModelingToolkit.jl problem building documentation (primary)
2. Relevant solver documentation (secondary)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…uctor docstrings

Modified docs/src/API/problems.md to reference ModelingToolkit's exported problem
constructors directly instead of always using SciMLBase references. This ensures
that the generated documentation shows ModelingToolkit's enhanced docstrings that
include references to both MTK's problem building documentation and the relevant
solver documentation.

Updated references:
- ODEProblem, SDEProblem, JumpProblem → Now use MTK's enhanced docstrings
- NonlinearProblem, OptimizationProblem, SteadyStateProblem → Now use MTK's enhanced docstrings
- IntervalNonlinearProblem, DiscreteProblem, ImplicitDiscreteProblem → Now use MTK's enhanced docstrings

Non-exported types (DAEProblem, DDEProblem, BVProblem, LinearProblem) still reference
SciMLBase versions, but users calling these through ModelingToolkit will see the
enhanced docstrings in the REPL help system.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Updated @docs blocks in docs/src/API/problems.md to use proper Documenter.jl
method signature syntax to catch ModelingToolkit's specific method dispatches.

Now using explicit method signatures like:
- SciMLBase.ODEProblem(::System, ::Any, ::Any)
- SciMLBase.NonlinearProblem(::System, ::Any)
- SciMLBase.OptimizationProblem(::System, ::Any)

This ensures that Documenter.jl will find and display ModelingToolkit's enhanced
docstrings that include references to both MTK's problem building documentation
and the relevant solver documentation, instead of showing the generic SciMLBase
docstrings.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link
Member

@AayushSabharwal AayushSabharwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs for problems/functions are done programmatically in src/problems/docs.jl. Adding docstrings inline to the function constructors is not valid.

@ChrisRackauckas
Copy link
Member Author

Well that's wrong haha. It should be using the docstring dispatch.

1 similar comment
@ChrisRackauckas
Copy link
Member Author

Well that's wrong haha. It should be using the docstring dispatch.

ChrisRackauckas added a commit to ChrisRackauckas/ModelingToolkit.jl that referenced this pull request Jul 30, 2025
@ChrisRackauckas ChrisRackauckas deleted the add-problem-docstring-references branch July 30, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants