Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Jupyter Python please Give your answers to the questions as comments in your code. You do not need to define any functions in your
In Jupyter Python please
Give your answers to the questions as comments in your code. You do not need to define any functions in your program. It can simply contain two loops one for part (a) and one for part (b). The 'Golden Mean' is given by =(5+1)/21.61803399. In the following, we are going to work with =1=(51)/2=0.61803399 (a) Using a loop, calculate the nth power of by successive multiplication, and append different powers, one by one, to a list. That is, having the nth power, you multiply it by one more to find the the (n+1) st power: 0=1,n=n1 You should not use any exponentiation, i.e., you should not use the ** operation, rather, every new element of your list should be computed using the previous element, or a variable that holds the previous power of . Create a variable N for the maximum power, you may want to try several different maximum powers later. (b) It turns out that powers of can alternatively be obtained from the following recursion relation: n+1=n1n (This can be shown by reducing equation (7) to a quadratic equation! Try it for yourself.) In another loop, generate a second list that, similar to your first list, contains powers of , but obtained using equation (7). Hint: For example, if this list is called "recursion", you should set the initial conditions such that recursion [0] is equal to 1 and recursion [1] is equal to before the loop starts. (c) Run your script for N=1,2,3, As you increase N, at some point, you can tell that the last element in one of the two lists you created in parts (a) and (b) is definitely wrong! (by simply looking at the results, not by comparing to the actual N ). Which one? How can you tell? Hint: Increase N to about 45 to notice the problem in one of the lists. This is caused by a round-off error due to the limited precision of floats and multiple subtractions, which you will learned about on MondayStep 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