0
$\begingroup$

I have an expression of this form

$\qquad e^{-x^2b_0+xb_1+b_2}(c_0+c_1x+c_2x^3+c_3x^3+c_4x^4)$

However, it has complicated parameters.

(1/(6 Sqrt[π] (1 + Cos[θ]^2 + 
   s^2 Sin[θ]^2)^7))E^(-((
  p0^2 + 3 q0^2 s^2 + x^2 + 3 s^2 x^2 - 
   8 q0 s^2 x Cos[θ] - (p0^2 - q0^2 s^2 + x^2 - s^2 x^2) Cos[
     2 θ])/(
  2 (1 + Cos[θ]^2 + s^2 Sin[θ]^2)))) Sqrt[s]
  Conjugate[Sqrt[
  s]] (-I p0 + q0 s^2 - (-1 + s^2) x Cos[θ]) (I p0 + 
   q0 s^2 - (-1 + s^2) x Cos[θ]) (9 - 4 p0^2 - 6 s^2 - 
   8 I p0 q0 s^2 - 3 s^4 + 4 q0^2 s^4 + 2 x^2 - 4 s^2 x^2 + 
   2 s^4 x^2 + 
   8 I (-1 + s^2) (p0 + I q0 s^2) x Cos[θ] + (-1 + s^2)^2 (3 + 
      2 x^2) Cos[2 θ]) (9 - 4 p0^2 - 6 s^2 + 8 I p0 q0 s^2 - 
   3 s^4 + 4 q0^2 s^4 + 2 x^2 - 4 s^2 x^2 + 2 s^4 x^2 - 
   8 (-1 + s^2) (I p0 + q0 s^2) x Cos[θ] + (-1 + s^2)^2 (3 + 
      2 x^2) Cos[2 θ]) Sin[θ]^6

What I want to do is just to match the parameters so I can find the values of $c_0,c_1,c_2,c_3,c_4,b_0,b_1,b_2$.

How can I do that automatically?

$\endgroup$
  • $\begingroup$ The expression has the form $de^{ax^2+bx+c}$.Where is the second polynomial? $\endgroup$ – Alex Trounev Feb 25 '19 at 16:28
  • $\begingroup$ I think it is there. $\endgroup$ – user59583 Feb 25 '19 at 17:04
2
$\begingroup$

Perhaps this?

type = Boole[FreeQ[#, Power[E, _]]] &;
alltypes = {0, 1};
{bb, cc} = Times @@@ Reap[
  Sow[#, type@#] & /@ List @@ Factor[expr],  (* expr = OP's expression *)
  alltypes][[2, All, 1]] /. 
    {Power[E, p_] :> CoefficientList[p, x], 
     p_ /; ! FreeQ[p, x] && PolynomialQ[p, x] :> CoefficientList[p, x]} // Simplify
|improve this answer|||||
$\endgroup$
  • $\begingroup$ Seems like working. $\endgroup$ – user59583 Feb 25 '19 at 17:06
1
$\begingroup$

Your expression is of the form a E^b c where a depends only on theta and both b and c are polynomials in x. You can find the list of coefficients by using CoefficientList[b, x] and CoefficientList[c, x]. You can combine a with c and use CoefficientList[a c, x] in that case if you want to.

This is assuming, as you wrote your expression, that you know the different parts, a, b, and c. If you were given the entire expression and had to extract the parts from the combined expression it would be much more complicated, but doable with some fancy Mathematica coding.

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy