Maxima – 59 – Funzioni matematiche – funzioni per numeri complessi

Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.178.

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

(%i1) cabs (1);
(%o1)                                  1
(%i2) cabs (1 + %i);
(%o2)                               sqrt(2)
(%i3) cabs (exp (%i));
(%o3)                                  1
(%i4) cabs (exp (%pi * %i));
(%o4)                                  1
(%i5) cabs (exp (3/2 * %pi * %i));
(%o5)                                  1
(%i6) cabs (17 * exp (2 * %i));
(%o6)                                 17

If cabs returns a noun form this most commonly is caused by some properties of the variables involved not being known:

(%i7) cabs (a+%i*b);
                                       2    2
(%o7)                            sqrt(b  + a )
(%i8) declare(a,real,b,real);
(%o8)                                done
(%i9) cabs (a+%i*b);
                                       2    2
(%o9)                            sqrt(b  + a )
(%i10) assume(a>0,b>0);
(%o10)                          [a > 0, b > 0]
(%i11) cabs (a+%i*b);
                                       2    2
(%o11)                           sqrt(b  + a )

The cabs function can use known properties like symmetry properties 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 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 with sqrt and sin.

(%i12) cabs(sqrt(1+%i*x));
                                    2     1/4
(%o12)                            (x  + 1)
(%i13) cabs(sin(x+%i*y));
                           2        2         2        2
(%o13)             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:

(%i14) cabs(erf(x+%i*y));
                                           2
            (erf(%i y + x) - erf(%i y - x))
(%o14) 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.

(%i15) cabs(bessel_j(1,%i));
(%o15)                          bessel_i(1, 1)

carg (z)
Returns the complex argument of z. The complex argument is an angle theta in (-%pi, %pi) such that r exp (theta %i) = z where r is the magnitude of z.

carg is a computational function, not a simplifying function.

See also abs (complex magnitude), polarform, rectform, realpart, and imagpart.

(%i16) carg (1);
(%o16)                                 0
(%i17) carg (1 + %i);
                                      %pi
(%o17)                                ---
                                       4
(%i18) carg (exp (%i));
                                      sin(1)
(%o18)                           atan(------)
                                      cos(1)
(%i19) carg (exp (%pi * %i));
(%o19)                                %pi
(%i20) carg (exp (3/2 * %pi * %i));
                                       %pi
(%o20)                               - ---
                                        2
(%i21) carg (17 * exp (2 * %i));
                                   sin(2)
(%o21)                        atan(------) + %pi
                                   cos(2)

If carg returns a noun form this most communly is caused by some properties of the variables involved not being known:

(%i1) carg (a+%i*b);
(%o1)                             atan2(b, a)
(%i2) declare(a,real,b,real);
(%o2)                                done
(%i3) carg (a+%i*b);
(%o3)                             atan2(b, a)
(%i4) assume(a>0,b>0);
(%o4)                           [a > 0, b > 0]
(%i5) carg (a+%i*b);
                                         b
(%o5)                               atan(-)
                                         a

conjugate (x)
Returns the complex conjugate of x.

(%i6) declare ([aa, bb], real, cc, complex, ii, imaginary);
(%o6)                                done
(%i7) conjugate (aa + bb*%i);
(%o7)                             aa - %i bb
(%i8) conjugate (cc);
(%o8)                            conjugate(cc)
(%i9) conjugate (ii);
(%o9)                                - ii
(%i10) conjugate (xx + yy);
(%o10)                              yy + xx

imagpart (expr)
Returns the imaginary part of the expression expr.

imagpart is a computational function, not a simplifying function.

See also abs, carg, polarform, rectform, and realpart.

(%i11) imagpart (a+b*%i);
(%o11)                                 b
(%i12) imagpart (1+sqrt(2)*%i);
(%o12)                              sqrt(2)
(%i13) imagpart (sqrt(2)*%i);
(%o13)                              sqrt(2)

polarform (expr)
Returns an expression r %e^(%i theta) equivalent to expr, such that r and theta are purely real.

(%i14) polarform(a+b*%i);
                               2    2    %i atan(b/a)
(%o14)                   sqrt(b  + a ) %e
(%i15) polarform(1+%i);
                                         %i %pi
                                         ------
                                           4
(%o15)                         sqrt(2) %e
(%i16) polarform(1+2*%i);
                                       %i atan(2)
(%o16)                       sqrt(5) %e

realpart (expr)
Returns the real part of expr. realpart and imagpart will work on expressions involving trigonometric and hyperbolic functions, as well as square root, logarithm, and exponentiation.

(%i17) realpart (a+b*%i);
(%o17)                                 a
(%i18) realpart (1+sqrt(2)*%i);
(%o18)                                 1
(%i19) realpart (sqrt(2)*%i);
(%o19)                                 0
(%i20) realpart (1);
(%o20)                                 1

Posta un commento o usa questo indirizzo per il trackback.

Trackback

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati derivati dai commenti.

%d blogger hanno fatto clic su Mi Piace per questo: