6
$\begingroup$

I'm trying to remove terms whose exponents are positive in a polynomial. I tried this one;

Assuming[t > 0, x^t /. {x^a_ /; Positive@a -> 0}]

but the result becomes;

x^t

I want to get 0 instead of this result.

How to do so?

Thank you.

$\endgroup$

1 Answer 1

6
$\begingroup$

For some reason Mathematica doesn't apply the assumption automatically, but you can enforce it like this:

Assuming[t > 0, x^t /. {x^a_ /; Simplify[Positive@a] -> 0}]

a minimal example:

Assuming[t > 0, t > 0]
(*t>0*)
Assuming[t > 0, Simplify[t > 0]]
(*True*)
$\endgroup$
3
  • $\begingroup$ Thank you very much! If it is well-known thing, really sorry for taking your time. $\endgroup$
    – Keyspire
    Jan 10, 2020 at 8:14
  • 1
    $\begingroup$ I don't think it's well known and it would be interesting to know why mathematica behaves like this, it doesn't look like a bug. $\endgroup$
    – banone
    Jan 10, 2020 at 8:27
  • 1
    $\begingroup$ Regarding automatic application: See the documentation of Assuming: It only affects functions with the Assumptions option, so you need Simplify or similar (Positive doesn't have the option). $\endgroup$
    – Lukas Lang
    Jan 11, 2020 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.