Here's an example to illustrate the issue I'm having.
right = 8 - y;
left = y^2 + 6;
integrand = HoldForm[Evaluate[right]] - HoldForm[Evaluate[left]]
(I realize this is a strange form for integrand
but it is the form I need to work with.) Here, HoldForm
allows its argument to be evaluated, and then holds the form of the resulting output. This is what I wanted.
Then
simpleintegrand = ReleaseHold[integrand]
which is fine.
However,
HoldForm[Integrate[Evaluate[simpleintegrand], {y, 0, 1}]]
yields
(removing the Evaluate
doesn't help) when I was after $$\int_0^1 (2-y-y^2)\,dy.$$
(In another direction, I'd actually prefer to get $$\int_0^1 (-y^2-y+2)\,dy$$ and am happy to hear how, but the crux of my question is how to use HoldForm
when its argument involves nested commands like above.)
Integrate[HoldForm[Evaluate@simpleintegrand], {y, 0, 1}]
but I've failed to applyPolynomialForm[#,TraditionalOrder->True]&
to get the second form. $\endgroup$Evaluate
only works when it is at the first level of a held expression. Consider:Hold[1, Evaluate[2 + 2], 3]
versusHold[{1, Evaluate[2 + 2], 3}]
-- in the second case nothing evaluates. But instead of telling us that this "is the form I need to work with" why don't you tell us what you are trying to accomplish and we may be able to give you a different approach. $\endgroup$HoldForm
! One possible solution to your first question isHoldForm[Integrate[#, {y, 0, 1}]]&[Evaluate[simpleintegrand]]
. I'll mark it as duplicate so you'll see the original Q&A. $\endgroup$Integrate
and the evaluation of the integrand, whereas there was only the former in the linked question. $\endgroup$