JuliaDiff / JuliaDiff/TaylorSeries.jl

Violation of the (informal) `Number` interface

Open
#331 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
388
Forks
55
Avg merge
16h 24m
Merged PRs (30d)
3

Description

I have been hitting my head at #330 for quite some time now, and I just realized that it's due to the type TaylorN claiming to be a <: Number, but deviates from the interface for getindex for numbers:

julia> x, = set_variables("x")
1-element Vector{TaylorN{Float64}}:
  1.0 x + 𝒪(‖x‖²¹)

julia> x
 1.0 x + 𝒪(‖x‖²¹)

julia> x isa Number
true

julia> x === x[]
true

julia> x === x[1]
false

For any scalar x::Number, the operations x[] and x[1] are expected to be identical, but for TaylorN they aren't.

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 Julia example with TaylorN and compare x[] with x[1]. Start by locating TaylorN's getindex implementation and the Number interface behavior; done means both forms return the same scalar value while preserving existing indexing behavior. Verify the result with focused TaylorN tests or the project's test suite.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.