Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The problem lies in Maxima : Consider the case where I is a variable. Solving it in Maxima :

/* Original system, keeping I as a *variable* */
(%i31) Sys:[I1*(w*I*L1 + 1/(w*I*C1)) + I2*(-1/(w*I*C1) ) = U,
I2*(w*I*L2 + 1/(w*I*C1) + 1/(w*I*C2)) + I3*(w*I*M23 - 1/(w*I*C2)) + I1*(- 1/(w*I*C1)) = 0,
I3*(1/(w*I*C3) + w*I*L3 + 1/(w*I*C2)) + I2*(w*I*M23 - 1/(w*I*C2)) - I4/(w*I*C3) = 0,
I4/(w*I*C3) + I4*RL - I3/(w*I*C3) = 0]$

(%i32) IVars:[I1, I2, I3, I4]$
/* Solution of the original system */
(%i33) Sol: solve(Sys, IVars)$
/* Solution check : */
(%i34) map(lambda([x], is(ratsimp(subst(Sol, x)))), Sys);
(%o34)                     [true, true, true, true]

What happents when I is replaced by the imaginary unit constant %i in Maxima :

(%i35) Sys0:map(lambda([x], subst(I=%i, x)), Sys)$
/* Solution */
(%i36) Sol0: solve(Sys0, IVars)$
/* Checking */
(%i37) map(lambda([x], is(ratsimp(subst(Sol0, x)))), Sys0);
(%o37)                    [true, false, false, true]
(%i38)

The transformed system gets a wrong solution. Somehow, Maxima errs in computations involving the imaginary unit %i as a constant.

This is a bug. Serious, IMHO...

Note : Mathematica does not present this problem :

In Mathematica, I denotes the imaginary unit by default :

In[28]:= I^2    
Out[28]= -1

In[29]:= Sys = {I1*(w*I*L1 + 1/(w*I*C1)) + I2*(-1/(w*I*C1) ) == U, I2*(w*I*L2 + 1/(w*I*C1) + 1/(w*I*C2)) + I3*(w*I*M23 - 1/(w*I*C2)) + I1*(- 1/(w*I*C1)) == 0, I3*(1/(w*I*C3) + w*I*L3 + 1/(w*I*C2)) + I2*(w*I*M23 - 1/(w*I*C2)) - I4/(w*I*C3) == 0, I4/(w*I*C3) + I4*RL - I3/(w*I*C3) == 0};
In[30]:= IVars = {I1, I2, I3, I4}
Out[30]= {I1, I2, I3, I4}
In[31]:= Sol = Solve[Sys, IVars];

Check (the first element of )this solution :

In[32]:= FullSimplify[#/.Sol[[1]]]&/@Sys
Out[32]= {True, True, True, True}

BTW : this solution is unique:

In[33]:= Length[Sol]    
Out[33]= 1

HTH,