Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build a system with Unicode symbols in variable names #559

Closed
nsajko opened this issue Nov 24, 2023 · 2 comments
Closed

Can't build a system with Unicode symbols in variable names #559

nsajko opened this issue Nov 24, 2023 · 2 comments

Comments

@nsajko
Copy link

nsajko commented Nov 24, 2023

julia> using DynamicPolynomials, HomotopyContinuation

julia> @polyvar c₀ c₀ₛ c₀ₒ
(c₀, c₀ₛ, c₀ₒ)

julia> System([2*c₀ + 3*c₀ₛ - 1*c₀ₒ])
ERROR: KeyError: key 'ₒ' not found
Stacktrace:
  [1] getindex(h::Dict{Char, Int64}, key::Char)
    @ Base ./dict.jl:510
  [2] #15
    @ ~/.julia/packages/HomotopyContinuation/WyXzI/src/model_kit/symbolic.jl:20 [inlined]
  [3] iterate(g::Base.Generator, s::Vararg{Any})
    @ Base ./generator.jl:48 [inlined]
  [4] collect_to!(dest::AbstractArray{T}, itr::Any, offs::Any, st::Any) where T
    @ Base ./array.jl:831 [inlined]
  [5] collect_to_with_first!(dest::AbstractArray, v1::Any, itr::Any, st::Any)
    @ Base ./array.jl:809 [inlined]
  [6] _collect(c::Vector{Char}, itr::Base.Generator{Vector{Char}, HomotopyContinuation.ModelKit.var"#15#19"}, ::Base.EltypeUnknown, isz::Base.HasShape{1})
    @ Base ./array.jl:803
  [7] collect_similar
    @ ./array.jl:702 [inlined]
  [8] map
    @ ./abstractarray.jl:3307 [inlined]
  [9] (::HomotopyContinuation.ModelKit.var"#14#18")(str_index::SubString{String})
    @ HomotopyContinuation.ModelKit ~/.julia/packages/HomotopyContinuation/WyXzI/src/model_kit/symbolic.jl:20
 [10] iterate(g::Base.Generator, s::Vararg{Any})
    @ Base ./generator.jl:48 [inlined]
 [11] _collect(c::Vector{SubString{String}}, itr::Base.Generator{Vector{SubString{String}}, HomotopyContinuation.ModelKit.var"#14#18"}, ::Base.EltypeUnknown, isz::Base.HasShape{1})
    @ Base ./array.jl:793
 [12] collect_similar
    @ ./array.jl:702 [inlined]
 [13] map
    @ ./abstractarray.jl:3307 [inlined]
 [14] sort_key(v::HomotopyContinuation.ModelKit.Variable)
    @ HomotopyContinuation.ModelKit ~/.julia/packages/HomotopyContinuation/WyXzI/src/model_kit/symbolic.jl:19
 [15] _broadcast_getindex_evalf
    @ ./broadcast.jl:677 [inlined]
 [16] _broadcast_getindex
    @ ./broadcast.jl:650 [inlined]
 [17] getindex
    @ ./broadcast.jl:604 [inlined]
 [18] macro expansion
    @ ./broadcast.jl:972 [inlined]
 [19] macro expansion
    @ ./simdloop.jl:77 [inlined]
 [20] copyto!
    @ ./broadcast.jl:971 [inlined]
 [21] copyto!
    @ ./broadcast.jl:924 [inlined]
 [22] copy
    @ ./broadcast.jl:896 [inlined]
 [23] materialize
    @ ./broadcast.jl:871 [inlined]
 [24] sort!(vs::Vector{HomotopyContinuation.ModelKit.Variable}; kwargs::@Kwargs{})
    @ HomotopyContinuation.ModelKit ~/.julia/packages/HomotopyContinuation/WyXzI/src/model_kit/symbolic.jl:27
 [25] sort!
    @ ~/.julia/packages/HomotopyContinuation/WyXzI/src/model_kit/symbolic.jl:27 [inlined]
 [26] _variables(ex::Expression)
    @ HomotopyContinuation.ModelKit ~/.julia/packages/HomotopyContinuation/WyXzI/src/model_kit/symengine.jl:531
 [27] variables(exprs::Vector{Expression}; parameters::Vector{HomotopyContinuation.ModelKit.Variable})
    @ HomotopyContinuation.ModelKit ~/.julia/packages/HomotopyContinuation/WyXzI/src/model_kit/symbolic.jl:197
 [28] variables
    @ ~/.julia/packages/HomotopyContinuation/WyXzI/src/model_kit/symbolic.jl:194 [inlined]
@saschatimme
Copy link
Member

Seems to be an issue with DynamicPolynomials. You can use

using HomotopyContinuation
@var c₀ c₀ₛ c₀ₒ

instead

@nsajko
Copy link
Author

nsajko commented Nov 27, 2023

I'd like to report the bug to DynamicPolynomials. Do you have any idea what the problem is there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants