Skip to content

Commit 2548ae1

Browse files
authored
Fixes for differentation and substitution (#43)
1 parent 117bbd5 commit 2548ae1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/arithmetic.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ end
8686
function MP.substitute(
8787
s::MP.AbstractSubstitutionType,
8888
p::_AE,
89-
args::MP.AbstractSubstitution...,
89+
args::MP.Substitutions,
9090
)
91-
return MP.substitute(s, MP.polynomial(p), args...)
91+
return MP.substitute(s, MP.polynomial(p), args)
9292
end
9393

9494
function MP.subs(p::_AE, args::MP.AbstractSubstitution...)
95-
return MP.substitute(MP.Subs(), p, args...)
95+
return MP.substitute(MP.Subs(), p, args)
9696
end
9797

9898
function (p::_AE)(args::MP.AbstractSubstitution...)
99-
return MP.substitute(MP.Eval(), p, args...)
99+
return MP.substitute(MP.Eval(), p, args)
100100
end
101101

102102
function (p::_AE)(x::NTuple{N,<:Number}) where {N}
@@ -109,6 +109,6 @@ end
109109

110110
(p::_AE)(x::Number...) = (MP.polynomial(p))(x...)
111111

112-
function MP.differentiate(p::_AE, args...)
113-
return MP.differentiate(MP.polynomial(p), args...)
112+
function MP.differentiate(p::_AE, x)
113+
return MP.differentiate(MP.polynomial(p), x)
114114
end

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ function api_test(B::Type{<:MB.AbstractMonomialIndexed}, degree)
112112
@test const_alg_el(ones(length(x))...) == const_mono
113113
@test const_alg_el(tuple(ones(length(x))...)) == const_mono
114114
@test subs(const_alg_el, x => ones(length(x))) == const_mono
115+
@test const_alg_el(x[1] => x[2], x[2] => x[1]) == const_mono
115116
@test differentiate(const_alg_el, x) == differentiate(const_mono, x)
117+
@test differentiate(const_alg_el, x, 2) == differentiate(const_mono, x, 2)
116118
end
117119

118120
function univ_orthogonal_test(

0 commit comments

Comments
 (0)