File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,15 @@ function term_matcher_constructor(term, acSets)
150150 result = loop (frankestein, bindings, matchers)
151151 result != = nothing && return success (result, 1 )
152152 end
153+
154+ # if data is of the alternative form 1/(...), it might match with exponent = -1
155+ if (operation (data) === / ) && isequal (arguments (data)[1 ], 1 )
156+ denominator = arguments (data)[2 ]
157+ T = symtype (denominator)
158+ frankestein = Term {T} (^ , [denominator, - 1 ])
159+ result = loop (frankestein, bindings, matchers)
160+ result != = nothing && return success (result, 1 )
161+ end
153162
154163 # if data is a exp call, it might match with base e
155164 if operation (data)=== exp
Original file line number Diff line number Diff line change 121121 @test r1 (1 / a^ b) === (a, - b) # uses frankestein
122122 @test r1 (1 / a^ (b+ 2 c)) === (a, - b- 2 c) # uses frankestein
123123 @test r1 (1 / a^ 2 ) === (a, - 2 ) # uses opposite_sign_matcher
124+ @test r1 (1 / a) === (a, - 1 )
124125
125126 r2 = @rule (~ x)^ (~ y + ~ z) => (~ x, ~ y, ~ z) # rule with term as exponent
126127 @test r2 (1 / a^ (b+ 2 c)) === (a, - b, - 2 c) # uses frankestein
You can’t perform that action at this time.
0 commit comments