Re: [Please Help] How to get coefficient list from a
- To: mathgroup at smc.vnet.net
- Subject: [mg114487] Re: [Please Help] How to get coefficient list from a
- From: =?tis-620?b?zdTKw+zD0aqq7CCiqMPD2OinyA==?= at smc.vnet.net
- Date: Sun, 5 Dec 2010 21:54:51 -0500 (EST)
Thank you very much Bob. I am very appreciate for all of your answer. Bob Hanlon <hanlonr at cox.net> wrote: > > n == 4; > > u1 == Normal[ > Series[u[Ca[t], T[t]] - u[3.2066, 317.5529], {Ca[t], 3.2066, > n}, {T[t], 317.5529, n}]] // Simplify; > > d == {}; > > q[0] == {}; > > For[k == 1, k <== n - 1, k++, > For[i == 0, i <== k, i++, > p[i, k - i] == (i!*(k - i)!)* > SeriesCoefficient[u1, {Ca[t], 3.2066, i}, {T[t], 317.5529, k - i}]; > q[k] == Append[q[k - 1], p[i, k - i]]; > d == Union[Join[d, q[k]]];]] > > d == d /. 1. -> 1 > > {Derivative[0, 1][u][3.2066, 317.5529], > Derivative[0, 2][u][3.2066, 317.5529], > Derivative[0, 3][u][3.2066, 317.5529], > Derivative[1, 0][u][3.2066, 317.5529], > Derivative[1, 1][u][3.2066, 317.5529], > Derivative[1, 2][u][3.2066, 317.5529], > Derivative[2, 0][u][3.2066, 317.5529], > Derivative[2, 1][u][3.2066, 317.5529], > Derivative[3, 0][u][3.2066, 317.5529]} > > > d ==== Flatten[ > Table[D[u[x, y], {x, j}, {y, k}], {j, 0, n - 1}, {k, 1 - Sign[j], > n - j - 1}], 1] /. {x -> 3.2066, y -> 317.5529} > > True > > > Bob Hanlon > >" <kajornrungsilp.i at gmail.com> wrote: > > ========================== > From previous equation, I want to know if i want to change the value in > p[i,k-i] into sets of coefficient. How to do that? > Any hint is greatly appreciated. > > kajornrungsilp.i at gmail.com> wrote: > > > Thank you for all of your answer. I very appreciate you. but i have some > > question that i confuse in my code. > > My code is > > n == 4; > > u1 == Normal[ > > Series[u[Ca[t], T[t]] - u[3.2066, 317.5529], {Ca[t], 3.2066, > > n}, {T[t], 317.5529, n}]] > > d == {}; > > q[0] == {}; > > For[k == 1 , k <== n - 1, k++, > > For[i == 0 , i <== k , i++, > > p[i, k - i] == (i!*(k - i)!)* > > SeriesCoefficient[u1, {Ca[t], 3.2066, i}, {T[t], 317.5529, k - i}]; > > q[k] == Union[q[k - 1], p[i, k - i]]; > > d==Union [d,q[k]]; > > ]]d > > I want to know,why it doesn't collect the coefficient of my equation? > what > > is something wrong in my code? > > > > Best Regard. > > > > =E0=C1=D7=E8=CD 4 =B8=D1=B9=C7=D2=A4=C1 2553, 7:10, Bob Hanlon <hanlonr= @cox.net> =E0=A2=D5=C2=B9=C7=E8=D2: > > > > A simpler form: > >> > >> expr1 == a1 + a2*x + a3*y + a4*x^2 + a5*x*y + a6*y^2; > >> > >> myCoef[expr_, var_List] :== > >> SortBy[List @@ expr1, Total[Exponent[#, var]] &] /. Thread[var -> 1] > >> > >> myCoef[expr1, {x, y}] > >> > >> {a1, a2, a3, a4, a5, a6} > >> > >> > >> Bob Hanlon > >> > >> ---- Bob Hanlon <hanlonr at cox.net> wrote: > >> > >> ========================== > >> > >> expr1 == a1 + a2*x + a3*y + a4*x^2 + a5*x*y + a6*y^2; > >> > >> Since you apparently want to ignore zero coefficients then this extrac= ts > >> the non-zero coefficients > >> > >> (List @@ expr1) /. {x -> 1, y -> 1} > >> > >> {a1, a2, a4, a3, a5, a6} > >> > >> However, this standard ordering is different from yours. Presumably, > your > >> ordering is > >> > >> myCoef[expr_, var_List] :== Module[ > >> {coef == (List @@ expr) /. Thread[var -> 1]}, > >> Last /@ Sort[ > >> Cases[List @@ expr, > >> a_?(MemberQ[coef, #] &)*z_. -> > >> {Total[Exponent[z, var]], a}]]]; > >> > >> myCoef[expr1, {x, y}] > >> > >> {a1, a2, a3, a4, a5, a6} > >> > >> > >> Bob Hanlon > >> > >> ---- "=CD=D4=CA=C3=EC=C3=D1=AA=AA=EC =A2=A8=C3=C3=D8=E8=A7=C8=D4=C5=BB= =EC" <kajornrungsilp.i at gmail.com> wrote: > >> > >> ========================== > >> Thank you for your answer. But I would like only the coefficient of > series > >> equation in the form {a1, a2 , a3 ,a4,a5,a6} not to be in the form of > >> {{a1, > >> a3, a6}, {a2, a5, 0}, {a4, 0, 0}}. How to get there? > >> Best regard > >> > >> > >> 2010/12/3 Bob Hanlon <hanlonr at cox.net> > >> > >> > > >> > expr1 == a1 + a2*x + a3*y + a4*x^2 + a5*x*y + a6*y^2; > >> > > >> > coef == CoefficientList[expr, {x, y}] > >> > > >> > {{a1, a3, a6}, {a2, a5, 0}, {a4, 0, 0}} > >> > > >> > From example in documentation on CoefficientList > >> > > >> > expr2 == Fold[FromDigits[Reverse[#1], #2] &, coef, {x, y}] > >> > > >> > a1 + a2 x + a4 x^2 + (a3 + a5 x) y + a6 y^2 > >> > > >> > expr1 ==== expr2 // Simplify > >> > > >> > True > >> > > >> > > >> > Bob Hanlon > >> > > >> > ---- Autt <kajornrungsilp.i at gmail.com> wrote: > >> > > >> > ========================== > >> > Greeting, > >> > I've a list issued from multivariate series like : K=={a1+a2*x +a3*= y > >> > +a4*x^2*+a5*x*y +a6*y^2 } > >> > I need to have {a1, a2 , a3 ,a4,a5,a6} > >> > > >> > How to do that please? > >> > e.g. > >> > n == 3 > >> > u == Normal[Series[x^4 + y^4 + x^2, {x, 5, n}, {y, 5, n}]] > >> > c[0] == {}; > >> > d == {}; > >> > q[0] == {}; > >> > For[k == 1 , k <== n - 1, k++, > >> > For[i == 0 , i <== k , i++, > >> > p[i, k - i] == > >> > SeriesCoefficient[u, {x, 5, i}, {y, 5, k - i}]; > >> > q[k] == Union[{q[k - 1], {p[i, k - i]}}]; > >> > d == Union[d, q[k]]; > >> > > >> > Print[d]; > >> > > >> > Best regard, > >