Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

Summary

  • Fixes Error printing basis objects from DMD fits #563: Error printing basis objects from DMD fits
  • Adds Base.nameof(::Difference) = :Difference to fix display errors when printing Basis objects containing Difference operators
  • The root cause is that SymbolicUtils calls nameof during symbolic expression display, but unlike Differential, the Difference type was missing this method in Symbolics.jl

Changes

  • Added Base.nameof(::Difference) = :Difference in src/DataDrivenDiffEq.jl as a workaround (with a note that this should be upstreamed to Symbolics.jl)
  • Added regression test in test/basis/basis.jl to ensure this doesn't regress

Test plan

  • Run Pkg.test() locally - all 265 tests pass
  • CI tests pass

🤖 Generated with Claude Code

Fixes SciML#563

The issue was that when displaying a Basis object containing Difference operators
(as created by DMD algorithms), SymbolicUtils would try to call `nameof` on the
Difference operator during display. However, unlike Differential which has
`Base.nameof(D::Differential) = :Differential` defined in Symbolics/src/diff.jl,
the Difference type was missing this method.

This commit adds `Base.nameof(::Difference) = :Difference` to DataDrivenDiffEq
as a workaround. This should ideally be upstreamed to Symbolics.jl.

Also adds a regression test to ensure this doesn't regress.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@ChrisRackauckas-Claude
Copy link
Author

Closing this PR - the fix is type piracy. Moving the fix to Symbolics.jl where the Difference type is defined.

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.

Error printing basis objects from DMD fits

2 participants