# Collect coefficients from a complex equation

I'm new to wolfram and I was solving an optimization question in wolfram. For that I need to calculate the objective function.

From my calculations I got a equation (with complex numbers) as follows:

0. + 3.35/((23.4256 + (0. + 3.35/\[Alpha])^2) \[Alpha]) +
I (-(4.84/(23.4256 + (0. + 3.35/\[Alpha])^2)) + (
3 \[Pi] \[Alpha]^2)/500 - 108./(
11664. + 3.0976/(\[Alpha] - \[Beta])^2)) + 1.76/((11664. +
3.0976/(\[Alpha] - \[Beta])^2) (\[Alpha] - \[Beta]))


Now I need to collect the real part from the above equation which is easy, but after that I need to equate the real part to zero and rearrange it in the following form

$$A_5 \alpha^5 + A_4 \alpha^4 + A_3 \alpha^3 + A_2 \alpha^2 + A_1 \alpha + A_0 = 0$$

What should I do ? Assuming $\alpha$ and $\beta$ are real numbers.

## 1 Answer

This should work:

Collect[Numerator@Together@ComplexExpand@Re@expr, α] == 0
(* 0.143157 α^3 - 0.0000722876 β - 0.286163 α^2 β + 0.143157 α (0.000770244 + 0.998946 β^2) == 0 *)


where expr` is your expression. What this does: