Joe Riel

7712 Reputation

22 Badges

14 years, 110 days

MaplePrimes Activity

These are answers submitted by Joe Riel

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));

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.  

The following code compares three ways to do this

A := Matrix(100):

isRowZero1 := proc(A,i)
    andmap(Testzero, A[i,..]);
end proc:

isRowZero2 := proc(A,i)
local j;
    for j to upperbound(A,2) do
        if A[i,j] <> 0 then
            return false;
        end if;
    end do;
    return true;
end proc:

isRowZero3 := proc(A,i)
    not rtable_scanblock(A,[i, 1..upperbound(A,2)],'HasNonZero');
end proc:

memory used=10.45KiB, alloc change=32.00MiB, cpu time=88.00us, real time=88.00us, gc time=3.20us

memory used=2.47KiB, alloc change=0 bytes, cpu time=36.00us, real time=35.80us, gc time=0ns

memory used=200 bytes, alloc change=0 bytes, cpu time=2.80us, real time=3.00us, gc time=0ns

Using rtable_scanblock appears to be the way to go. Note that method 2 is more efficient than method 1 because it doesn't allocate memory to extract the row. That's why, in a different thread, I wished Maple had an andseq builtin. Method 3 is essentially method 2, but using rtable_scanblock with its builtin procedure HasNonZero to get some speed. When dealing with rtables (Arrays, Matrices, Vectors) rtable_scanblock works but given its more complicated interface is not something I immediately try. 


This is a rather low level approach and works for the simple case when when A is number with a unit. It won't work for the more general case of an algebraic expression with a unit. If you have to deal with such expressions you would be better off writing a small procedure that operates on the non-Unit part of the expression. Let me know if you need help doing that.

Set Digits := 10 before calling Histogram.

A simple method is

subs(beta-1 = 1, e44_6);

You can then multiply by the factor if desired.


map(`/`, e44_6, beta-1)

If R is a list, then you could do 

if member(R[i], R[1..i-1]) then
It would be nice if Maple provided an orseq builtin, then one could do
if orseq(R[i]=R[k], k=1..i-1) then

The small advantage of that hypothetical solution is that it wouldn't allocate extra memory for a sublist that is not otherwise required.

First 6 7 8 9 10 11 12 Last Page 8 of 100