0
$\begingroup$

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]))

eqn

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.

$\endgroup$

1 Answer 1

3
$\begingroup$

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:

  • Re: Get the real part of expr
  • ComplexExpand: Simplify, assuming all variables are real. This gets rid of the explicit Re/Im
  • Together: Write everything onto one fraction
  • Numerator: Take the numerator of said fraction. This is equivalent to multiplying both sides of the equations with the denominator: $\frac ab=0\Rightarrow a=b\cdot 0\Rightarrow a=0$
  • Collect: Write the result as a sum of powers of α
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.