This is the simple code that I came up with (after some frustration) to solve the problem of separating the sequence of positive integers from 1 to 20 into one sequence of primes and one sequence of nonprimes, and eventually displaying those sequences. I'm just curious to see what other ways this same question could have been solved.
>

I have problems with assume integer. Here is a worksheet yielding a wrong solution.
Is there something other than assume(integer)?
> restart:
> assume(k,integer);
> is(k,integer);
> is(l,integer);
> t1:=int(sin(x)*sin(k*x),x=0..Pi);
> t2:=int(sin(x)*sin(l*x),x=0..Pi);
> limit(t2,l=1);

Has anyone been able to use the statopts option in the Bootstrap command which is in the Statistics package in Maple 10? Note the following sequence of commands
> with(Statistics)
> Bootstrap('Mean', [1, 2, 3, 4, 5], replications = 6, output = array)
print(Matrix(1, 6, {(1, 1) = 2., (1, 2) = 3.39999999999999990, (1, 3) = 2.20000000000000016, (1, 4) = 2.79999999999999982, (1, 5) = 3.60000000000000008, (1, 6) = 2.20000000000000016}));
[2., 3.39999999999999990, 2.20000000000000016, 2.79999999999999982,
3.60000000000000008, 2.20000000000000016]
According to the documentation which is attached as a PDF file it appears that this command should work.

Hello, contourplot can be given a list of contours levels or a integer specifying the number of evenly spaced contour levels it should plot. In the second case, or even in the default case, is there a way to know what these contour levels are? The legend only shows Curve1, Curve2, ... but to which contour levels do these curves correspond? -- Thanks in advance, Franky.

Hello, I was wondering just how evaluation to n levels works as compared to the default eval statement (Maple 10). As an example, consider this: a := 1; whattype(''a''); // uneval whattype(eval(''a'')); // symbol whattype(eval(eval(''a''))); // integer The same information can be retrieved by adding a number to eval, indicating the level. as in: a := 1; whattype(eval(''a'',1)); // uneval whattype(eval(''a'',2)); // symbol whattype(eval(''a'',3)); // integer So I would expect the same behavior for the following example: whattype(''sin(2.0)''); // uneval whattype(eval(''sin(2.0)'')); // function

Hello Maple experts. How could I generate a way to obtain the lists (Ws) for an arbitrary m (integer +)? (Below I ilustrate for m=1,2 and 3). Probably it is needed to use "apply" and "map".. but I don't see how to do it. #If m:=1, I want to generate the #following list: >W1:= [seq([B(j1)], j1=0..1)]; # the output --> [[B(0)], [B(1)]] #If m:=2, I want to generate the #following list: >W2:= [seq(seq([B(j1,j2)],j1=0..1),j2=0..1)]; #output-> [[B(0, 0)], [B(1, 0)], [B(0, 1)], [B(1, 1)]] #If m:=3, I want to generate the #following list: >W3:= [seq(seq(seq([B(j1,j2,j3)], j1=0..1),j2=0..1),j3=0..1)];

Maple needs better user-level facilities for doing linear algebra over finite fields, particularly the integers mod n. For example there is no good way to solve a linear system Ax=B when B is a matrix. Obviously the LinearAlgebra:-Modular package is very good at what it does. Why can't there be some nice non-programmer routines which call it ?
One alternative to using the mod operator is to have all the commands in the main LinearAlgebra package accept an optional last argument for the characteristic. For example:
LinearAlgebra:-GaussianElimination(A, n);
Then in the GaussianElimination command you could do something like:

I've released a Maple implementation of the F4 algorithm for computing Groebner bases. You can download it from the Maple Application Center

here, or from my personal webpage

here. The code requires Maple 10. It's faster than the Groebner[Basis] command for total degree orders, and it can be run in non-commutative algebras too. The coefficients are restricted to rational numbers or the integers mod p with p

October 23 2005
smht 44
I am trying to solve (numerically) the following system of differential equations using dsolve (Maple 9):
DGLS:=seq(seq(diff(B[i,k](t),t)=add(add(W(j,l,i,k)*B[j,l](t)-W(i,k,j,l)*B[i,k](t),l=1..N),j=1..N),k=1..N),i=1..N); The problem is posed by the coefficients W(i,k,j,l). I want to make the W(i,j,k,l) dependent on the unknown functions B[i,k](t). For that purpose I wrote a Maple program W := proc(i::integer, k::integer, j::integer, l::integer) which calculates a "transition probability" Wtrans. If Wtrans does not depend on the B[j,l] (e.g. Wtrans:=1/N^2;), everything works nice. However, if I try to use the B[i,k] somehow (e.g. if NKrit_jl > B[j,l] then Wtrans := 0.5 fi;), then error messages from the procedure W result like "Error, invalid terms in product".

Suppose you want to sort a list L ( of numbers ) and also determine order of elements as a list of indices corresponding to elements of original list L, that is, you want such a integer list "I" that

`"seq(L[I[j],j=1..nops(L))"`

to be equivalent to sorted list. This functionality is present in MATLAB in

`"[B,IX] = sort(...)"`

syntax and i come up with this problem while trying to convert a MATLAB function (

GaussQuadratureWeights) to maple. The procedure described resolves problem using a few MAPLE commands including MAPLE's built-in sort function.

What is an efficient, robust, way to extract an integer coefficient from a single term? My first thought was using lcoeff, however, it doesn't work if the term contains constants (say Pi) or floats. Currently I'm using patmatch,

icoeff := proc(t)
local k,x,kx;
return `if`(patmatch(t, k::'nonunit'(integer)*x::anything,kx)
,eval(k,kx)
,1);
end proc:
map(icoeff, [0, 1, -3.0, -3, -0., 3.0*Pi, 4*Pi, -12/5*I]);
[0, 1, 1, -3, 1, 1, 4, 1]

Consider the task of sorting a list of complex floating-point numbers by magnitude.

**First Attempt**
The usual method to do this in Maple is with the

**sort** procedure. By passing a boolean-valued function that computes then compares the magnitudes of two complex numbers, we can sort the list. The following procedure shows how this is accomplished.

sort1 := proc(L)
return sort(L, proc(z1,z2) abs(z1) <= abs(z2) end proc);
end proc:

A disadvantage of this approach is that the absolute-value procedure is called twice every time a pair of numbers is compared. For a long list, the time spent in the absolute value routine dominates the computation time.

September 17 2005
ziox 40
i have a list in the form of [[x,y,z]] where x,y,z are integers, i want to find all the elements of the form [0,y,z]. how do i do that?