maple

how make maple return polar form in degrees


Is there a way to have Maple use and return complex numbers in polar format, using degrees?

Something like below...

enter image description here


Solution

  • There is no setting to automatically return in that way.

    But you can set up utility procedures do various parts. For example

    1. convert something into degpolar form (like convert to polar, but with degrees rather than radian as the context)
    2. pretty-printing (2D Math markup) of something in that degpolar form, in the manner you've shown
    3. turning something in that form back into the usual complex form

    First, some utility procedures, to illustrate,

    restart;
    `convert/degpolar`:=proc(x)
       degpolar(abs(x),180/Pi*argument(x));
    end proc:
    `print/degpolar`:=proc(ma,ar)
       uses Typesetting;
       mrow(Typeset(`∠`(ma,ar)),mi("°"));
    end proc:
    `evalc/degpolar`:=proc(ma,ar)
       ma*(cos(ar*Pi/180)+I*sin(ar*Pi/180));
    end proc:
    

    And now an example of use (for which I won't show the output since it gets marked up by the Maple GUI),

    a := 1/2+sqrt(3)/2*I;
    
    ans := convert(a, degpolar);
    
    evalc(ans);
    

    And now an example where you enter something in that form,

    ex2 := degpolar(4, 225);
    
    evalc(ex2);
    

    I think that you'll find that the argument of 1/2+1/2*i*3^(1/2) is Pi/3, not 2*Pi/3.

    If you want you could instead assign that convert/degpolar to ∠, and then be able to use the "angle" symbol from the left-panel palettes, for marked-up 2D Input. That might be more advanced than you're expecting. See also here and here (for code that attempts "phasors" in a few ways).