Search code examples
maximawxmaxima

WxMaxima solving Equation leads to complex numbers?


I'm trying to solve the equation "eq" for "mu". How do I tell maxima that I only want the positive result, is this the best way var : abs(mu), res;? But, my main problem is, that the results contains %i, where does that come from? Shouldn't it be solvable in R, without the need for complex numbers, like I demonstrated in my "by hand"-calculation?

Arithmetic solution:

(%i16)  eq: RN^2 = R^2+N^2;
(eq)    (121*G^2*h2^2*t1^2)/(100*h1^2*t2^2)=(G^2*v^2)/(4*mu^2)+G^2/4
(%i20)  res: solve(eq,mu); var : abs(mu), res; expand(var); res, numer;
(res)   [mu=-(5*%i*h1*t2*v)/sqrt(25*h1^2*t2^2-121*h2^2*t1^2),mu=(5*%i*h1*t2*v)/sqrt(25*h1^2*t2^2-121*h2^2*t1^2)]
(var)   5*abs(h1)*abs(t2)*abs(1/sqrt(25*h1^2*t2^2-121*h2^2*t1^2))*abs(v)
(%o19)  5*abs(h1)*abs(t2)*abs(1/sqrt(25*h1^2*t2^2-121*h2^2*t1^2))*abs(v)
(%o20)  [mu=-(5*%i*h1*t2*v)/(25*h1^2*t2^2-121*h2^2*t1^2)^0.5,mu=(5*%i*h1*t2*v)/(25*h1^2*t2^2-121*h2^2*t1^2)^0.5]

Numeric solution:

(%i26)  t1: 64`mm;
    t2: 33`mm;
    h1: 47`mm;
    h2: 28`mm;
    v: 2;
(t1)    64 ` mm
(t2)    33 ` mm
(h1)    47 ` mm
(h2)    28 ` mm
(v) 2
(%i42)  res: solve(eq,mu); var : abs(mu), res; var, numer; res, numer;
(res)   [mu=-(5*%i*h1*t2*v)/sqrt(25*h1^2*t2^2-121*h2^2*t1^2),mu=(5*%i*h1*t2*v)/sqrt(25*h1^2*t2^2-121*h2^2*t1^2)]
(var)   1410/sqrt(2714239)
(%o41)  0.8558449047226222
(%o42)  [mu=-(0.8558449047226222*%i)/(-1)^0.5,mu=(0.8558449047226222*%i)/(-1)^0.5]

Solving by hand(negative result omitted): https://www.bilder-upload.eu/bild-07c372-1620053087.png.html


Solution

  • If I'm not mistaken, the result is only real if 121*h2^2*t1^2 > 25*h1^2*t2^2.

    So:

      ​eq: (121*G^2*h2^2*t1^2)/(100*h1^2*t2^2)=(G^2*v^2)/(4*mu^2)+G^2/4;
      ​assume ( 121*h2^2*t1^2 > 25*h1^2*t2^2 );
      ​solve( eq, mu);
             ​=> [mu = -(5*h1*t2*v)/sqrt(121*h2^2*t1^2-25*h1^2*t2^2),
                 mu =  (5*h1*t2*v)/sqrt(121*h2^2*t1^2-25*h1^2*t2^2) ]
    

    How do you find that magic inequality? Well, you run solve without it and note that there is a square root which might have a negative argument....