Alejandro Jakubi

MaplePrimes Activity


These are replies submitted by Alejandro Jakubi

@PatrickT 

Actually, the automatic simplifier "lends" a bit of smartness to power as it processes some expressions that `^` constructs:

(-1)^(1/2); 
                                       I

(-1)^(-1/4);
                                        (3/4)
                                   -(-1)


(-1)^(7/6);
                                        (1/6)
                                   -(-1)

In this sense, `^` is an imperfect constructor as its output through the automatic simplification may be no longer of type `^`.

@acer 

In the CLI I get:

`print/`:=proc(x)
               if type(x,`^`) then
                 map(procname,x);
               else
                 cat(`#mn(`,x,`)```);
               end if;
            end proc:
 
``(5)^2*``(5)^(1/2);
                                         (5/2)
                                  #mn(5)`
eval(%);
                                         (5/2)
                                  #mn(5)`
expand(%);
                                        1/2
                                    25 5

And I get the same typeset output that you show in the Standard GUI.

@acer 

In the CLI I get:

`print/`:=proc(x)
               if type(x,`^`) then
                 map(procname,x);
               else
                 cat(`#mn(`,x,`)```);
               end if;
            end proc:
 
``(5)^2*``(5)^(1/2);
                                         (5/2)
                                  #mn(5)`
eval(%);
                                         (5/2)
                                  #mn(5)`
expand(%);
                                        1/2
                                    25 5

And I get the same typeset output that you show in the Standard GUI.

@PatrickT 

Actually, these outputs do not contain calls to sqrt, as typesetting may suggest, but constructions of the power `^` operator:

lprint(value(s1));
2^(1/2)*(Pi/z)^(1/2)

lprint(expand(s));
2^(1/2)*Pi^(1/2)*(1/z)^``(1/2)

The difference between them was described in this thread.

@PatrickT 

Actually, these outputs do not contain calls to sqrt, as typesetting may suggest, but constructions of the power `^` operator:

lprint(value(s1));
2^(1/2)*(Pi/z)^(1/2)

lprint(expand(s));
2^(1/2)*Pi^(1/2)*(1/z)^``(1/2)

The difference between them was described in this thread.

@acer 

Yes, perhaps a part of this approach that may involve more work, and may be worth to comment, is that the use statement requires the explicit expression where the replacement will be made, as the binding is resolved before evaluation time. This is an issue to take into account for long expressions: they have to be either typed fully or pasted into this statement.

@acer 

Yes, perhaps a part of this approach that may involve more work, and may be worth to comment, is that the use statement requires the explicit expression where the replacement will be made, as the binding is resolved before evaluation time. This is an issue to take into account for long expressions: they have to be either typed fully or pasted into this statement.

It says: if ode is a sum (type `+`) divide each summand by c[1] and normalize it (map on ode the composed operator normal@`/` ), otherwise divide by c[1].

Yes, this operator or functional form of if is powerful and actually used systematically by some developers. So, a place for finding additional examples of its usage is the library code itself. Sadly not a good place in the sense that this code is not documented for the users (which I consider bad).

Just three examples of many that you could find searching the library:

showstat(`Record/fixmyself`,6);
`Record/fixmyself` := proc(r::record)
local TEMPLATE, B, E, V, iform, NoInit, one, mdi;
       ...
   6   V := map(s -> `if`(s::last_name_eval,eval(s,2),s),V);
       ...
end proc


eval(`convert/Airy/from`[Sum]);
f -> `convert/to_special_function/TO_FROM`[Airy](
    `if`(nargs = 0, "query"(Sum), f), [BesselK, BesselJ])


showstat(`odeadv/WeierstrassPPrime`,16);
`odeadv/WeierstrassPPrime` := proc(f, y, x, diff_ord, INFO, c)
local ode, case, j, tmp;
       ...
  16           ode := `if`(ode::('`+`'),map('`@`(normal,`/`)',ode,c[1]),ode/c[1]);
       ...
end proc

It goes into method FTOC, using Risch algorithm, (all the other methods fail) and apparently it gets stuck in interval computations (evalr and family) trying to find limits.

@PatrickT 

I think that Maplesoft should look also at Sage about default handling of discontinuities for piecewise functions and LaTeX tick labelling. This is a quick test of both features in a bit old version of Sage (5.0.1):

x_labels=["$a$","$b$"]
y_labels=["$\\frac{1}{b-a}$"]
G=plot(Piecewise([[(-1,1),1/2]]))
G.show(xmin=-1.5,xmax=1.5,ymin=0,ymax=0.7,ticks=[[-1,1],[1/2]],
tick_formatter=latex_ticklabels(x_labels,y_labels),fontsize=25,frame=True)

@PatrickT 

I think that Maplesoft should look also at Sage about default handling of discontinuities for piecewise functions and LaTeX tick labelling. This is a quick test of both features in a bit old version of Sage (5.0.1):

x_labels=["$a$","$b$"]
y_labels=["$\\frac{1}{b-a}$"]
G=plot(Piecewise([[(-1,1),1/2]]))
G.show(xmin=-1.5,xmax=1.5,ymin=0,ymax=0.7,ticks=[[-1,1],[1/2]],
tick_formatter=latex_ticklabels(x_labels,y_labels),fontsize=25,frame=True)

This is an interesting (rethorical) question. It holds not only for piecewise-defined functions, but also for functions with known finite discontinuities like signum, Heaviside and floor. And also for functions with poles on the real axis like tan or 1/(x-1). And for any expressions containing them... Should a "theoretical" analysis of the expression be made for deciding that it contains a discontinuity within the plot range? How costly would it be? How effective would be an heuristics for this purpose?  

Interestingly, Mathematica (WolframAlpha) has discontinuity check set by default, e.g for floor. And this question extends to 3D plots. Note that one of the plot examples selected by Wolfram Research for its last piece of comparative advertisement is about this plot:

plot3d(Im(sqrt(x+I*y)),x=-2..2,y=-2..2);

joining up the branch cut.

This is an interesting (rethorical) question. It holds not only for piecewise-defined functions, but also for functions with known finite discontinuities like signum, Heaviside and floor. And also for functions with poles on the real axis like tan or 1/(x-1). And for any expressions containing them... Should a "theoretical" analysis of the expression be made for deciding that it contains a discontinuity within the plot range? How costly would it be? How effective would be an heuristics for this purpose?  

Interestingly, Mathematica (WolframAlpha) has discontinuity check set by default, e.g for floor. And this question extends to 3D plots. Note that one of the plot examples selected by Wolfram Research for its last piece of comparative advertisement is about this plot:

plot3d(Im(sqrt(x+I*y)),x=-2..2,y=-2..2);

joining up the branch cut.

The method of dividing both numerator and denominator by the numerator, plus sorting of the denominator, can be done rather handy with the command dividend:

s:=sum(x^k,k=0..infinity);
                                           1
                                  s := - -----
                                         x - 1

dividend(s); 1 ------ -x + 1
dividend(s,numer(s),[u->u,u->sort(u,[x],ascending)]); 1 ----- 1 - x
First 58 59 60 61 62 63 64 Last Page 60 of 109