Question: a. Do the following problems using R Let h(x, n) = 1 + x + x + ... +xn = calculate h(x, n) using
a. Do the following problems using R Let h(x, n) = 1 + x + x + ... +xn = calculate h(x, n) using a for loop. b. Now turn the program into a function that takes two arguments, x and n, and returns h(x, n). Find h(0.5, 5) using your function. Make sure you deal with the case x = 1. c. Suppose we represent Pascal's triangle as a list, where item n is row n of the triangle. For example, Pascal's triangle to depth four would be given by list(c(1), c(1, 1), c(1, 2, 1), c(1, 3, 3, 1)) The n-th row can be obtained from row n - 1 by adding all adjacent pairs of numbers, then prefixing and suffixing a 1. Write a function that, given Pascal's triangle to depth n, returns Pascal's triangle to depth n + 1. (9) for i= 0, 1, 10 Verify that the eleventh row gives the binomial coefficients d. For an m x n matrix A, we define a matrix 1-norm as follows: ||A||1= = max 1jn . Write an R program to A = m laijl. i=1 Make your own R function that returns the matrix 1-norm of a matrix. Test your code using the following matrix, 1 2 -5 7 0 -2, -2 -10 3 ...
Step by Step Solution
There are 3 Steps involved in it
The image youve shared contains problems that ... View full answer
Get step-by-step solutions from verified subject matter experts
