Patterns.negtive

please advise how can I define a pattern to negative exponent.
i.e. -(x+1)^2

thanks
Itzik

in this case, i would do something like:

p = patterns
pX = p.literal(“x”)
pValid = p.negative( p.exponent( p.sum(pX, p.number), p.number ) )

if you want to force it to be 1 and 2 (and not check values later) you can do:

p = patterns
pX = p.literal(“x”)
pValid = p.negative( p.exponent( p.sum(pX, p.number.satisfies(“x=1”)), p.number.satisfies(“x=2”) ) )

excellent, exactly what I was looking for. thanks

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.