Skip to content

Violation of the (informal) Number interface #331

@baggepinnen

Description

@baggepinnen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions