1
$\begingroup$

Given the following expresion

expr = (I Gr0 theta Sqrt[1 - theta^2])/((2 Gr0Mz (-1 + theta^2) (1 - 2 coff1*theta trMz wn + coff1^2 trMz^2 wn^2)) + Sin[a] + Cos[b]) + (Exp[c] + Log[d])/((2 Gr0Mz (-1 + theta^2) (1 - 2 coff1 theta trMz wn + coff1^2 trMz^2 wn^2)) + Exp[c]
       );

I want to do the following replacement:

(2 Gr0Mz (-1 + theta^2) (1 - 2 coff1 theta trMz wn + coff1^2 trMz^2 wn^2))->Tp

How to do?

$\endgroup$
2
  • $\begingroup$ expr /. (2 Gr0Mz (-1 + theta^2) (1 - 2 coff1 theta trMz wn + coff1^2 trMz^2 wn^2)) -> Tp $\endgroup$ – Bill Jul 1 '18 at 16:35
  • $\begingroup$ Or expr /. Gr0Mz -> Tp/ (2 (-1 + theta^2) (1 - 2 coff1 theta trMz wn + coff1^2 trMz^2 wn^2)) $\endgroup$ – Jens Jul 1 '18 at 16:37
1
$\begingroup$

In addition to the suggestions by Bill and Jens in the comments, you can do:

Replace[expr, (2 Gr0Mz (-1 + theta^2) (1 - 2 coff1 theta trMz wn + 
       coff1^2 trMz^2 wn^2)) -> Tp, {0, Infinity}]

(E^c + Log[d])/(E^c + Tp) + (I Gr0 theta Sqrt[1 - theta^2])/( Tp + Cos[b] + Sin[a])

or

Apart @ Simplify[expr, {(2 Gr0Mz (-1 + theta^2) (1 - 2 coff1 theta trMz wn + 
        coff1^2 trMz^2 wn^2)) == Tp}] 

1 + (-Tp + Log[d])/(E^c + Tp) + (I Gr0 theta Sqrt[1 - theta^2])/( Tp + Cos[b] + Sin[a])

Simplify[Equal[%, %%]]

True

$\endgroup$

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.