I'm working with symbolic expressions using Floor and Ceiling, and I'm unable to get Simplify to evaluate them. For instance, I would expect:

Assuming[Element[n,Integers], Simplify[Ceiling[n/2] + Floor[n/2] == n]

to result in True, but it doesn't. (FullSimplify doesn't work either.)

There is a work-around using Resolve given in the comment to this question.

However, I would like to somehow implement Assuming and Simplify to achieve the same result. Is this possible? It seems such a simple, obvious expression.

Edit: Here is a more complex comparison that I haven't been able to resolve even using the work-around linked above.

Assuming[Element[n, Integers] && n > 0, Simplify[Ceiling[-(1/2) + 1/2 Sqrt[33 + 8 n]] == Floor[1/2 + 1/2 Sqrt[25 + 8 n]]]]

  • $\begingroup$ Mathematica is not able to simplify such expression involving Ceiling or Floor automatically using Simplify or FullSimplify currently. Maybe in the future they will add such capabilities. For now you have to help Mathematica with such expression by code like @MarcoB posted in his answer. $\endgroup$ Commented Dec 24, 2020 at 10:31
  • $\begingroup$ Tim, I don't think what you look for is a simplification in the sense that Mathematica understands it, i.e. it does not follow from a pattern-based reworking of the expression, but instead it requires significant mathematical insight that is simply not built in. In your question, can you include how you would recognize that those two expressions are the same by hand? Then perhaps we could write an equivalent routine and include it an a transformation function in Simplify. $\endgroup$
    – MarcoB
    Commented Dec 28, 2020 at 15:55

1 Answer 1


You could take a brute-force approach and provide your own transformation function to handle that case:

Assuming[Element[n, Integers],
    Ceiling[n/2] + Floor[n/2] == n,
    TransformationFunctions -> {Automatic, ReplaceAll[Ceiling[a_] + Floor[a_] :> 2 a]}

(* Out: True *)
  • $\begingroup$ That makes sense, thanks. However, I'm still wishing there were a way to deal with similar but more generalized floor/ceiling expressions using Simplify and Assuming. $\endgroup$
    – Tim Wagner
    Commented Dec 23, 2020 at 20:37
  • 1
    $\begingroup$ @TimWagner if you can show an example where this approach fails, then maybe we could try something different. As is, though, this solves the problem as you asked it, and unfortunately we can’t speculate further without an example. $\endgroup$
    – MarcoB
    Commented Dec 24, 2020 at 4:38
  • $\begingroup$ I've edited the question to include a more complex comparison of the kind that I'm dealing with. For this one, I couldn't even get this workaround to handle it. $\endgroup$
    – Tim Wagner
    Commented Dec 24, 2020 at 5:17

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.