0
$\begingroup$

How can I exclude this term (The red box) from derivation to make it consider it as a constant (Just a constant to be multiplied ), I am getting the differentiation for the whole equation but I want a specific term to be excluded from derivation and just be multiplied as a constant.

P.s: the derivatives are with respect to r for the whole equation enter image description here

G1r = (D/r^2 + H*(((2*c)/r)*((-(1/r))*Subscript[K, 1]-(1/c)*Subscript[K, o]) - (1/c)*Subscript[K, 1]))*Sin[2*\[Theta]]; 
op2 = D[#1, r] & ; 
mur = TraditionalForm[Expand[op2[G1r]]]
$\endgroup$
3
  • 1
    $\begingroup$ You're using D as a constant, and as a derivative operator. It's best practice to avoid using capital letter variables that conflict with mathematica built-ins (C, D, E, I, K, N, O) $\endgroup$
    – flinty
    Dec 27 '21 at 12:21
  • 1
    $\begingroup$ You can do temp = G1r /. ((2*c)/r) -> X to replace this term with a 'constant' X. Then you can put back the 2c/r later with Expand[op2[temp]] /. X -> 2 c/r $\endgroup$
    – flinty
    Dec 27 '21 at 12:26
  • 3
    $\begingroup$ rule1 = Times[2, c, Power[r, -1], rest__] :> Times[temp, rest]; then rule2 = temp :> 2c/r $\endgroup$
    – Bob Hanlon
    Dec 27 '21 at 16:23

Your Answer

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

Browse other questions tagged or ask your own question.