Patterns from Difference Equations

In this lab we will use simulation to study various patterns in sequences produced by difference equations of the form x(n+1) = f(x(n)) We will look at different types of DE: Linear and Non-linear. For each type of DE you will: 1. Write a script or function that accepts parameters and an initial value, produces 100 iterates of the DE and then plots the result. 2. Run your program many times with different parameters to explore the behavior of the difference equation. 3. Formulate a conclusion saying what ranges of values for the parameters and initial values produce what types of results.ccollins@math.utk.eduI. Constant Linear DE: x(n+1) = ax(n) or x(n+1) = ax(n) + bProgram InfoThe input to your script or function will be a, b, and x(1) [Matlab can only start at 1, not 0] After you produce 100 iterates, plot the results as a series of points (n,x(n)) for n = 1 to 100 (useplot(x,'o')orplot(1:100,x,'o')) Look back at the script from Lab 2 to see how your script might look. If you are still struggling, there is a scriptlindiff.mat the end of this file.Assignment IBy experimenting with a, b and x(1) determine for what parameter ranges you get results that (a) stay bounded or (b) grow out of control (unbounded). When it is bounded, does it tend toward one value? What value?II. Non-constant Linear DE: x(n+1) = a(n)x(n) + b(n)Program InfoSeveral types of DEs in this category are listed below, for each write a script to explore it. Your script or function should perform as described above. (You could/should copy the program you wrote above and modify it as needed).Assignment IIFor each DE below, experiment with the parameters to see when the sequence is (a) bounded and when it is (b) unbounded. When it is bounded, what value does it tend toward? 1. x(n+1) = a(1-1/n)x(n) 2. x(n+1) = a(1+1/n)x(n) 3. x(n+1) = a(1-1/n)x(n) + b 4. x(n+1) = a(1-1/n)x(n) + nIII. Nonlinear DE: x(n+1) = f(x(n))Program InfoSame procedure as above.Assignment IIIFor each non-linear DE below, experiment with the parameter to see when the sequence is (a) bounded and when it is (b) unbounded. When it is bounded, does the sequence tend towards one value? 1. x(n+1) = x(n)^2 + a, use x(1) = 0 2. x(n+1) = a x(n) (1-x(n)), use 0 < a < 4, x(1) = 1/2 3. (Challenge) x(n+1) = a cos(x(n)), use x(1) = 0 4. (Challenge) x(n+1) = a x(n) if 0 < x(n) < 1/2 a(1-x(n)) if 1/2 < x(n) < 1 Try a=2 then try other a < 2IV. (Challenge) Complex-Valued Nonlinear DE: x(n+1) = f(x(n))Program InfoSame as above except now the starting value and the parameters can be complex numbers. MATLAB naturally does complex arithmetic so you don't need to change anything in your program. To input complex numbers you write them as 1+4i, 0.3-0.2i, etc. When MATLAB plots a complex number a+bi it plots it as the point (a,b), thus to see the behavior you should useplot(x)which will draw lines between the points. 'Bounded' in this case means 'stays near the origin (0,0)', 'unbounded' means 'tends away from the origin'.Assignment IV (Challenge)Classify the parameter ranges for bounded/unbounded for each: 1. x(n+1) = x(n)^2 + a, use x(1) = 0, but make a complex 2. x(n+1) = x(n) - abs(x(n)) 3. x(n+1) = a cos(x(n))To Turn In:For each assignement/problem write out what parameter ranges you found for each type of result: bounded, unbounded, etc.

Sample Scriptlindiff.m% script file to simulate the difference equation x(n+1) = a x(n) + b a = input('Enter the value for a:'); b = input('Enter the value for b:'); x(1) = input('Enter the initial value (x(1)):'); for n = 1:100 x(n+1) = a*x(n) + b; end plot(x,'o') title(['Difference Equation with a = ',num2str(a),' and b = ',num2str(b)]) % end of script