Using Sage math:
https://www.sagemath.org/
I am using: the online copy CoCalc Instant SageWorksheet
or: SageMathCell
MCS 320 Project 4 due Wednesday, March 17, 2021 at 5 PM Spring 2021 The content of this project is NOT in the public domain! Do not post any content of this project to any website or make it public in any other form. By enrolling in this course you agree to honor this request. MCS 320 Project 4 Problem 1: For a matrix M with integer values a, b, c, d, M = [ a b c d ] (1) the determinant is det(M) = ad − bc. A matrix, whose determinant is equal to ±1, is called a uni- modular matrix. Consider a polynomial function f in two variables x and y, ie. f(x, y) and an associated vector t = (a, b). The vector t can be used to change the coordinates of the polynomial function f , based on a matrix M, whose first row consists of the vector t and whose determinant is equal to ±1, ie. det(M) = ±1 (either is equally valid). The values c, d must be determined to ensure that that det(M) = ±1. The unimodular change of coordinates is performed in the following way. Once c, d have been determined such that det(M) = ±1, the old coordinates x, y are changed to new coordinates X,Y in the following way. x = XaY c (2) y = XbY d (3) Finally, with the new coordinates, the polynomial function f(x, y) becomes a rational expression f(X,Y ). Write a function F, which on input takes a polynomial f as a symbolic expression in variables x and y, and a list of values t = [a,b] (ie. F(f(x,y), [a,b]))and returns a rational expression f(X,Y ) as illustrated above. As part of your solution to this problem, include the answers for • F(xy3 + x7y5 + x2y7 + x5y5 + x + y + 1, [2,3]) • F(x14y17 + x8y9 + x5y6 + x2y3 + x2 + y2, [-4, 3]) Problem 2: Given a sequence of integers, it is in general difficult to find a recurrence relation or a closed form that generates such a sequence. This problem is a lot easier when sequences are generated by a linear recurrence. To make this problem easier to understand and to implement, assume that a sequence of integers a0, a1, a2, . . . , an is generated by a recurrence relation Fn = K1Fn−1 +K2Fn−2, where K1, K2 and n ≥ 3 are integers. Write a Sage function F, which is takes on input a list L of integers, ie. F(L), and returns a symbolic expression of a closed form solution f(n), which can generate each element in the list L, such that f(0) is the first element in L, f(1) is the second element in the list L, and so on. As an illustration, for L = [1, 4, 11, 34, 101, 304, 911, 2734, 8201, 24604, ...], function F(L) returns f(n) = −14 (−1) n + 543 n. As part of your solution to this problem, include the answers for • F(L), where L = [1, 2, 175, -676, 36781, -347098, 8960635, ...] • F(L), where L = [1, 3, 9, 27, 81, 243, 729, 2187, 6561, ...] UIC, Department of Mathematics, Statistics and Computer Science page 1 MCS 320 Project 4 due Wednesday, March 17, 2021 at 5 PM Spring 2021 Problem 3. For a polynomial p(x), of degree n, there are n complex roots of the form z = a+ bi, where a and b are real numbers and i is the imaginary unit i = √ −1. Write a function F, which takes on input a polynomial as symbolic expression and 1. finds all roots of the polynomial p(x) 2. computes the average of all such roots, denoted here as z̄ = ā + b̄i 3. stores the average in a list L 4. computes the derivative p’(x) of polynomial p(x) 5. sets p(x) = p’(x) and and repeat steps 1) 2) 3) 4) as long as p 6= constant 6. when p(x) is constant, then • extracts all real values ā and store them in a list X • extracts all real values b̄ and store them in a list Y • using linear least squares fit (you cannot use numpy package), the function F returns the linear polynomial f(X), which best approximates the values X and Y , i.e. such that f(X) ≈ Y As part of your solution to this problem, include the answers for • F(2x10 + 3x9 − 19x8 − 11x7 + x6 − x5 + 4x4 − 22x3 + x2 − x + 29) • F(x20 + x19 − 4x17 + 8x16 − 7x5 +−x3 + 50x2 − 70x− 100) Project Guidelines, Submission Details, and Plagiarism Warning This project is due on Wednesday, March 17, 2021 at 5 PM. No late submissions will be accepted and no extensions will be given! Your solution to this project must consist of a single, computer typed (not hand-written), PDF docu- ment, called project4.pdf, containing the Sage code and the answers for the three problems. For each problem, write a Sage function with the appropriate input arguments. Upload the file project4.pdf through Blackboard. We must be able to copy and paste your code in order to evaluate it! This project must be solved individually. Under no circumstances are you allowed to copy or to col- laborate with anyone else. All submitted files will be automatically checked for plagiarism. Regardless of who copied from whom, all caught in the act of plagiarism will be penalized. In particular, using internet resources of any kind is not allowed. Internet sites are routinely checked for similarity to your submission, both for code content and code logic. Changing code order or variable names will not prevent plagiarism detection. In addition, do not post any content of this project to any internet sites or make it public in any other form. The content of this project is not in the public domain! You are free, however, to use our course resources, such as lecture notes, text books, and official Sage documentation during the solving of this project. If you have questions about this project, come to my online office hours using the usual Blackboard link. UIC, Department of Mathematics, Statistics and Computer Science page 2