Question:How to find coefficients of a complex expressions?

Question:How to find coefficients of a complex expressions?

Maple 16

ans:=6 *a[0]+2 *k^2 *b[1]*x^2 *y+k^2 *b[1] *y *lambda+6* k^2 *b[2]* x^3 *y-c *b[1] *x* y-2* c* b[2] *x^2 *y-c *b[2] *y *lambda+(6 *b[2]^2 *x^4 *lambda)/(lambda^2 *sigma+mu^2)+(6 *b[2]^2 *x^2 *lambda^2)/(lambda^2 *sigma+mu^2)+(6 *b[1]^2 *lambda* x^2)/(lambda^2 *sigma+mu^2)-12 *a[0] *b[2] *x *y-12* (a[1] . x)* b[2] *x* y-12* (a[2] . (x^2)) *b[2] *x* y+(6 *b[1]^2 *lambda^2)/(lambda^2 *sigma+mu^2)+k^2 *(a[1] . (-2 *x* (mu* y-x^2-lambda)-mu *x* y))+2 *k^2* (a[2] . ((mu* y-x^2-lambda)^2+x* (-2 *x (mu* y-x^2-lambda)-mu *x* y)))+c (a[1] . (mu *y-x^2-lambda))+2 *c (a[2] . (x *(mu *y-x^2-lambda)))+5* k^2 *b[2] *x *y *lambda-(c *b[2] *lambda^2 *mu)/(lambda^2 *sigma+mu^2)+(12 *b[1] *lambda *b[2] *x^3)/(lambda^2 *sigma+mu^2)+(12 *b[1] *lambda^2 *b[2] *x)/(lambda^2 *sigma+mu^2)-(12 *b[1]^2 *lambda *mu* y)/(lambda^2 *sigma+mu^2)+(k^2 *b[1] *lambda^2 *mu)/(lambda^2* sigma+mu^2)-12 *a[0] *b[1] *y-12* (a[1] . x) *b[1] *y-12* (a[2] . (x^2)) b[1] *y-6 *a[0]^2-12 *a[0] *(a[1] . x)-12 *a[0]* (a[2] . (x^2))-6* (a[1] . x)^2-12* (a[1] . x) *(a[2] . (x^2))-6* (a[2] . (x^2))^2-(2 *k^(2)* b[1] *lambda* mu^2 *y)/(lambda^2 *sigma+mu^2)+(k^2 *b[1] *lambda *mu *x^2)/(lambda^2 *sigma+mu^2)+(6* k^2 *b[2] *lambda *mu *x^3)/(lambda^2 *sigma+mu^2)+(6* k^2 *b[2] *lambda^2 *mu *x)/(lambda^2 *sigma+mu^2)+(2* c *b[2] *lambda *mu^2* y)/(lambda^2 *sigma+mu^2)-(c *b[2] *lambda* mu* x^2)/(lambda^2 *sigma+mu^2)-(12 *b[2]^2 *x^2 *lambda* mu* y)/(lambda^2 *sigma+mu^2)-(12* k^2 *b[2] *lambda* mu^2 *x *y)/(lambda^2 *sigma+mu^2)-(24 *b[1] *lambda *b[2] *x *mu* y)/(lambda^2 *sigma+mu^2)+6* (a[1] . x)+6* (a[2] . (x^2))+6 *b[2] *x *y+6 *b[1] *y;

P1 := coeff(coeff(ans, x, 4), y, 0);

Error, unable to compute coeff

Sometime, answer is coming sometine not.

2. Also, if one wants to substitute the value of x^2=t^2+5, in x^3 then why it is giving the ans.

Thank you very much!

﻿