0
$\begingroup$

For example, if I have a complex number like:

$$\dfrac{a+i\cdot b}{c-i\cdot d}$$

suppose $a, b, c, d\in \mathbb{R}$ and $c^2+d^2\ne 0$,

how can I use mathematica to convert it into the following form with no $i$'s in its denominator:

$$\dfrac{(ac-bd)+i\cdot(ad+bc)}{c^2+d^2}$$

Additionally, if I use many such $a_i+i\cdot b_i$ complex numbers in some expression, how can I convert the expression into the desired form with no $i$'s in its denominator?

e.g.

$$\dfrac{\dfrac{a}{1+i b}-\dfrac{i}{c}+\dfrac{d}{1+i e}}{-\dfrac{i}{a \omega }+a-\dfrac{i}{\alpha }+\dfrac{t}{x+i s \omega }+\dfrac{w}{u+i v}+\dfrac{\beta }{y+i \gamma }-\dfrac{i}{\omega }}$$

The mathematica code:

(a/(1 + I b) + 1/(I c) + d/(1 + I e))/(1/(I \[Alpha]) + 1/( I \[Omega] ) + a + \[Beta]/(y + I \[Gamma]) + 1/(I \[Omega] a) +  t/(x + I \[Omega]  s) + w/(u + I v))

And, if we suppose variables $a, b, c,\cdots$ and so on in an expression, are real matrices not scalars, how to Simplify them and obtain desired simplest form result since the commutative law will not hold for multiplication and how we let Mathematica follow such rules?

$\endgroup$
2
  • 2
    $\begingroup$ ComplexExpand[(a/(1 + I b) + 1/(I c) + d/(1 + I e))/(1/(I α) + 1/(I ω) + a + β/(y + I γ) + 1/(I ω a) + t/(x + I ω s) + w/(u + I v)), TargetFunctions -> {Re, Im}] should work. $\endgroup$ Commented Aug 16, 2017 at 14:25
  • $\begingroup$ Thank you! this is what I need. Do you mind if I accept the current answer or will you create another? $\endgroup$ Commented Aug 16, 2017 at 17:34

1 Answer 1

3
$\begingroup$

For the first part

ClearAll[a, b, c, d]
conv[expr_] := Module[{den = Denominator[expr], num = Numerator[expr]},
  ComplexExpand[num*Conjugate[den]]/(ComplexExpand[den*Conjugate[den]])
  ]

And now

 expr = (a + I b)/(c - I d);
 conv[expr]

Mathematica graphics

"if I use many such ai+i⋅biai+i⋅bi complex numbers in some expression, how can I convert the expression into the desired form with no ii's in its denominator?"

It will help to provide example of input that one can use.

And, if we suppose variables a,b,c,⋯a,b,c,⋯ and so on in an expression, are real matrices not scalars, how to Simplify them and obtain desired simplest form result since the commutative law will not hold for multiplication and how we let Mathematica follow such rules?

I can't follow. May be you should make the above separate question and provide more clear example of input and desired output.

$\endgroup$
1
  • $\begingroup$ thank you. I have updated it with an example. $\endgroup$ Commented Aug 16, 2017 at 10:56

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.