Items tagged with collect collect Tagged Items Feed

I am trying separation of variables in Maple. I get an equation that has the form   

And now I want to tell Maple to assign the terms with 1/R in them to one variable, say eq21, and the term with 1/Z to second variable, say eq22 The idea is that I can later more easily work with each separate ode. 

I do not know to separate those apart. I could offcourse copy and paste by hand, but I want to automate this.

I tried match() and patmatch() but I am not seeing the way. Here is the code:

T:=  (r,z)-> Z(z)*R(r);
eq1:= diff(T(r,z),r$2)+1/r*diff(T(r,z),r)+diff(T(r,z),z$2);

#need now way to break the above into 2 different variables.

ps. I know I can do this:

T:=  (r,z)-> Z(z)*R(r);
eq1:= diff(T(r,z),r$2)+1/r*diff(T(r,z),r)+diff(T(r,z),z$2);

But this for me is not the right way to do it. I think there should be more algebraic way.


Hi all,

Command collect can view a expression a as a general polynomial in specific indeterminate x with the calling sequence:

collect(a, x, form, func)

where form and func are optional arguments.


Then, I encountered a form like this:

collect(a, x, normal)


I'm not sure what does normal means in this case and cannot find the related information from Maple Help.

Does anyone know this? I'd appreciate any help on this topic.

Thanks a lot :)

(Sorry to not offer the worksheet file due to a private issue)

Hi ;

I need your help to write the system contains all these equation:

# system 1
# system 2
for j from 1 to N do
u[0, j] := (1/4)*(u[1,j]+u[1,j]+u[0, j-1]+u[0,j+1]-f[0,j]*h^2);
end do;
# System 3
for j from 1 to N do
u[N+1, j] := (1/4)*(u[N, j]+u[N-1,j]+u[N+1, j-1]+u[N+1, j+1]-f[N+1,j]*h^2);
end do;
 eqs := [ seq(seq(Stencil[1](h,i,j,u,f),i=1..N),j=1..N)];

How can collect these system 1 system2, system3 ans system4 in a set with one name.

sys:=[eqs,system3,system2,system2]; ( sys: here contains all the equation).

Thanks you.


Hi, please a Need a help.
I have an error in my code: Error, (in collect) cannot collect 0
Here, is the code:

Many thinks.


I gave this function:

g := -2-k[1](lambda*alpha[2]*k[2]+alpha[1](-2-2*k[2]+k[2]*lambda^2))+k[1](lambda*alpha[2]*k[2]+alpha[1](-2-2*k[2]+k[2]*lambda^2))*lambda(lambda*alpha[2]*k[2]+alpha[1](-2-2*k[2]+k[2]*lambda^2))^2

I would like to factor out or to collect:   (lambda*alpha[2]*k[2]+alpha[1](-2-2*k[2]+k[2]*lambda^2))

I use following command: collect(g, lambda*alpha[2]*k[2]+alpha[1](-2-2*k[2]+k[2]*lambda^2))

Nevertheless, I receive an error ...

Error, (in collect) cannot collect lambda*alpha[2]*k[2]+alpha[1](-2-2*k[2]+k[2]*lambda^2)


Could you help me to solve my issue ? 

What am I doing wrong ? Do I have to use another command for this ?

I would like to thank you in advance.

Best regards,




Say I have an expression like this:


I can factor out x,t and get an expected result:
collect(a0, [x,t]);

But how would I do it if I want to force Maple to act on the argument of exp?


This doesn't work:
collect(a1, [x,t])

This will do what I want for this expression but maybe not in general:

i have a problem in using command "collect".  

how to evaluate to equation (5.9) in page 195 from rodrigues formula?

rodrigues := exp(x)*(x^alpha)/n!*Diff(exp(-x)*(x^(n+alpha)), x$n);
rodrigues := subs(x=2*p, rodrigues);
rodrigues := subs(alpha=1/2, rodrigues);

Hi, this  must have been asked numerous time, but I cannot find it in MaplePrimes:

How does one "collect" sqrt terms? collect(expression,sqrt) does not work because sqrt is actually represented as ^(1/2) in  Maple. collect on '^' does not work either... ??

Mac Dude

Hello everyone,

I like to force following:

a/(a+b) --->  1/(1+b/a)

I know that collect is a powerful tool that is actually capable of doing such things. In a similar (old) thread, it was suggested to use a function in the last part like

collect(expression, varialble, (x->something)@factor)

but I don't understand what exactly this means. Any help?

another related question is, is the collect command available as right-click option?

I have a rather large multivatiate polynomial "Dtest"  I need to divie it by a cubic poly "DGm" using rem and quo. Both are determinants multiplied out,  both given below. Have spent the past 2 nights trying to sort, collect, expand, equate coefficients plex groebner etc. Am trying to collect up all the powers of c3 but cant anything to work. even expand doesn't fully expand "Dtest". If I set c1 and c2 to 1 things are...

I wrote the following MAPLE code

restart; N := 2

alias(epsilon = e, eta = t)

eq1 := 5*(diff(F(t), `$`(t, 3)))+(1+3*e)*F(t)*(diff(F(t), `$`(t, 2)))-(2+e)*(diff(F(t), t))^2 = 0

F := proc (t) options operator, arrow; sum('F[i](t)*e^i', 'i' = 0 .. N) end proc

deqn := simplify(collect(eq1, e), {e^(N+1) = 0})

MAPLE says

Error, (in sum) too many levels of recursion
How do I get this error corrected?


How may I program the following with Maple?


(1) Define the function:

H(p) := p * c1 + p^2 * c2 + p^3 * c3  + ......


(2) Now construct the following expression:


(1-p) [ v''' + 1 ]  = H(p) [ v''' - 25 * v' + 1]

Here, v is some funciton of x.


(3) Now assume: v = u0 + u1 * p + u2 * p^2 + ...

and substitute this into the expression defined at the point (2).

Hi there,

I got an output


and would like to bring it in the form


How do I do that? :)

In fact I don't even manage to collect the factor of 3*beta^2 as follows

Why does collect only work sometimes?

I will show with a simple example.  I can do this

a := 5*x^2-4*x+3;
                             a := 5 x2  - 4 x + 3
h := exp(x)*a+exp(x);

1 2 Page 1 of 2