Question
C# - task 3 A complex number C consists of two parts, one real and one imaginary. It can be written as follows: C =
C# - task 3
A complex number C consists of two parts, one real and one imaginary. It can be written as follows:
C = Cr + j Cj, where Cr and Cj are real numbers and j is the imaginary number ?-1
Here the Cr is the real part and j Cj the imaginary part of the complex number C.
A multiplication between two complex numbers follows common rules for multiplication of two two-element factors (remember that j2 = -1):
A B = (Ar + jAj) (Br + jBj) = (Ar Br - Aj Bj) + j (Ar Bj + Aj Br) = Cr + jCj = C
Define a method that can multiply two complex numbers according to the formula above. Use the void as the function's return data type, the components of the complex numbers A and B as "input" parameters, and the components of the result, the complex number C, as "out" parameters (ie, reference transfer values).
Test the function with a program that presents the calculation and results, as these examples show:
(1 + 2j) * (3 -4j) = 11 + 2j
(20 -10j) * (-2 -4j) = -80-60j
For reasons sake: The order of the factors is indifferent, so that A B = B A.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started