Question: Please answer using MATLAB A useful feature of user-defined functions is recursion, the ability of a function to call itself. The Catalan numbers C_n are

Please answer using MATLAB A useful feature of user-defined functions is recursion,Please answer using MATLAB

A useful feature of user-defined functions is recursion, the ability of a function to call itself. The Catalan numbers C_n are a sequence of integers 1, 1, 2, 5, 14, 42, 132..., that play an important role in quantum mechanics and the theory of disordered systems. (They were central to Eugene Wigner's proof of the so-called semicircle law.) They can be defined as follows: C_n = {1 if n = 0, 4n - 2 + 1 C_n - 1 if n > 0. Write a function, using recursion that calculates C_n. Use your function to calculate and print C_100. Euclid showed that the greatest common divisor g(m, n) of two nonnegative integers m and n satisfies: g(m, n) = {m if n = 0, g(n, m mod n) if n > 0. Write a function g(m, n) that employs recursion to calculate the greatest common divisor of m and n using this formula. Use your function to calculate and print the greatest common divisor of 108 and 192

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!