Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: extract coefficients

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101087] Re: extract coefficients
  • From: "Rolf.Mertig at gmail.com" <Rolf.Mertig at gmail.com>
  • Date: Wed, 24 Jun 2009 06:27:59 -0400 (EDT)
  • References: <h1hbcs$en$1@smc.vnet.net>

On Jun 20, 2:44 am, Galina <Galina.Pil... at gmail.com> wrote:
> Hello all,
>
> I have an expression that is nonlinear with respect to variables q
> [i].
> I need to transform it into equation with respect to unknown q[].
> Multipliers near each of such combination of q[] are functions that
> must be extracted for integration. I'm having problem with Coefficient
> [] because it does not allow extract multipliers near q[i] of just 1-
> order,  combination of the type  q[i]q[j] or near  q[i]q[j]q[k]
> Please, help
>
> Below there is an example of the expression. I need to transform it
> into equation with respect to unknown q[1], q[4] and q[7].
> w1,v1,u1 are functions of polynomial type that must be integrated
> numerically to perform a coefficients at q[].
> Everything else is numbers in reality.
>
> -((EE*h*q[7]*w1[x, y]*Derivative[0, 1][v1][x, y])/(b*R*(-1 + \[Nu]
> ^2))) - (EE*h*\[Nu]*q[4]*w1[x, y]*Derivative[1, 0][u1][x, y])/(b*R*(-1
> + \[Nu]^2)) -
>   (3*q[1]^2*(EE*h*w1[x, y]*Derivative[0, 1][w1][x, y]^2 + EE*h*\[Nu]*w1
> [x, y]*Derivative[1, 0][w1][x, y]^2))/(2*b^2*R*(-1 + \[Nu]^2)) +
>   (q[1]^3*((-EE)*h*Derivative[0, 1][w1][x, y]^4 - 2*EE*h*Derivative[0,
> 1][w1][x, y]^2*Derivative[1, 0][w1][x, y]^2 - EE*h*Derivative[1, 0][w1]
> [x, y]^4))/
>    (2*b^4*(-1 + \[Nu]^2)) + q[1]*((q[7]*((-EE)*h*Derivative[0, 1][v1]
> [x, y]*Derivative[0, 1][w1][x, y]^2 - EE*h*Derivative[0, 1][w1][x, y]
> *Derivative[1, 0][v1][x, y]*
>         Derivative[1, 0][w1][x, y] + EE*h*\[Nu]*Derivative[0, 1][=
w1]
> [x, y]*Derivative[1, 0][v1][x, y]*Derivative[1, 0][w1][x, y] -
>        EE*h*\[Nu]*Derivative[0, 1][v1][x, y]*Derivative[1, 0][w1]=
[x, y]
> ^2))/(b^3*(-1 + \[Nu]^2)) +
>     (q[4]*((-EE)*h*\[Nu]*Derivative[0, 1][w1][x, y]^2*Derivative[1, 0=
]
> [u1][x, y] - EE*h*Derivative[0, 1][u1][x, y]*Derivative[0, 1][w1][x, y]
> *Derivative[1, 0][w1][x, y] +
>        EE*h*\[Nu]*Derivative[0, 1][u1][x, y]*Derivative[0, 1][w1]=
[x, y]
> *Derivative[1, 0][w1][x, y] - EE*h*Derivative[1, 0][u1][x, y]
> *Derivative[1, 0][w1][x, y]^2))/
>      (b^3*(-1 + \[Nu]^2)) + (-12*b^4*EE*h*w1[x, y]^2 -
> EE*h^3*R^2*Derivative[0, 2][w1][x, y]^2 - 2*EE*h^3*R^2*Derivative[1, 1]
> [w1][x, y]^2 +
>       2*EE*h^3*R^2*\[Nu]*Derivative[1, 1][w1][x, y]^2 - 2*EE*h^3*R^=
2*\
> [Nu]*Derivative[0, 2][w1][x, y]*Derivative[2, 0][w1][x, y] -
> EE*h^3*R^2*Derivative[2, 0][w1][x, y]^2)/
>      (12*b^4*R^2*(-1 + \[Nu]^2)))
>
> Thanks you

Hello Galina,
suppose expr is your expression, then you can get it collected like
this:

col = Collect[expr, {q[_], q[a_]*q[b_],q[a_]*q[b_]*q[c_]}, mycoeff
[Factor[#1]] & ];

(*This will extract a list of the q's : *)
qs = List @@ col /. mycoeff[_] -> 1;

(* And this the correspondiong coefficients: *)
cf = Cases[List @@ col, _mycoeff, -1] /. mycoeff -> Identity;

(* this gives 0, as it should *)
Expand[qs . cf - tmp2 /. mycoeff -> Identity]

Regards,

Rolf Mertig
GluonVision GmbH, Berlin, Germany
http://www.gluonvision.com



  • Prev by Date: Re: Re: Putting an If in my function
  • Next by Date: Re: laptop recommendation to run mathematica fast?
  • Previous by thread: extract coefficients
  • Next by thread: Slow performance gathering property data from fitted objects