Skip to content

Deprecate fzero - #523

Merged
jverzani merged 3 commits into
JuliaMath:masterfrom
jverzani:deprecate_fzero
Aug 20, 2026
Merged

Deprecate fzero#523
jverzani merged 3 commits into
JuliaMath:masterfrom
jverzani:deprecate_fzero

Conversation

@jverzani

@jverzani jverzani commented Aug 20, 2026

Copy link
Copy Markdown
Member

Add deprecation warning to fzero, fzeros and some other functions. Decide another day if those functions in simple should be deprecated. This will replace #507

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR deprecates legacy root-finding interfaces while retaining compatibility through find_zero and find_zeros.

Changes:

  • Adds deprecation warnings for fzero, fzeros, and related interfaces.
  • Relocates deprecated source and tests.
  • Updates module inclusion and test execution order.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Review
test/test_fzero.jl Reviewed; no final issues.
test/runtests.jl Reviewed; no final issues.
src/Roots.jl Reviewed; no final issues.
src/deprecated/alternative_interfaces.jl Moderate issue (4 votes): migration hints use nonexistent Roots.Quadratic_Inverse() instead of Roots.QuadraticInverse() at lines 86, 250, and 332.
Suppressed comments (6)

src/deprecated/alternative_interfaces.jl:86

  • This migration hint names Roots.Quadratic_Inverse(), but that constructor does not exist; the method is Roots.QuadraticInverse(). Following this deprecation warning therefore leads users to an UndefVarError instead of the replacement API.

This issue also appears in the following locations of the same file:

  • line 250
  • line 332
    src/deprecated/alternative_interfaces.jl:332
  • Base.depwarn uses its symbol argument to identify the deprecated feature, but fzeros is registered under :fzero. This conflates the two deprecations (including warning suppression/deduplication) and should use the fzeros key.
    src/deprecated/alternative_interfaces.jl:171
  • This overload also accepts the documented order keyword, but the hint drops it: for example, fzero(sin, 3; order=16) uses Order16() while the suggested find_zero(sin, 3) silently uses the default Order0(). The deprecation guidance should translate/preserve the selected method (and the legacy tolerance aliases) rather than claim a universal direct replacement.
    src/deprecated/alternative_interfaces.jl:218
  • When order is supplied, this overload selects that method via _method_lookup, but the hint removes it and changes the call to find_zero(f, (a,b)), whose default is Bisection(). For example, an order=1 call would no longer use the requested secant method; the migration text should preserve the selected method.
    src/deprecated/alternative_interfaces.jl:250
  • The deprecated overload explicitly invokes Newton() below, but this hint omits the method. find_zero((f, fp), x0) defaults to Order0() for a scalar x0, whose single-output wrapper takes only the first tuple component, so following the hint silently switches to derivative-free solving and ignores fp. Include Roots.Newton() in the replacement.
    test/runtests.jl:44
  • These tests exercise the deprecated calls but never assert that the new warnings are emitted, so the PR's primary behavior can regress while the suite remains green. Add @test_deprecated checks for representative fzero/fzeros overloads and the derivative-interface functions instead of only relocating the existing functional tests.
# deprecated
include("./test_fzero.jl")

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.80%. Comparing base (dc01281) to head (164e401).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #523      +/-   ##
==========================================
- Coverage   86.94%   86.80%   -0.15%     
==========================================
  Files          42       43       +1     
  Lines        2628     2697      +69     
==========================================
+ Hits         2285     2341      +56     
- Misses        343      356      +13     

☔ View full report in Codecov by Harness.
📢 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.

@jverzani
jverzani merged commit 9b0f7a3 into JuliaMath:master Aug 20, 2026
11 of 15 checks passed
@jverzani
jverzani deleted the deprecate_fzero branch August 20, 2026 23:10
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.

2 participants