Message Boards Message Boards

Unexpected result from Simplify?

Posted 2 years ago

Hello,

I am using Mathematica for the first time. I was attracted by the possibility of being able to solve a system of equations without much hassle.

Of course, because I still don't know very well how to use it, the results have not been great.

I have two questions: 1) Why Mathematica doesn't get rid of VoutMoins, VoutPlus, Vplus and Vmoins with Simplify?

enter image description here

2) I provided the initial equations to solve the problem. After that, I had to tell Mathematica, how to do the substitutions to achieve the equation that I desire. Is it possible to do everything in one line? Something like

Solve[eq1, eq2, eq3, etc, {(VoutPlus-VoutMoins)/(VoutPlus-Vmoins)}]

Being the eq1, eq2, eq3, etc the starting equations that I found for the problem and (VoutPlus-VoutMoins)/(VoutPlus-Vmoins) the equation I am looking for.

Thank you for your help

I am attaching the notebook that I created.

POSTED BY: Waulu S
4 Replies

This is still confusing but I think you might want something like this.

(1) Define equations. Not solutions, but actual equations. I rationalize also, though that can be avoided sometimes.

eqns = {
   ZCP == 1/(I*2*Pi*frequency*CP),
   ZCin == 1/(I*2*Pi*frequency*Cin),
   ZCL == 1/(I*2*Pi*frequency*CL),
   ZP == 1/(1/RP + 1/ZCP),
   Zin == 1/(1/Rin + 1/ZCin),
   RPOL == 1/(1/RO + 1/(RL + ZCL)),
   Iplus + IfbPlus == ILplus,
   Iin + IpullUp == IfbPlus,
   Iin + IfbMoins == Isig,
   IfbMoins + Imoins == ILmoins,
   Iplus == ((VCC2V5 + Av/2*Vd) - V1)/RO,
   IfbPlus == (Vmoins - V1)/ZP,
   ILplus == (V1 - VoutPlus)/RL,
   IpullUp == (VCC2V5 - Vmoins)/RP,
   Iin == Vd/Zin,
   Isig == (Vsig - Vplus)/RP,
   IfbMoins == (Vplus - V3)/ZP,
   Imoins == ((VCC2V5 + Av/2*Vd) - V3)/RO,
   ILmoins == (V3 - VoutMoins)/RL,
   Vd == Vplus - Vmoins,
   CurrPlus == (Av/2*Vd + VCM)/(RO),
   CurrMoins == (Av/2*Vd + VCM)/(RO),
   (Vmoins - V1)/RP + CurrPlus == V1/RPOL,
   (Vplus - V3)/RP + CurrMoins == V3/RPO,
   VoutPlus == V1*ZCL/(RL + ZCL),
   VoutMoins == V3*ZCL/(RL + ZCL),
   gain == (VoutPlus - VoutMoins)/(VoutPlus - Vmoins)
   };

(2) Convert to polynomials. Not really needed but I do it anyway.

polys = Numerator[Together[Apply[Subtract, eqns, {1}]]]

(* {6250000 I + 7 \[Pi] ZCP, 500000000 I + \[Pi] ZCin, 
 2500000 I + 11 \[Pi] ZCL, -510 ZCP + 510 ZP + 
  ZCP ZP, -12000000 ZCin + 12000000 Zin + ZCin Zin, -511 + 
  2565 RPOL - 10 ZCL + 50 RPOL ZCL, 
 IfbPlus - ILplus + Iplus, -IfbPlus + Iin + IpullUp, 
 IfbMoins + Iin - Isig, 
 IfbMoins - ILmoins + Imoins, -25 + 2 Iplus + 10 V1 - 5 Vd, 
 V1 - Vmoins + IfbPlus ZP, 
 511 ILplus - 10 V1 + 10 VoutPlus, -5 + 1020 IpullUp + 2 Vmoins, -Vd +
   Iin Zin, 510 Isig + Vplus - Vsig, 
 V3 - Vplus + IfbMoins ZP, -25 + 2 Imoins + 10 V3 - 5 Vd, 
 511 ILmoins - 10 V3 + 10 VoutMoins, 
 Vd + Vmoins - Vplus, -25 + 2 CurrPlus - 5 Vd, -25 + 2 CurrMoins - 
  5 Vd, 510 CurrPlus RPOL - 510 V1 - RPOL V1 + RPOL Vmoins, 
 510 CurrMoins RPO - 510 V3 - RPO V3 + RPO Vplus, 
 511 VoutPlus - 10 V1 ZCL + 10 VoutPlus ZCL, 
 511 VoutMoins - 10 V3 ZCL + 10 VoutMoins ZCL, 
 gain Vmoins - VoutMoins + VoutPlus - gain VoutPlus} *)

Now we solve just for the gain.

soln = 
 NSolveValues[polys, gain, Complement[Variables[polys], {gain}]]

(* Out[100]= {3.07079*10^-6 + 3.36972*10^-9 I} *)
POSTED BY: Daniel Lichtblau
Posted 2 years ago

Check out the function Chop

POSTED BY: Hans Milton
Posted 2 years ago

Hello Daniel,

Thank you for your response. Yes, I confess myself that I didn't do a good job explaining the problems I am facing.

I had two questions, but let just address the first question. For the second one I need more time to organize and write it in a clear way.

I don't why, but FullSimplify or Simplify are not producing the result expected.

enter image description here

With Wolfram, enter image description here

I think Mathematica does some rounding which prevents it from getting the correct result. The (8.88178*10^-16 - 7.52316*10^-37 I) in Mathematica should not exist.

Thank you

POSTED BY: Waulu S

Looking at this I cannot figure out what are equations, what are solutions, and what is really being requested. Is there perhaps a straightforward system of equations in need of being solved?

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract