JuliaApproximation / JuliaApproximation/ApproxFun.jl

cumsum on Laurent space Fun does not work

Open
#957 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
559
Forks
71
PR merge metrics
No merged PRs in 30d

Description

julia> f = Fun(Laurent(), [1,2,3,4])
Fun(Laurent(【0.0,6.283185307179586❫), [1, 2, 3, 4])

julia> cumsum(f)
ERROR: AssertionError: ncoefficients(f) == 0 || abs(f.coefficients[1]) < 100 * eps()
Stacktrace:
 [1] integrate(f::Fun{Taylor{PeriodicSegment{…}, ComplexF64}, Int64, SubArray{Int64, 1, Vector{…}, Tuple{…}, true}})
   @ ApproxFunFourier ~/.julia/packages/ApproxFunFourier/AYt6V/src/calculus.jl:56
 [2] cumsum(f::Fun{Taylor{PeriodicSegment{…}, ComplexF64}, Int64, SubArray{Int64, 1, Vector{…}, Tuple{…}, true}})
   @ ApproxFunBase ~/.julia/packages/ApproxFunBase/jd32s/src/Fun.jl:714
 [3] iterate
   @ ./generator.jl:47 [inlined]
 [4] _collect(c::Vector{…}, itr::Base.Generator{…}, ::Base.EltypeUnknown, isz::Base.HasShape{…})
   @ Base ./array.jl:854
 [5] collect_similar
   @ ./array.jl:763 [inlined]
 [6] map
   @ ./abstractarray.jl:3286 [inlined]
 [7] cumsum(f::Fun{ApproxFunBase.SumSpace{Tuple{…}, PeriodicSegment{…}, ComplexF64}, Int64, Vector{Int64}})
   @ ApproxFunBase ~/.julia/packages/ApproxFunBase/jd32s/src/Spaces/SumSpace.jl:312
 [8] top-level scope
   @ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.

julia> versioninfo()
Julia Version 1.10.10
Commit 95f30e51f41 (2025-06-27 09:51 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (x86_64-apple-darwin24.0.0)
  CPU: 16 × Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 16 default, 0 interactive, 8 GC (on 16 virtual cores)
Environment:
  JULIA_NUM_THREADS = 16

(jl_Yu4Eks) pkg> st
Status `/private/var/folders/kj/g4l55jh967zgr_gdj12tbjdm0000gn/T/jl_Yu4Eks/Project.toml`
  [28f2ccd6] ApproxFun v0.13.28

Not sure why this assertion error is triggered, since

julia> ncoefficients(f)
4

julia> abs(f.coefficients[1])
1

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Reproduce the failure with the Laurent-space Fun example, then inspect ApproxFunFourier's calculus.jl at the reported assertion and ApproxFunBase's cumsum implementation in Fun.jl and SumSpace.jl. Done means cumsum(f) completes for this example without triggering the assertion and returns the expected cumulative function.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.