3
$\begingroup$

I have a problem with an unevaluated derivative. In the example code below, i need the integration wrt to y be evaluated, while the differentation wrt x needs to stay unevaluated. I see the point that it is exactly the purpose of Inactive[ ] to hold the function to be differentiated "as is", but i would like to know if there is a workaround to "extract" anything not dependent on x from the inactive derivative. Any help would be highly appreciated.

Integrate[Cos[y]*Inactive[D][-Cos[y]*f[x]*Inactive[D][f[x], x], x], {y, 0, 2*Pi}]
$\endgroup$
2
$\begingroup$

Assuming expr is the integral in the question, we can manually extract any x independent terms from the differentiation as follows:

expr //. RuleDelayed[
  Inactive[D][Times[indep_ , rest___], x_] /; FreeQ[indep, x],
  indep * Inactive[D][Times[rest], x]
]
- π Inactive[D][f[x] Inactive[D][f[x], x], x]

On second thought, perhaps Dt is better suited for your purposes?

expr //. Inactive[D][arg_, x] :> Dt[arg, x, Constants -> {y}]
- π ( f'[x]^2 + f[x] f''[x] )
$\endgroup$
  • $\begingroup$ Thank you, that was exactly what I was looking for. $\endgroup$ – Alex Sep 2 '14 at 11:58
  • $\begingroup$ I think the OP might be trying to prevent the product rule from being applied (but wants the scalar multiple rule to be applied). If so, your second thought would not produce the desired output. +1 for the first thought, though. :) $\endgroup$ – Michael E2 Sep 2 '14 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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