Question: Integer arithmetic - any special tricks?

Hi, I am working on small number integer problems for my thesis and use Maple to do keep track of ugly equations and to do some numerical simulations to see if the results make sense quantitatively.

Now, I use with(RealDomain) and assume to tell Maple some characteristics of my models, but I cannot find a way to tell Maple that most of my variables are integers (number of different agents in small groups). Is this possible?

Related (or not): I have the following:

N_unr:='sum((n_0-2+u)!/(u!*(n_0-2)!),u=0..n_P-2)';

N2:='sum((2*u2-D_n)!/(u2!*(u2-D_n)!),u2=D_n..min(u,n_max-1))';

and then relating one to the other:

N:='sum(N_unr-piecewise(u<D_n,0,N2),u=0..n_P-2)';

(This is counting paths in a specific kind of random walk). Now if I try

eval(N,{n_0=3,n_P=4,n_max=4});

I get "undefined". However, when I do the calculations step by step manually (eval N_unr first -> 6 and then for the possible values of u (0,1,2) the piecewise function -> 0,0,1, I get the correct result of 5 paths that do not touch a barrier. Now it would be perfect to get it to work in the aggregated form, as I want to try put non-trivial values and 3dplot the results.

Does anyone notice a mistake? BTW, this is using Maple 10 classic worksheet

Thanks for any help!
Andreas

Please Wait...