Documentation for eval_when



Am Sonntag, den 02.10.2011, 23:35 +0100 schrieb Rupert Swarbrick:
> Hi,
> 
> Here's a stab at a translation for the two functions you sent. My German
> is mediocre, but I guess it's not like I'm trying to translate poetry or
> something!
> 
> I've made some notes at the bottom about things I intended to change
> (rather than things I misunderstood) and also some questions that I had
> when reading it. I hope this doesn't create too much extra work for you!
> 
> Rupert
> 
> (skip ahead to "NOTES" for my questions)
> 
> ----------------------------------------------------------------------
> Function: abs (z)
> 
> The abs function represents the mathematical absolute value function and
> works for both numerical and symbolic values. If the argument, z, is a
> real or complex number, abs returns the absolute value of z. If
> possible, symbolic expressions using the absolute value function are
> also simplified.
> 
> Maxima can differentiate, integrate and calculate limits for some
> expressions containing abs. The abs_integrate package further extends
> Maxima's ability to calculate integrals involving the abs function. See
> (%i12) in the examples below.
> 
> When applied to a list or matrix, abs automatically distributes over
> the terms. Similarly, it distributes over both sides of an
> equation. To alter this behaviour, see the variable distribute_over.
> 
> Examples:
> 
> Calculation of abs for real and complex numbers, including numerical
> constants and various infinities. The first example shows how abs
> distributes over the elements of a list.
> 
> (%i1) abs([-4, 0, 1, 1+%i]);
> (%o1)                  [4, 0, 1, sqrt(2)]
> 
> (%i2) abs((1+%i)*(1-%i));
> (%o2)                           2
> (%i3) abs(%e+%i);
>                                 2
> (%o3)                    sqrt(%e  + 1)
> (%i4) abs([inf, infinity, minf]);
> (%o4)                   [inf, inf, inf]
> 
> Simplification of expressions containing abs:
> 
> (%i5) abs(x^2);
>                                 2
> (%o5)                          x
> (%i6) abs(x^3);
>                              2
> (%o6)                       x  abs(x)
> 
> (%i7) abs(abs(x));
> (%o7)                       abs(x)
> (%i8) abs(conjugate(x));
> (%o8)                       abs(x)
> 
> Integrating and differentiating with the abs function. Note that, if
> the abs_integrate package is loaded, more integrals involving the abs
> function can be performed. The last example shows the Laplace
> transform of abs: see laplace.
> 
> (%i9) diff(x*abs(x),x),expand;
> (%o9)                       2 abs(x)
> 
> (%i10) integrate(abs(x),x);
>                              x abs(x)
> (%o10)                       --------
>                                 2
> 
> (%i11) integrate(x*abs(x),x);
>                            /
>                            [
> (%o11)                     I x abs(x) dx
>                            ]
>                            /
> 
> (%i12) load(abs_integrate)$
> (%i13) integrate(x*abs(x),x);
>                       2           3
>                      x  abs(x)   x  signum(x)
> (%o13)               --------- - ------------
>                          2            6
> 
> (%i14) integrate(abs(x),x,-2,%pi);
>                                2
>                             %pi
> (%o14)                      ---- + 2
>                              2
> 
> (%i15) laplace(abs(x),x,s);
>                                1
> (%o15)                         --
>                                 2
>                                s
> 
> ----------------------------------------------------------------------
> 
> Function: cabs (expr) 
> 
> Calculates the absolute value of an expression representing a complex
> number. Unlike the function abs, the cabs function always decomposes
> its argument into a real and an imaginary part. If x and y represent
> real variables or expressions, the cabs function calculates the
> absolute value of x + %i*y as
> 
>             sqrt (y^2 + x^2).
> 
> The cabs function can use symmetry properties and identities of
> complex functions to help it calculate the absolute value of an
> expression. If such identities exist, they can be advertised to cabs
> using function properties. The symmetries that cabs understands are:
> mirror symmetry, conjugate function and complex characteristic.
> 
> cabs is a verb function and is not very suitable for symbolic
> calculations. For such calculations (including integration,
> differentiation and taking limits of expressions containing absolute
> values), use abs.
> 
> The result of cabs can include the absolute value function, abs, and
> the arc tangent, atan2.
> 
> When applied to a list or matrix, cabs automatically distributes over
> the terms. Similarly, it distributes over both sides of an equation.
> 
> For further ways to compute with complex numbers, see the functions
> rectform, realpart, imagpart, carg, conjugate and polarform.
> 
> Examples:
> 
> Examples with sqrt and sin.
> 
> (%i1) cabs(sqrt(1+%i*x));
>                              2     1/4
> (%o1)                      (x  + 1)
> (%i2) cabs(sin(x+%i*y));
>                     2        2         2        2
> (%o2)       sqrt(cos (x) sinh (y) + sin (x) cosh (y))
> 
> The error function, erf, has mirror symmetry, which is used here in
> the calculation of the absolute value with a complex argument:
> 
> (%i3) cabs(erf(x+%i*y));
>                                           2
>            (erf(%i y + x) - erf(%i y - x))
> (%o3) sqrt(--------------------------------
>                           4
>                                                                2
>                                 (erf(%i y + x) + erf(%i y - x))
>                               - --------------------------------)
>                                                4
> 
> Maxima knows complex identities for the Bessel functions, which allow
> it to compute the absolute value for complex arguments. Here is an
> example for bessel_j.
> 
> (%i4) cabs(bessel_j(1,%i));
> (%o4)                 abs(bessel_j(1, %i))
> 
> ----------------------------------------------------------------------
> 
> 
> NOTES:
> ======
> 
> Some things I changed (intentionally!) from the German text: maybe
> these are improvements.
> 
> (1) I pointed at the abs_integrate example when the abs_integrate
>     package is mentioned.
> 
> (2) I explained why one should see distribute_over.
> 
> (3) Since sqrt and sin are from the English names, I didn't clarify
>     what they were in the cabs examples.
> 
> Questions I have after reading this, which would be nice to add
> answers for! Providing this isn't just from my poor German, maybe
> answering these could improve the German manual too.
> 
> (1) Why is abs_integrate functionality not permanently loaded if it
>     improves Maxima's ability to integrate functions with abs() in? (I
>     presume the answer is that it slows down general integration, but
>     can someone confirm this?)
> 
> (2) Is the repeat of the information about abs_integrate necessary?
>     Maybe the text about it can be removed from the examples section,
>     since it's already explained above? (Especially if there's a
>     forward reference, like I added)
> 
> (3) Is there a reason that abs takes z as an argument and cabs takes
>     expr?
> 
> (4) I'm a bit confused about the German in the first sentence of the
>     second paragraph in cabs. I suspect that what I wrote isn't quite
>     what you meant.
> 
> (5) Is it possible for a user to set a property indicating that
>     his/her function f has mirror symmetry, say? Maybe this
>     documentation should point to the properties a user can set. Maybe
>     with an example? (I would suggest wording, but I don't actually
>     know how to do this!)
> 
> (6) Also, what exactly do these properties mean? Are they documented
>     elsewhere? (In which case, it would probably be good to have "See
>     foo, bar")
> 
> (7) Is there a reason that cabs doesn't respect distribute_over?
> _______________________________________________

Hello Rupert,

your translation is great and your comments are very helpful to improve
the documentation of both the English and the German version even more.
I will go through your comments tomorrow, today it is to late.

Thank you very much.

Dieter Kaiser