jhlq/Equations.jl

High powers not related correctly

Closed this issue · 1 comments

jhlq commented
julia> print((Der(-0.1*:x^:m,:x))&relations["Der"])
(-0.1) m Pow(x,(-1) + m)
julia> print((Der(-0.1*:x^3,:x))&relations["Der"])
(-0.30000000000000004) Pow(x,2)
julia> print((Der(-0.1*:x^5,:x))&relations["Der"])
ERROR: assertion failed: length(tex) == 1
 in findpows at /home/quin/.julia/v0.3/Equations/src/pow.jl:18
 in matches at /home/quin/.julia/v0.3/Equations/src/pow.jl:61
 in matches at /home/quin/.julia/v0.3/Equations/src/pow.jl:95
 in matches at /home/quin/.julia/v0.3/Equations/src/common.jl:924
 in matches at /home/quin/.julia/v0.3/Equations/src/der.jl:9
 in matches at /home/quin/.julia/v0.3/Equations/src/matchers.jl:198
 in & at /home/quin/.julia/v0.3/Equations/src/equations.jl:99
 in & at /home/quin/.julia/v0.3/Equations/src/equations.jl:108
jhlq commented

It is because of nested expressions:

julia> Der(-0.1*:x^5,:x)
Der(Expression([Factor[-0.1,:x,Expression([Factor[:x,:x]]),Expression([Factor[:x,:x]])]]),:x)

julia> print(simplify(Der(-0.1*:x^5,:x))&relations["Der"])
(-0.5) Pow(x,4)