Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

2. Perhaps you remember learning at some point that is an approximation for , which Is an irrational mber. In fact, mber theory, there is

image text in transcribedimage text in transcribedimage text in transcribed

2. Perhaps you remember learning at some point that is an approximation for , which Is an irrational mber. In fact, mber theory, there is a field of study med Diophant p proximation, which deals with rational approximation of irrational mbers. The Pell numbers are an infinite sequene of integers which correspond to the denominators of the closest rational approximations of V2. The Pell numbers are defined by the following recurrence relation (which looks very similar to the Fibonacci sequence): 0 If n = 0 If n = 1 2P-1 P-2 otherwise Of course, we can use the closed-form solution for the (ancestors(n) useful fact we can use when ting our functions to ensure they are oorect geometric progression to compute nu-ancestors 2n+1-2) but that does n't give us any experience with recursive fundins. However, this a (a) Use this recurrence relation to write a recursive function, pell-num, which takes one pa- rameter, n, and returns the nth Pell number The nerutor for the rational approximation of V2 corresponding to a particular Pell number is half of the corresponding number in the seqence referred to as the companion Pell numbers (or Pell-Lucas numbers). The ompanion Pe numbers are defined by the recurrence relation nE 2Qn-1Qn-2 otherwise (b) Use this recurrence relation to write a function, named comp-pell-num, which returns the nth companion Pell number (c) Finally write a function that uses the Pell number and companion Pel mber functions to compute the nth approximation for v2. Use your new fuction to oompute the approx- imation for V2 for the sixth Pell and companion Pell numbers 2. Perhaps you remember learning at some point that is an approximation for , which Is an irrational mber. In fact, mber theory, there is a field of study med Diophant p proximation, which deals with rational approximation of irrational mbers. The Pell numbers are an infinite sequene of integers which correspond to the denominators of the closest rational approximations of V2. The Pell numbers are defined by the following recurrence relation (which looks very similar to the Fibonacci sequence): 0 If n = 0 If n = 1 2P-1 P-2 otherwise Of course, we can use the closed-form solution for the (ancestors(n) useful fact we can use when ting our functions to ensure they are oorect geometric progression to compute nu-ancestors 2n+1-2) but that does n't give us any experience with recursive fundins. However, this a (a) Use this recurrence relation to write a recursive function, pell-num, which takes one pa- rameter, n, and returns the nth Pell number The nerutor for the rational approximation of V2 corresponding to a particular Pell number is half of the corresponding number in the seqence referred to as the companion Pell numbers (or Pell-Lucas numbers). The ompanion Pe numbers are defined by the recurrence relation nE 2Qn-1Qn-2 otherwise (b) Use this recurrence relation to write a function, named comp-pell-num, which returns the nth companion Pell number (c) Finally write a function that uses the Pell number and companion Pel mber functions to compute the nth approximation for v2. Use your new fuction to oompute the approx- imation for V2 for the sixth Pell and companion Pell numbers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions