478 Reputation

12 Badges

7 years, 55 days

MaplePrimes Activity

These are questions asked by Pascal4QM


From a previous calculation, I got the following nested sum:

Sum(Sum(f[n]*g[q-n]*exp(2*i*Pi*q*x),q = -infinity .. infinity),n = -infinity ..


However, to keep on the calculus, It is more convenient to have:

Sum(Sum(f[n]*g[q - n]*exp(2*i*Pi*q*x), n = -infinity .. infinity), q = -infinity .. infinity)


That is, permute the summation precedence.

Is there a way to automatically transform the first expression into the second one?

I would like to implement a persistent variable inside a procedure. That is:

  1. A variable that is first initialized if it does not exist.
  2. Its value is kept over multiple call of the procedure where it is defined.

As an example, the following procedure counts the number of times it is called:

CountProc := proc () 
     global m; 
     if `not`(m::integer) then      
          m := 0;
     end if; 
     m := m+1; 
     return m;
end proc;

CountProc(); CountProc(); CountProc();

That’s almost what I need, except the variable "m" should be local instead of global. How to do that?

Using a Maple procedure is a very common task. For instance, here, F is a differential operator applied to any expression f

F := proc (f) options operator, arrow; x*(diff(f, y))-y*(diff(f, x)) end proc;
                            / d   \     / d   \
                F := f -> x |--- f| - y |--- f|
                            \ dy  /     \ dx  /
                    2             2         
                   x  cos(x y) - y  cos(x y)

It is also possible to index a procedure. There is an appropriate syntax. At the end, one should not forget to assign the procedure to a table. Here, F simply returns its indices.

`index/F` := proc (idx) return idx end proc;
F := table(F);
                       F := TABLE(F, [])
F[i, j, k, 1, 2, 3];
                       [i, j, k, 1, 2, 3]

My question is how to define a procedure that uses both indexed and non-indexed arguments? That is, a procedure that returns a result according inputs of the type:

F[i, j, k,...](x, y, z,...)

I need such a syntax to define a differential operator (like the first example) that is further defined as a tensor within the Physics package (Physics:-Define). This differential operator thus needs to be indexed.



I have reinstalled Maple 2016 on a new computer, the installation is fine. However, with time, on the old computer, I made several adjustments in the Tools->Options menu, I have added tasks, selected some palettes, removed some others, etc... Is there a way to transport those settings all at once, without performing all that again?


1 2 Page 2 of 2