Question: Recurrence. Consider the following 3 - term recurrence: T 0 ( x ) = 1 , T 1 ( x ) = x T n

Recurrence. Consider the following 3-term recurrence:
T0(x)=1,
T1(x)=x
Tn(x)=2xTn-1(x)-Tn-2(x) for n>1
This recurrence is valid for any x, but defines a special set of polynomials when xin[-1,1].
Create a Matlab (or python) function that computes Tn(x) iteratively with the recurrence, taking n and x as inputs. (Hint: modify f i b o n a c c i _ d i r e c t 2. m)
fibonacci_recursive2.m Generate Fibonacci number using faster recursion
function F= fibonacci_recursive2(n)
if n==0
F=0;
elseif n==1
F=1;
elseif n==2
F=1;
else
if mod(n,2)
F= fibonacci_recursive 2(n-12)???2+ fibonacci_recursive 2(n+12)???2;
else
F= fibonacci_recursive 2(n2+1)???2-fibonaccirecursive2(n2-1)???2;
end
end
 Recurrence. Consider the following 3-term recurrence: T0(x)=1, T1(x)=x Tn(x)=2xTn-1(x)-Tn-2(x) for n>1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!