Search code examples
maximawxmaxima

How to get the correct solution of this simple equation in wxMaxima?


I am trying to solve the following simple equation in wxMaxima:

21.3874=0.00202415/(d^3)

When I use solve(), I get 3 solutions (2 complex and 1 real). I know that d is real and positive (because it's a diameter) so I'm only interested in the third solution. It's given in the following form: d=((40483)^(1/3))/(10427748^(1/3)) and I tried saving it with map() function but it saved all 3 solutions and I don't know how to map only the last one so that I can use it for further calculations.

Anyway, after rewriting this solution and using float() function on it, the result is: 0.1571668 But it's incorrect since the result should be 0.0455717.

Interestingly, to_poly_solve() gives different solutions with the real one being: 0.2439467

I have 3 questions regarding this problem:

  1. Why does wxMaxima give two incorrect solutions and how to get the right one ?
  2. How can I tell the Maxima that I am looking only for real and positive solution of a given equation.
  3. Is it possible to map selected solution so that it can be referenced in further calculations (for example to use float() on it) ?

Solution

  • Hmm, when I try it, I get the expected result (0.0455717).

    (%i5) mysolutions: solve (21.3874 = 0.00202415/(d^3), d);
    
    rat: replaced 21.3874 by 106937/5000 = 21.3874
    
    rat: replaced -0.00202415 by -40483/20000000 = -0.00202415
                            1/3           1/3
               sqrt(3) 40483    %i - 40483
    (%o5) [d = ------------------------------, 
                                 1/3
                        20 427748
                                 1/3           1/3             1/3
                    sqrt(3) 40483    %i + 40483           40483
              d = - ------------------------------, d = ------------]
                                      1/3                        1/3
                             20 427748                  10 427748
    

    In order to isolate just the third solution, note that solve returns a list, so you can just say mysolutions[3] (or whatever is the name of the variable to which the result of solve was assigned).

    If you just want the numerical value, you can say rhs(mysolutions[3]) where rhs = "right-hand side". There is also lhs = "left-hand side".

    However, note that it's convenient to just use the equation d = something as an argument to subst in order to substitute the value into some other expression, e.g.:

    (%i6) preferred_solution: mysolutions[3];
                                       1/3
                                  40483
    (%o6)                   d = ------------
                                         1/3
                                10 427748
    (%i7) float (preferred_solution);
    (%o7)                d = 0.04557166543026844
    (%i8) subst (preferred_solution, %pi*(d/2)^2);
                                   2/3
                              40483    %pi
    (%o8)                     -------------
                                        2/3
                              400 427748
    (%i9) float (%);
    (%o9)                 0.001631096598182001