# How to simplify the expression?

I have an expression as follows:

(ro*(RF + Rpi) + RC*(RF + ro + Rpi))/(RC + ro)


Now I would like to simplify it more to something like this:

RF + Rpi + (ro*RC)/(ro + RC)


I tried to use FullSimplify function but it doesn't work. Could anyone tell me how to do this? Thank you.

PS: I fixed a mistake.

• But they are not the same. ClearAll[ro, RF, Rpi, RC, Rpi]; expr = (ro*(RF + Rpi) + RC*(RF + ro + Rpi))/(RC + ro); want = ro + Rpi + (ro*RC)/(ro + RC); Simplify[expr - want] gives RF - ro So the two expressions are not mathematically equivalent? – Nasser Aug 3 '16 at 17:58
• Sorry, my mistake. The second expression is RF + Rpi + (ro*RC)/(ro + RC). – anhnha Aug 3 '16 at 18:05
• I do not know of direct way to do it. But you can do it using special code ofcourse. But what is the point? If they are mathematically equivalent, what is important about one form vs. the other? Mathematica is for computation, not for typesetting. Many simplifications work, but few expressions are hard to obtain as one wants by default. To get the expression to be in exactly the same form one wants, it is not always easy and I think it is not worth spending too much time on it, as long as the expressions are equivalent. In this case, one way to get what you want is .... – Nasser Aug 3 '16 at 18:34
• ClearAll[ro, RF, Rpi, RC, Rpi]; expr = (ro*(RF + Rpi) + RC*(RF + ro + Rpi))/(RC + ro); t0 = Apart[expr]; t1 = Apart[t0[[1]]]; (Simplify[t1[[1]] + t1[[3]]]) + t1[[2]] + Last@t0 which gives !Mathematica graphics – Nasser Aug 3 '16 at 18:34
• @Nasser Not disagreeing with the gist of your comment, I do think there are situations where such algebraic manipulations come in handy. Partial fractions for one. One can see the partial structure, discard certain terms and use the rest. – BoLe Aug 3 '16 at 19:02

expr = (ro*(RF + Rpi) + RC*(RF + ro + Rpi))/(RC + ro);


You can manually fashion specific parts. Check full form at any time if you're unsure.

expr // FullForm

(* expand the numerator *)
expand = MapAt[Expand, expr, 2]

(* collect terms in a certain way *)
collect = MapAt[Collect[#, {RF, Rpi}] &, expand, 2]

(* divide each term separately *)
Apply[Plus, collect /. x_ y_ :> x List @@ y]


RF + (RC ro)/(RC + ro) + Rpi

Try this:

 expr = (ro*(RF + Rpi) + RC*(RF + ro + Rpi))/(RC + ro);

(expr /. {RF -> x - Rpi, RC -> y - ro} // Simplify) /. {x -> RF + Rpi,
y -> RC + ro}

(*  RF + ro - ro^2/(RC + ro) + Rpi  *)


Have fun!