Skip to content

Add test for inhomogeneous term that during numerical integration is equal to zero#90

Merged
clinssen merged 19 commits intonest:masterfrom
clinssen:inhomogeneous_numerically_zero_warning
Aug 14, 2025
Merged

Add test for inhomogeneous term that during numerical integration is equal to zero#90
clinssen merged 19 commits intonest:masterfrom
clinssen:inhomogeneous_numerically_zero_warning

Conversation

@clinssen
Copy link
Copy Markdown
Contributor

@clinssen clinssen commented Jul 2, 2025

If the dynamics of the system is defined such that there is an inhomogeneous (constant-term) component in an ODE, but if numerically, if the inhomogeneous part is zero (this could happen in the case that one or more parameters get set to zero), then because of the way the update expressions are formulated, you could get a division by zero and this results in NaNs in the output.

To address this (but not completely fix it, see #89), ODE-toolbox should automatically check whether setting the inhomogenous part to zero results in a division by zero, and if this is the case, issue a warning. This is akin to checking for singularities in the propagators, but it occurs for the update expressions instead.

A flag is added so that singularity detection (also singularity detection in the propagators) can be disabled for the sake of faster processing. On some systems of equations, singularity detection can take a very long time.

@clinssen clinssen requested a review from pnbabu July 2, 2025 16:43
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.81%. Comparing base (221c577) to head (df13fd0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #90      +/-   ##
==========================================
+ Coverage   61.71%   61.81%   +0.10%     
==========================================
  Files          15       15              
  Lines        1460     1464       +4     
==========================================
+ Hits          901      905       +4     
  Misses        559      559              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@clinssen clinssen marked this pull request as draft July 10, 2025 11:59
@clinssen clinssen force-pushed the inhomogeneous_numerically_zero_warning branch from 382002e to bf46dd4 Compare August 5, 2025 10:36
@clinssen clinssen marked this pull request as ready for review August 5, 2025 10:37
Comment thread odetoolbox/singularity_detection.py Outdated
Comment thread tests/test_singularity_detection.py Outdated
Comment thread tests/test_singularity_detection.py
Comment thread tests/test_singularity_detection.py
@clinssen clinssen requested a review from pnbabu August 13, 2025 11:32
Copy link
Copy Markdown
Contributor

@pnbabu pnbabu left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

@clinssen
Copy link
Copy Markdown
Contributor Author

Thank you for the review!

@clinssen clinssen merged commit 0b4cefb into nest:master Aug 14, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants