Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2: The purpose of this question is to calculate the three cubic roots of a complex number. A complex number is of the form

image text in transcribed
image text in transcribed
Question 2: The purpose of this question is to calculate the three cubic roots of a complex number. A complex number is of the form a+ib where i is 1. The magnitude r of a complex number is a2+b2. The complex number a+ib can be written as r(cos+isin). Therefore a=rcos and b=rsin and b/a=(rsin)/(rcos)=tan. =arctan(b/a) The 3 cubic roots of a complex number are computed using the following expression: 31[cos(32k+)+isin(32k+]] There is one root for k=0, a second root for k=1 and a third root for k=2. In addition to finding the cubic roots of a complex number the program must calculate and display the value of the cube of each of the roots to verify that each root is correct. Use input to read in the values for a,b. The type of a and b must be float. The value entered for a must not be zero as that will cause a divide by zero error. When displaying the output be sure to use the correct format codes. See the next page for sample input to and output from the program. Your input and output should match the sample as closely as possible. If a=5. and b=2., then the output from the program should be: Enter the real part of the complex number: 5 . Enter the imaginary part of the complex number: 2 . The complex number is (5+2j) root1=(1.7387225818854102+0.22172191801348856j)root3=(5+2j)root2=(1.0613781045181963+1.3949169676396901j)root3=(5.600000000000001+1.999999999999995j)root3=(0.67734447736721431.616638885053178j)root3=(5.000000000000003+1.9999999999999933j) Programmed by Stew Dent. Date: Sun Jan 29 11:16:12 2023 End of processing. If a=6.75, and b=4.37, then the output from the program should be: Enter the real part of the complex number: 6.75 Enter the imaginary part of the complex number: 4.37 The complex number is (6.75+4.37j) root1=(1.9667904755636736+0.3813473662151226j)root13=(6.750000000000001+4.37j)root2=(1.3136517445904201+1.5126168326518574j)root3=(6.7500000000000036+4.369999999999995j)root=(0.65313873097325381.8939641988669795j)rot3=(6.750000000000007+4.369999999999992j) Programmed by Stew Dent. Date: Sun Jan 29 11:19:21 2023 End of processing. Test the program with the values given above and hand in the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

=+is irrational.

Answered: 1 week ago

Question

2. How should this be dealt with by the organisation?

Answered: 1 week ago

Question

explain what is meant by the term fair dismissal

Answered: 1 week ago