Maxima – 17 – Tipi di dati e strutture – numeri – 2

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

Default value: false
m1pbranch is the principal branch for -1 to a power. Quantities such as (-1)^(1/3) (that is, an “odd” rational exponent) and (-1)^(1/4) (that is, an “even” rational exponent) are handled as follows:

domain: real
(-1)^(1/3): -1
(-1)^(1/4): (-1)^(1/4)

domain: complex
m1pbranch: false        m1pbranch: true
(-1)^(1/3)              1/2+%i*sqrt(3)/2
(-1)^(1/4)              sqrt(2)/2+%i*sqrt(2)/2

Return true if and only if n >= 0 and n is an integer.

Returns true if expr is a literal integer, rational number, floating point number, or bigfloat, otherwise false.
numberp returns false if expr is a symbol, even if expr is a symbolic number such as %pi or %i, or declared to be even, odd, integer, rational, irrational, real, imaginary, or complex.

(%i1) numberp(42);
(%o1)                                true
(%i2) numberp(-13/19);
(%o2)                                true
(%i3) numberp(3.14159);
(%o3)                                true
(%i4) numberp(-1729b-4);
(%o4)                                true
(%i5) map(numberp, [%e, %pi, %i, %phi, inf, minf]);
(%o5)             [false, false, false, false, false, false]
(%i6) declare(a, even, b, odd, c, integer, d, rational,
              e, irrational, f, real, g, imaginary, h, complex);
(%o6)                                done
(%i7) map(numberp, [a, b, c, d, e, f, g, h]);
(%o7)      [false, false, false, false, false, false, false, false]

numer causes some mathematical functions (including exponentiation) with numerical arguments to be evaluated in floating point. It causes variables in expr which have been given numerals to be replaced by their values. It also sets the float switch on. See also %enumer.

(%i9) [sqrt(2), sin(1), 1/(1+sqrt(3))];
(%o9)                   [sqrt(2), sin(1), -----------]
                                          sqrt(3) + 1
(%i10) [sqrt(2), sin(1), 1/(1+sqrt(3))], numer;
(%o10)    [1.414213562373095, 0.8414709848078965, 0.3660254037844386]

Default value: false
The option variable numer_pbranch controls the numerical evaluation of the power of a negative integer, rational, or floating point number. When numer_pbranch is true and the exponent is a floating point number or the option variable numer is true too, Maxima evaluates the numerical result using the principal branch.Otherwise a simplified, but not an evaluated result is returned.

(%i11) (-2)^0.75;
(%o11)                             (- 2)
(%i12) (-2)^0.75, numer_pbranch: true;
(%o12)              1.189207115002721 %i - 1.18920711500272
(%i13) (-2)^(3/4);
                                      3/4  3/4
(%o13)                           (- 1)    2
(%i14) (-2)^(3/4), numer;
(%o14)                    1.681792830507429 (- 1)
(%i15) (-2)^(3/4), numer, numer_pbranch: true;
(%o15)              1.189207115002721 %i - 1.18920711500272

numerval(x_1, expr_1, ..., x_n, expr_n)
Declares the variables x_1, ..., x_n to have numeric values equal to expr_1, ..., expr_n. The numeric value is evaluated and substituted for the variable in any expressions in which the variable occurs if the numer flag is true. See also ev.

The expressions expr_1, ..., expr_n can be any expressions, not necessarily numeric.

Returns true if expr is a literal odd integer, otherwise false.
oddp returns false if expr is a symbol, even if expr is declared odd.

Default value: 2.0e-15
ratepsilon is the tolerance used in the conversion of floating point numbers to rational numbers, when the option variable bftorat has the value false.

Convert all double floats and big floats in the Maxima expression expr to their exact rational equivalents. If you are not familiar with the binary representation of floating point numbers, you might be surprised that rationalize(0.1) does not equal 1/10. This behavior isn’t special to Maxima – the number 1/10 has a repeating, not a terminating, binary representation.

(%i16) rationalize(0.5);
(%o16)                                 -
(%i17) rationalize(0.1);
(%o17)                         -----------------
(%i18) fpprec: 5$

(%i19) rationalize(0.1b0);
(%o19)                              -------
(%i20) fpprec: 20$

(%i21) rationalize(0.1b0);
(%o21)                      ----------------------
(%i22) rationalize(sin(0.1*x + 5.6));
                      3602879701896397 x   3152519739159347
(%o22)            sin(------------------ + ----------------)
                      36028797018963968    562949953421312

Returns true if expr is a literal integer or ratio of literal integers, otherwise false.

Posta un commento o usa questo indirizzo per il trackback.



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

Logo di

Stai commentando usando il tuo account 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: