Joe Riel

9530 Reputation

23 Badges

20 years, 24 days

MaplePrimes Activity


These are answers submitted by Joe Riel

Use ifactors rather than ifactor.  It's consistent format is better suited for further processing.

str := "a := x+y;":
parse(str, 'statement');
              a := x + y
                x + y
a;
                x + y

Here's a somewhat different approach.

RtableToInverseMap := proc(R :: rtable)
local T, indx, v;
    T := table('sparse');
    for indx in indices(R) do
        v := R[op(indx)];
        T[v] := (T[v],indx);
    end do;
    eval(T);
end proc:

Given an rtable, it returns a table that provides an inverse map from a value to the indices in the rtable that contain that value. Each entry of the returned table is a sequence of the lists of indices that match, but the first element is always 0. If the entry in the table is exactly 0, then no entry in the rtable matched. This method isn't ideal; worst-case occurs when all elements of the rtable are identical.

Is C:\temp a directory?

Maple doesn't show a fraction over a fraction, so if you want that you'll have to enclose the numerator in the blank function (``):

K := lcoeff(denom(outOverin),s):
``(numer(outOverin)/K)/``(collect(denom(outOverin)/K,s,simplify));

Alternatively you can do

(numer(outOverin)/K)/(collect(denom(outOverin)/K,s,simplify));

The result is pretty close to what you want.

Restart the kernel.  In the GUI, click that restart button on the toolbar, or execute the restart command. That will cause the initialization file to be reexecuted.

One possible way to handle this is to use codegen:-optimize to generate a series of equations that produce the final expression. For example

 

tmp1 := subs(hypergeom=%hypergeom, expr): # make hypergeom inert
tmp2 := [`codegen/optimize/rtable`(tmp1,'resultname=M')]:
(eqs, defs) := selectremove(type,tmp2,specindex(M)=anything):
MM := Matrix(10,10, {seq(op([1,..],eq) = rhs(eq), eq = eqs)}):

At this point you would save the list of defs and MM to the external file.

Try Optimization:-Maximize, it quickly finds the local maximum in the region.

For this particular case you might be able to use LinearAlgebra:-IdentityMatrix(5). That won't work if you plan to later modify the Matrix.

That's a really old maplev version.  The current latest is, as John says, available at my GitHub site. A newer version will be uploaded in the near future. Note that I'm still using GNU Emacs 24.4.1, not 25. If you do have issues, please contact me directly. Thanks. 

Using the Iterator package one can do

# 2 0's and 3 1's
iter := Iterator:-Chase(2,3):
seq(p[], p=iter);
   [0, 0, 1, 1, 1], [1, 0, 0, 1, 1], [0, 1, 0, 1, 1], [0, 1, 1, 0, 1], 
   [1, 0, 1, 0, 1], [1, 1, 0, 0, 1], [1, 1, 1, 0, 0], [1, 1, 0, 1, 0], 
   [1, 0, 1, 1, 0], [0, 1, 1, 1, 0]
  
n := 8650368:
P := sort(map2(op,1,ifactors(n)[2]));
                 [2, 3, 2503]
sort(ifactor(n), ``~(P));
                 ``(2)^7*``(3)^3*``(2503)

Here's why

 eval((1/s^2)^N = s^(-2*N), [s=-1,N=1/2]);  
                                           1 = -1

The short answer is no.  For the most part there is no practical way to do so.  However, if you drop the requirement that the change be stored in the mla, it is possible to temporarily modify a procedure.  The Emacs Maple Debugger provides a particularly nice way to do so.  For example, to temporarily modify the simplify procedure I would

  1. Set a breakpoint in simplify and then execute simplify.  I do both in one call with mdc(simplify)(x);
  2. Once in the debugger and in the procedure of interest, type "P" which invokes a patch utility that copies the interpreted source to a buffer (editor window).
  3. In the buffer edit the procedure accordingly.  When finished type C-c C-p to install the patch.
  4. Exit the debugger and rerun simplify.  The new code will be executed.
  5. The modified simplify will remain until a restart.

Use LinearAlgebra:-SmithForm to convert a Matrix to Smith normal form.  

First 19 20 21 22 23 24 25 Last Page 21 of 114