# [Maxima] Re: [Maxima-bugs] [ maxima-Bugs-1407378 ] polarform returns a rectangular expression for float argumen

Stavros Macrakis macrakis at alum.mit.edu
Thu Jan 19 15:45:13 CST 2006

```------=_Part_5595_22122919.1137707113972
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

>
> (although i wonder why cabs is not the same things as abs.
> not immediately relevant here.)

Because abs is a mathematical function with simplification rules (like sin,
etc.) and cabs is a formula-manipulation function which changes the form of
its argument (like factor) and tries to give an explicit formula for the
abs, avoiding abs/cabs in the result when possible.  Also because abs
assumes that not only are all variables real, but so are all function
values.  (These are standard Maxima assumptions.)

Here are some examples of the difference:

abs(asin(x)) =3D> abs(asin(x))

cabs(asin(x)) =3D> (questions about value of x p;n;) =3D>
sqrt(log(sqrt(x^2-1)+x)^2+%pi^2/4)

--------

declare(z,complex);
abs(z) =3D> abs(z)
cabs(z) =3D> sqrt(realpart(z)^2+imagpart(z)^2)

--------

abs(sqrt(x)) =3D> sqrt(x)                -- assumes result is real
cabs(sqrt(x)) =3D> asksign x<0 =3D> sqrt(-x)

You could of course provide this functionality in some other way, e.g.
cabsexpand(abs(asin(x)))
and

------=_Part_5595_22122919.1137707113972
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(=
204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">(although i =
wonder why cabs is not the same things as abs.<br>not immediately relevant =
here.)
</blockquote><div><br></div></div>Because abs is a mathematical function wi=
th simplification rules (like sin, etc.) and cabs is a formula-manipulation=
function which changes the form of its argument (like factor) and tries to=
give an explicit formula for the abs, avoiding abs/cabs in the result when=
possible.&nbsp; Also because abs assumes that not only are all variables r=
eal, but so are all function values.&nbsp; (These are standard Maxima assum=
ptions.)
<br><br>Here are some examples of the difference:<br><br>&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; abs(asin(x)) =3D&gt; abs(asin(x))<br><br>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp; cabs(asin(x)) =3D&gt; (questions about value of x p;n;) =3D&gt;<b=
r>&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; sqrt(log(sqrt(x^2-1)+x)^2+%pi^2/4)
<br><br>--------<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; declare(z,complex);<=
br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; abs(z) =3D&gt; abs(z)<br>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; cabs(z) =3D&gt; sqrt(realpart(z)^2+imagpart(z)^2)<br><br>---=
-----<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; abs(sqrt(x)) =3D&gt; sqrt(x)&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; -- assumes result is real
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cabs(sqrt(x)) =3D&gt; asksign x&lt;0 =3D=
&gt; sqrt(-x)<br><br>You could of course provide this functionality in some=
other way, e.g.<br>&nbsp; &nbsp; &nbsp; cabsexpand(abs(asin(x)))<br>and<br=
>&nbsp; &nbsp; &nbsp; abs(sqrt(x)), domain:complex&nbsp; =3D&gt; asksign
<br><br>

------=_Part_5595_22122919.1137707113972--

```