3
$\begingroup$

I spent quite some time trying to figure out why my answer was wrong, only to discover that it was right, just simplified in a way a very poor way in Mathematica:

vs1 = (1. (3.3 + 1. I4 R1 + 1. I4 R2) Rs)/(1. R1 + 1. R2 + 1. Rs)
vin1= (3.3*R1+vs1*R2)/(R1+R2)//Together//FullSimplify

which results in $vin1$: $$=\frac{3.3 (1. R1^2 + 1. R1 R2 + 1. R1 Rs + 1. R2 Rs + 0.30303 I4 R1 R2 Rs + 0.30303 I4 R2^2 Rs)}{((R1 + R2) (1. R1 + 1. R2 + 1. Rs))}$$

This can be reduced to: $$vin1 = \frac{(3.3 R1+3.3 Rs+1. I4 R2 Rs)}{(1. R1+1. R2+1. Rs)} ,$$ but I can't get Mathematica there. I've tried //FullSimplify, //Together, //Cancel //Factor, etc. and I cannot figure out how to have Mathematica fully simplify the resulting expression for vin1.

Thanks for the help.

$\endgroup$
6
$\begingroup$

Is

N@Simplify@Rationalize@vin1
(* (0.1 (33. R1 + (33. + 10. I4 R2) Rs))/(R1 + R2 + Rs) *)

what you are looking for? Finite precision numbers may be confusing Simplify.

$\endgroup$
  • $\begingroup$ Thank you!! Can you explain what exactly this statement is doing (and why it works)? Thanks again! $\endgroup$ – jrive Apr 24 at 14:54
  • $\begingroup$ @jrive, Rationalize converts all decimal numbers to rational numbers, after which Simplify performs the desired simplification. Finally, N coverts the rational numbers back to decimal numbers. Omit N@, if you are satisfied with an answer containing only rational numbers. In my experience, Mathematica generally works better with rational numbers. Thanks for accepting my answer. $\endgroup$ – bbgodfrey Apr 24 at 15:14
  • $\begingroup$ I wonder now if all my struggles with simplifying results in the past could have been avoided by rationalizing!! Thanks! $\endgroup$ – jrive Apr 24 at 15:25

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.