% Matlab program to calculate the three cubic roots of a complex
number
% input of a and b
a = input(' Enter the real part of the complex number : ');
while(a == 0) % check if a is 0
a = input(' a cannot be 0. Enter the real part of the complex
number : ');
end
b = input(' Enter the imaginary part of the complex number :
');
% print the complex number
fprintf(' The complex number is (%g+%gj)',a,b);
theta = atan(b/a); % calculate theta
r = a/cos(theta); % calculate r
% calculate the roots
root1 = (r^(1/3))*((cos(theta/3))+(1i*sin(theta/3)));
root2 =
(r^(1/3))*((cos((2*pi+theta)/3))+(1i*sin((2*pi+theta)/3)));
root3 =
(r^(1/3))*((cos((4*pi+theta)/3))+(1i*sin((4*pi+theta)/3)));
% print the output
fprintf(' root1 = %f%+fj',real(root1),imag(root1));
fprintf(' root1^3 = %f%+fj',real(root1^3),imag(root1^3));
fprintf(' root2 = %f%+fj',real(root2),imag(root2));
fprintf(' root2^3 = %f%+fj',real(root2^3),imag(root2^3));
fprintf(' root3 = %f%+fj',real(root3),imag(root3));
fprintf(' root3^3 = %f%+fj ',real(root3^3),imag(root3^3));
%end of program
Output:
The purpose of this question is to calculate the three cubic roots of a complex number....
write a C programming code for the following prompt. please use stucture concept and test if the code works perfectly. Project Description: In this project, you will write a program to calculate the roots of a quadratic equation. Structure concepts will be used in this project. Your program will prompt the user to enter the coefficients of a quadra coefficientsType. Then it will compute the roots of the quadratic equation and store the result in a structure variable of type...
U3 is the notation for the group of 3rd roots of untity— U3={ a complex number z : z^3=1} Problem B. Define a function f: C GL2(R) by the following formula f(a+ib) = () a-b 1 (a) Check that f is a homomorphism. Is f injective? Is f surjective? (b) Verify that f takes the complex unit circle C into the group SO2(R) of rotation matrices (ossin) Prove that the resulting map sin cos f: C SO2(R) is an isomorphism....
A quadratic equation is generally represented as, ax^2 + bx + c The root(s) of the above quadratic equation is computed using the following formula, root1 = (-b + sqrt(D))/ 2a root2 = (-b - sqrt(D))/2a Where D is the discriminant of the quadratic equation and is computed as, D = b^2 - 4ac Given the value of D, the roots of a quadratic equation can be categorized as follows, D > 0 : Two distinct real roots D =...
The following procedure can be used to determine the roots of a cubic equation a_3x^3 + a_2x^2 + a_1x + a_0 = 0: Set: A =a_2/a_3, B = a_1/a_3, and C = a_0/a_3 Calculate: D = Q^3 + R^2 where Q = (3B - A^2)/9 and R = (9AB - 27C - 2A^3)/54. If D > 0, the equation has complex roots. It D = 0, all roots are real and at least two are equal. The roots are given...
C++ Addition of Complex Numbers Background Knowledge A complex number can be written in the format of , where and are real numbers. is the imaginary unit with the property of . is called the real part of the complex number and is called the imaginary part of the complex number. The addition of two complex numbers will generate a new complex number. The addition is done by adding the real parts together (the result's real part) and adding the...
For the complex number given as: z = a + bi / c+di where i = √−1 is the imaginary unit. The parameters are defined as a = √2, b = 0, c = 0.5 and d = −0.5. (a) Find the real and the imaginary parts of z, and then draw the Argand dia- gram. (Hint: Use the conjugate of the denominator.) 2.5 (b) Based on the Argand diagram, find the distance r of the complex number z from...
Al. Practice with complex numbers: Every complex number z can be written in the form z r + iy where r and y are real; we call r the real part of z, written Re z, and likewise y is the imaginary part of z, y - Im z We further define the compler conjugate of z aszT-iy a) Prove the following relations that hold for any complex numbers z, 21 and 22: 2i Re (2122)(Re z) (Re z2) -...
1(a) Find the square roots of the complex number z -3 + j4, expressing your answer in the form a + jb. Hence find the roots for the quadratic equation: x2-x(1- 0 giving your answer in the form p+ q where p is a real number and q is a complex number. I7 marks] (b) Express: 3 + in the form ω-reje (r> 0, 0 which o is real and positive. θ < 2π). Hence find the smallest value of...
#6 Write a Matlab program that finds numerically all the roots (or the zeros) of the algebraic equation below in the interval 1.0 <=x<=3.0: sqrt(log(x^2+1))=x^2*sin(e^x)+2 Part a) Prompt the user to enter a positive integer number n, defined the range 2<=n<=15, and then verify if the number entered lies within the specifications. Your program must allow the user to reenter the number without the need to rerun the program. Part b) Create a user-defined function for the bisection method(see details...