Question

In: Computer Science

In this question we study the recursively defined functions f, g and h given by the...

In this question we study the recursively defined functions f, g and h given by the following defining equations

f(0) = −1 base case 0,

f(1) = 0 base case 1, and

f(n) = n · f(n − 1) + f(n − 2)^2 recursive case for n ≥ 2.

and

g(0, m, r, k) = m base case 0, and

g(n, m, r, k) = g(n − 1, r,(k + 2)r + m^2 , k + 1) recursive case for n ≥ 1.

and:

h(0, m, r, k) = m base case 0,

h(1, m, r, k) = r base case 1, and

h(n, m, r, k) = (n + k) · h(n − 1, m, r, k) + h(n − 2, m, r, k)^2 recursive case for n ≥ 2.

Note in the following questions computations of the values of recursive functions should be laid out as a sequence of equations, as we have done in the lectures. Each line of that sequence should involve the application of a single defining equation of that function along with any resulting numerical evaluations.

In computations of this kind, an expansion step (or just a step) is an application of one of the defining equations of a recursive function to a single instance of that function in an expression.

f. Use strong induction to prove that for all n ≥ 1 and all natural numbers m, r and k the equation h(n, m, r, k) = h(n − 1, r,(k + 2)r + m^2 , k + 1) holds.

g. Explain why the result you proved in part 4f implies that the functions h and g are equal.

h. Explain why it is the case that for all natural numbers n we have that f(n) = h(n, −1, 0, 0) = g(n, −1, 0, 0).

i. A software engineer needs to evaluate expressions of the form f(n) in her code but, given the analysis above, she opts to use expressions of the form g(n, −1, 0, 0) instead. Explain why it is OK to do that and why you think this engineer might have made that choice.

Solutions

Expert Solution

Ans:


Related Solutions

In this question we study the recursively defined functions f, g and h given by the...
In this question we study the recursively defined functions f, g and h given by the following defining equations f(0) = −1 base case 0, f(1) = 0 base case 1, and f(n) = n · f(n − 1) + f(n − 2)^2 recursive case for n ≥ 2. and g(0, m, r, k) = m base case 0, and g(n, m, r, k) = g(n − 1, r,(k + 2)r + m^2 , k + 1) recursive case for...
If f and g are both differentiable functions. If h = f g, then h'(2) is: ___________________
  If f and g are both differentiable functions. If h = f g, then h'(2) is: ___________________ Given the function: y=sin(4x)+e^-3x and dx/dt = 3 when x=0. Then dy/dt = ________________ when x=0. Let f(x) = ln (√x). The value of c in the interval (1,e) for which f(x) satisfies the Mean Value Theorem (i.e f'(c)= f(e)-f(1) / e-1 ) is: _________________________ Suppose f(x) is a piecewise function: f(x) = 3x^2 -11x-4, if x ≤ 4 and f(x) =...
For the given functions f and​ g, complete parts​ (a)-(h). For parts​ (a)-(d), also find the...
For the given functions f and​ g, complete parts​ (a)-(h). For parts​ (a)-(d), also find the domain. f left parenthesis x right parenthesis equals StartFraction 7 x plus 9 Over 9 x minus 7 EndFractionf(x)=7x+99x−7​; g left parenthesis x right parenthesis equals StartFraction 9 x Over 9 x minus 7 EndFractiong(x)=9x9x−7​(a) Find ​(fplus+​g)(x). ​(fplus+​g)(x)equals=nothing ​(Simplify your​ answer.)What is the domain of fplus+​g? Select the correct choice below​ and, if​ necessary, fill in the answer box to complete your choice. A.The...
Let f : N → N and g : N → N be the functions defined...
Let f : N → N and g : N → N be the functions defined as ∀k ∈ N f(k) = 2k and g(k) = (k/2 if k is even, (k + 1) /2 if k is odd). (1) Are the functions f and g injective? surjective? bijective? Justify your answers. (2) Give the expressions of the functions g ◦ f and f ◦ g? (3) Are the functions g ◦ f and f ◦ g injective? surjective? bijective?...
Prove the following: Let f and g be real-valued functions defined on (a, infinity). Suppose that...
Prove the following: Let f and g be real-valued functions defined on (a, infinity). Suppose that lim{x to infinity} f(x) = L and lim{x to infinity} g(x) = M, where L and M are real. Then lim{x to infinity} (fg)(x) = LM. You must use the following definition: L is the limit of f, and we write that lim{x to infinity} f(x) = L provided that for each epsilon > 0 there exists a real number N > a such...
Problem 2: Let f and g be two differentiable functions defined on an interval (a,b). Assume...
Problem 2: Let f and g be two differentiable functions defined on an interval (a,b). Assume that g(x) dne 0 for all x ∈ (a, b). Prove that f/g is differentiable and (f/g)'(x) = (f'(x)g(x)-f(x)g'(x))/(g^2(x)) for all x ∈ (a, b)
Let f : X → Y and g : Y → Z be functions. We can...
Let f : X → Y and g : Y → Z be functions. We can define the composition of f and g to be the function g◦ f : X → Z for which the image of each x ∈ X is g(f(x)). That is, plug x into f, then plug theresultinto g (justlikecompositioninalgebraandcalculus). (a) If f and g arebothinjective,must g◦ f beinjective? Explain. (b) If f and g arebothsurjective,must g◦ f besurjective? Explain. (c) Suppose g◦ f isinjective....
For countable set G, H = {f : N → G : f is injective} where...
For countable set G, H = {f : N → G : f is injective} where N is the natural numbers. What is the cardinality of H. Prove it.
Complete the following recursively defined functions. Base case ?(0)=3 Recursive case ?(?) = 3?(? − 1)...
Complete the following recursively defined functions. Base case ?(0)=3 Recursive case ?(?) = 3?(? − 1) + 7 for n ≥ 1. ?(1) = ______ f(2) = _______ f(3) = ______ f(4) = ______ Base case ?(0)=1, ?(1)=2 Recursive case ?(?) = ?(? − 1)?(? − 2) for n ≥ 2. g(2) = ______ g(3) = ______ g(4) = ______ g(5) = ______
Find f(1), f(2), f(3) and f(4) if f(n) is defined recursively by f(0)=4f(0)=4 and for n=0,1,2,…n=0,1,2,…...
Find f(1), f(2), f(3) and f(4) if f(n) is defined recursively by f(0)=4f(0)=4 and for n=0,1,2,…n=0,1,2,… by: (a) f(n+1)=−2f(n) f(1)= f(2)= f(3)= f(4)= (b) f(n+1)=4f(n)+5 f(1)= f(2)= f(3)= f(4)= (b) f(n+1)=f(n)2−4f(n)−2 f(1)= f(2)= f(3)= f(4)=
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT