2. (Roots of unity revisited: adapted from LM 3.1–24) In Problem 2, Homework 1, we calculated all five roots of

2. (Roots of unity revisited: adapted from LM 3.1–24) In Problem 2, Homework 1, we calculated all five roots of x 5 + 1, but it required a number of lines of code. In this problem, we will do this more compactly for a more general x n + 1. Recall that −1 = e πi = e 3πi = e 5πi = · · · , but, if we take the nth root, we obtain n distinct values e πi/n, e3πi/n, e5πi/n , . . . , due to the periodicity of the complex exponentials; think Euler. (a) Write a script which, given a positive integer n, finds all n roots of x n + 1 at once, using ONE statement. It must also print out all n of these roots neatly using either disp or fprintf in tabular form. A loop may be used for printing results, but is not allowed in the calculation of the roots. (b) Run the script with n = 3, 5, 7, and 1

Leave a Reply

Your email address will not be published. Required fields are marked *