Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE USE MATHLAB .m 8. Pascal's triangle is an arrangement of numbers such that each row is equivalent to the coefficients of the binomial expansion
PLEASE USE MATHLAB
.m 8. Pascal's triangle is an arrangement of numbers such that each row is equivalent to the coefficients of the binomial expansion of (x + y)(p-1), where p is some positive integer more than or equal to 1. For example, (x + y)2 = 1x2 + 2xy + 1y2 so the third row of Pascal's triangle is 1 2 1. Let Rm represent the m-th row of Pascal's triangle, and Rm(n) be the n-th element of the row. By definition, Rm has m elements, and Rm (1) = Rm (n) = 1. The remaining elements are computed by the following recursive relationship: Rm (i) = Rm-1(i 1)+Rm-1(i) for i = 2, ..., m - 1. The first few rows of Pascal's triangle are depicted in the following figure. You may assume that m is a strictly positive integer. The output variable, row, must be a row vector. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 Write a function with header [row] = myPascalRow (m) where row is the m-th row of the Pascal triangle. You may assume that m is a strictly positive integer. Test Cases: >> R = myPascal Row (1) R = 1 >> R = myPascalRow (2) R = 1 1 >> R = myPascal Row (3) R = 1 2 1 N
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started