I have this expression in WXMAXIMA:
100/(25.00079433726757*%i+20)
How can i reduce to the form a + %i b?
I tried rectform, float, polarform... Any of those functions seem to simplify that simple calculus. Just two numbers. Dont imagine how...
Full process:
(%i2) load("ezunits");
numer: true;
(%o1) "/usr/share/maxima/5.45.1/share/ezunits/ezunits.mac"
(%o2) true
(%i3) R1: 20`ohm;
(%o3) 20 ` ohm
(%i9) f:50`Hz; w: 2*%pi*f;
L1: 79.58 `mH;
Z1: R1 + (w*L1 ``ohm) * %i;
cabs(Z1); float(carg(Z1)) `` degree;
(%o4) 50 ` Hz
(%o5) 314.1592653589793 ` Hz
(%o6) 79.58 ` mH
(%o7) (25.00079433726757*%i+20) ` ohm
(%o8) 32.01624146420611 ` ohm^1.0
(%o9) 51.34107977110403 ` degree
(%i81) V: 100 ` volt;
I1: V / Z1;
rectform(I1);
(%o79) 100 ` volt
(%o80) 100/(25.00079433726757*%i+20) ` volt/ohm
(%o81) realpart(100/(25.00079433726757*%i+20) ` volt/ohm)+%i*imagpart(100/(25.00079433726757*%i+20) ` volt/ohm)
As u can see at %o81, the calculus isn't simplified. Maybe unit affected? Tried to remove unit with nounit() but still everything is not simplified
(%i84) V: 100 ` volt;
I1: V / Z1;
nounit(rectform(I1));
(%o82) 100 ` volt
(%o83) 100/(25.00079433726757*%i+20) ` volt/ohm
(%o84) nounit(realpart(100/(25.00079433726757*%i+20) ` volt/ohm)+%i*imagpart(100/(25.00079433726757*%i+20) ` volt/ohm))
Okay, here's what I figured out that works. I'll start with the definitions you made.
Okay, now %o10 is the same result you got before. The ezunits package has some rules for handling
realpartandimagpart, but they weren't fully applied yet; that's probably a bug. To cause the units to move from insiderealpartandimagpart, we can cause the expression to be resimplified by re-evaluating it via''%as in %i11.Now
realpartandimagpartonly contain numerical expressions;volt/ohmwas moved outside. Now to causerealpartandimagpartto evaluate the numerical expressions, we can "verbify"realpartandimagpartviaev(...)as in %i12.Now %o12 is just a numerical expression, and we can apply
float.So the key points were %i11 and %i12. I'm sorry that these operations are completely unintuitive; the problem you ran into is a consequence of subtle and obscure aspects of Maxima. I hope that these notes help you make progress all the same. Thanks for your interest in Maxima, and ezunits in particular (I wrote the package).
EDIT: Another thing to try when working with units. There is a function
dimensionally(undocumented, sorry about that) which helps other functions, which are not aware of units, to handle the units. In this case it can helprectform. WithI1as before, I getwhich is the same result as before, but a little bit sooner to get there.