JuliaApproximation / JuliaApproximation/ApproxFunBase.jl

Subtracting two simple, seemingly compatible functions (f - g) results in wrong answer upon evaluation (typeof(f) = Chebyshev ⨁ CosSpace ⨁ SinSpace and typeof(g) = Chebyshev)

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

Nobody has claimed this yet.

Dominant language
Julia
Stars
13
Forks
13
Avg merge
10h 33m
Merged PRs (30d)
16

Description

using ApproxFun
Dc = Chebyshev(Interval(0,1.))
Df = Fourier(Interval(0,1.))
rx = Fun(t -> cospi(2*t), Df)
ry = Fun(t -> sinpi(2*t), Df)
twoπx = Fun(x -> 2π*x, Dc)
ell = sqrt(differentiate(rx)^2 + differentiate(ry)^2)
L = cumsum(ell)
println(L(1) == twoπx(1)) # expected value: true
println((L - twoπx)(1) ≈ 0) # therefore, expected value: true
println((L - twoπx)(1) == L(1)) # expected value: false

Doing this on a chalkboard we would find L := 2πx and so (L - twoπx) ≡ 0. However, the actual results from this example are: true, false, true.

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

Start by running the Julia reproduction in the issue and verify the three printed results. Trace subtraction and evaluation for L, twoπx, and the Chebyshev ⨁ CosSpace ⨁ SinSpace representation. Done means evaluating (L - twoπx)(1) agrees with the expected zero result without breaking the shown equality checks.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.