Joe Riel

9660 Reputation

23 Badges

20 years, 21 days

MaplePrimes Activity


These are replies submitted by Joe Riel

In a similar vein, but without explicit indexing or raising to a power

tot := 0:
for d in convert(a,'bytes') do
     tot := 10*tot + d - 48;
end do:
tot;

In a similar vein, but without explicit indexing or raising to a power

tot := 0:
for d in convert(a,'bytes') do
     tot := 10*tot + d - 48;
end do:
tot;

For 2,

unwith(RealDomain):
 
To use RealDomain with just a few commands, it is probably better to do so within a use environment

use RealDomain in
   plot(x^(1/3), x = -1..1);
end use;

Another possibility is

with(RealDomain):
plot(x^(1/3), x = -1..1);

Note that Re(x^(1/3)) is incorrect, as you noticed.  It returns the real part of a complex root, which is different from the real root.

The reason is that Maple computes the principal value of the expression z^(1/3), which, for negative real z, lies in the upper right quadrant of the complex plane.  To see that, you may use conformalplot:

plots[conformalplot](z^(1/3), z = -1..1)

So far as the minus sign goes, that is, I believe, the en-dash in the Helvetica font. Not much can be done about that, except chose another font.

The position of the 0 (origin) is a bit weird. I assume that is because it is doing double-duty as the zero for both axes.  Aligning it vertically with the x-axis labels probably would be better. 

The suggestion in the help page seems reasonable to me; one can always use limit with the left or right option. How would you suggest evaluating an expression at a singularity?  Note, too, that the help page specifically mentions a singularity (not "discontinuity"); for example, one can do

y := sin(x)/x:
eval(y, x=0);
Error, numeric exception: division by zero
limit(y, x=0);
                   1

Here's a way to avoid a local operator

eval(map(`*`,a,'b'));

Here's a way to avoid a local operator

eval(map(`*`,a,'b'));

The introduction of parentheses as "programming indices" for rtables in Maple 12 precludes that application. See the help page ?rtable_indexing.

The introduction of parentheses as "programming indices" for rtables in Maple 12 precludes that application. See the help page ?rtable_indexing.

The following variations also work:

map(appy, M, x,y);
map(`?()`, M, [x,y]);

The following variations also work:

map(appy, M, x,y);
map(`?()`, M, [x,y]);

Notice the following discrepancy:

 q := (6*((1/3)*a-1/9))/(36*a-116+12*sqrt(12*a^3-3*a^2-54*a+93))^(1/3);
                                   6 (a/3 - 1/9)
            q := --------------------------------------------------
                                       3      2             1/2 1/3
                 (36 a - 116 + 12 (12 a  - 3 a  - 54 a + 93)   )
f1 := unapply(q,a);                                                         
                                     6 (1/3 a - 1/9)
         f1 := a -> --------------------------------------------------
                                          3      2             1/2 1/3
                    (36 a - 116 + 12 (12 a  - 3 a  - 54 a + 93)   )

f2 := a -> (6*((1/3)*a-1/9))/(36*a-116+12*sqrt(12*a^3-3*a^2-54*a+93))^(1/3);
                                     6 (1/3 a - 1/9)
        f2 := a -> ---------------------------------------------------
                                             3      2              1/3
                   (36 a - 116 + 12 sqrt(12 a  - 3 a  - 54 a + 93))
f1(1/3);
                                       0

f2(1/3);
Error, (in f2) numeric exception: division by zero

Using unapply caused a conversion from sqrt to an exponent of 1/2. 

Manipulating an exprseq can be tricky; you have to be careful when passing a sequence to a procedure because Maple then interprets it as separate arguments, which may not be what you want. Also, be careful when doing something like

exprseq := [a,b],[c,d]:
for elim in exprseq do ... end do;

This may not do what you want if the exprseq contains only one sublist, it will then "unpack" the list.

First 134 135 136 137 138 139 140 Last Page 136 of 195