Skip to content

brainpy.analysis.PhasePlane2D.plot_nullcline has two branches #718

Open

Description

@Newtonpula

In my single compartment HH-like model, the nullcline of the voltage variable has two branches. When I use brainpy.analysis.PhasePlane2D.plot_nullcline() to plot the nullcline, the endpoints of the two branches are connected. Is there any way to avoid this?

Activity

  1. chaoming0625 commented on Feb 25, 2025

    @chaoming0625
    Member

    can you show the image?

  2. Newtonpula commented on Feb 25, 2025

    @Newtonpula
    Author

    can you show the image?

    Image

  3. chaoming0625 commented on Feb 25, 2025

    @chaoming0625
    Member

    what does the endpoints of the two branches are connected mean?

  4. Newtonpula commented on Feb 25, 2025

    @Newtonpula
    Author

    what does the endpoints of the two branches are connected mean?

    The middle part of the N-shape V nullcline should not exist, it just connects the endpoints of the left branch and the right branch of the V nullcline.

    Attach is the same plot with fmt='o', but I want to use fmt='-'.

    Image

  5. chaoming0625 commented on Feb 25, 2025

    @chaoming0625
    Member

    Maybe you need to plot by yourself. plot_nullcline(with_return=True) will return all points, and then you can draw what you want. Can this solve your question?

  6. Newtonpula commented on Feb 25, 2025

    @Newtonpula
    Author

    Maybe you need to plot by yourself. plot_nullcline(with_return=True) will return all points, and then you can draw what you want. Can this solve your question?

    Yes, it solves my question. Thanks very much.

  7. github-actions commented on Oct 7, 2025

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 14 days if no further activity occurs. If this issue is still relevant, please comment to keep it open. Thank you for your contributions!

  8. Han-Shen-math commented on Oct 12, 2026

    @Han-Shen-math

    I investigated the branch-connectivity question behind this report and prepared a short research note and a reproducible test package. The existing with_return=True workaround helped the reporter; the attached work considers what guarantees an automatic replacement could offer.

    The general limitation: there is no algorithm that always terminates and correctly determines the complete connected-component structure for every smooth equation, even when the complete finite formula, all constituent functions, and all coefficients are visible. The precise formula language in the note allows rational constants, pi, sine, arithmetic, exponential, division on its domain, and explicitly written smooth piecewise definitions. Even deciding whether the zero set in the fixed square [-1,1]^2 has exactly two components is undecidable in this class.

    The proof reduces Wang's established real-zero existence theorem (1974) to that fixed-square question using an explicit smooth compactification. It permits degenerate zero sets and infinitely many components. It does not establish impossibility under additional regularity assumptions, or for rational polynomial curves. The note is an AI-assisted research exposition based on prior results, not a claim of a newly discovered foundational theorem.

    A practical direction for BrainPy: specialize by the structure of the nullcline equation and preserve branch connectivity in the plotting representation. BrainPy accepts user-defined ODE functions, so the admissible inputs are not limited to a finite catalogue of built-in models. Nevertheless, common model families can be supported progressively:

    • Use analytic nullcline mappings or explicitly supplied branch descriptions when available.
    • Use certified root isolation/subdivision for exact polynomial formulas; require appropriate domain checks before extending this to rational formulas.
    • For regular non-polynomial equations, use continuation or interval-based subdivision with explicit assumptions. Continuation from selected seeds alone does not prove that every component was found.
    • For general numerical callables, provide a resolution-limited fallback and retain an unresolved state when connectivity cannot be established. Increasing resolution or cutting long edges can help, but neither is a universal certificate.

    The artificial connecting segments in this issue remain a concrete plotting problem that can be addressed without solving the unrestricted topology problem. A staged implementation would need additional model-specific work and regression cases covering disconnected branches, genuine connections, folds, small loops, and singularities. The original HH-like equations are not included in the issue, so these experiments do not reproduce that exact model.

    Attached validation (standalone research code, Mac CPU):

    Check Result
    Regression, symbolic-construction, and certificate-verifier tests 100 passed
    Tracing experiments 87 runs: 21 configurations repeated 3 times, plus 24 parameterized cases
    Outcomes among the 21 configurations 17 certified, 3 unresolved, 1 unsupported
    Symbolic compactification examples with analytic answers 6

    The unresolved/unsupported cases are retained in the results. Tests exercise the implementations; the impossibility conclusion comes from the mathematical proof. These are not full BrainPy integration tests or evidence that #718 has already been fixed.

    Files:

    Start with REPRODUCE.md in the ZIP. The certificate checker is implemented separately from the generator, although both share the SymPy backend. The package is a research prototype with documented assumptions, not a proposed drop-in BrainPy patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions