The quadrature doc block advertises a six-argument Romberg/tanh-sinh form and max_panels = 0, both of which num_gauss_legendre and num_integrate reject

Open Beginner friendly
#371 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
documentation

Research direction

Find the shared help text for num_gauss_legendre, num_clenshaw_curtis, and num_integrate; the issue does not name its file. Start by locating those help entries and checking each operator’s accepted arguments and max_panels validation. Update the docs to match the accepted calls and behavior, then verify that the separate Romberg and infinite integration operators are named as entry points.

Written by the indexing model from the issue text.

Description

area/numerical good first issue help wanted kind/doc-mismatch severity/4-minor

The doc block shared by num_gauss_legendre, num_clenshaw_curtis and num_integrate describes argument lists that the operators do not accept: the six-argument "Romberg/tanh-sinh" form is rejected as an arity error, and num_integrate rejects max_panels = 0 although the same text says the first panel is evaluated even then.

suppressWarnings(suppressMessages(library(rssn)))
s <- rssn_session()
f <- rssn_callback(function(x) sin(x), s, signature = "(float) -> float")
p <- function(lbl, e) cat(sprintf("%-46s %s\n", lbl,
       tryCatch(value_text(e), error = function(z) paste("ERROR:", conditionMessage(z)))))
p("gauss_legendre(a,b,tol,levels,evals,cb)",
  call_value("num_gauss_legendre", 0, pi, 1e-12, 10, 2000, f, session = s))
p("clenshaw_curtis(a,b,tol,levels,evals,cb)",
  call_value("num_clenshaw_curtis", 0, pi, 1e-12, 10, 2000, f, session = s))
p("integrate(..., max_panels = 0)",
  call_value("num_integrate", 0, pi, 1e-12, 1e-12, 0, f, session = s))
p("integrate(..., max_panels = 1)",
  call_value("num_integrate", 0, pi, 1e-12, 1e-12, 1, f, session = s))
gauss_legendre(a,b,tol,levels,evals,cb)        ERROR: operator takes 5 arguments, got 6
clenshaw_curtis(a,b,tol,levels,evals,cb)       ERROR: operator takes 5 arguments, got 6
integrate(..., max_panels = 0)                 ERROR: outside the domain of the operator: quadrature panel budget must be positive and fit usize
integrate(..., max_panels = 1)                 {value: 2, error: 0.00000000000002220446049250313, evaluations: 15, converged: true}

op_help("num_gauss_legendre") says, verbatim: "Fixed rules: a,b,order,max_evaluations,callback. Romberg/tanh-sinh: a,b,tolerance,max_levels,max_evaluations,callback. Semi-infinite rules: finite_bound,tolerance,max_evaluations,callback; ... Full infinite rule: tolerance,max_evaluations,callback." The first list is the only one that operator accepts — the other three belong to num_analysis_integrate_romberg_scaled, num_integrate_semi_infinite and num_integrate_infinite, which are separate operators. A reader who wants adaptive Romberg calls the documented six-argument form and gets an arity error with no pointer to the real entry point.

For the second half, op_help("num_integrate") says "The first panel is evaluated even if max_panels is zero", but the operator refuses the call outright: the panel budget is validated as "must be positive", so the documented behaviour (one panel, converged = false) is unreachable. max_panels = 1 is accepted and correctly returns converged: true for this integrand.

Both are contract text rather than computation: the numbers the operators do return are right (order-8 Gauss-Legendre is exact for x^13 on [0,1], order-16 Clenshaw-Curtis too).

rssn 0.3.0, R 4.6.2 binding, Windows x86_64.

Dominant language
Rust
Stars
36
Forks
3
Avg merge
14h 51m
Merged PRs (30d)
29

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Apich-Organization/rssn

All issues in Apich-Organization/rssn

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.