a. Do the following problems using R Let h(x, n) = 1 + x + x...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 1≤j≤n ². 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 ... 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 1≤j≤n ². 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 ...
Expert Answer:
Related Book For
Posted Date:
Students also viewed these mathematics questions
-
Solve the following problems using proportions. Viraj's neighbour sold 14.5 hectares of land for $328,000. If Viraj were to sell his 23.25-hect-are parcel at a proportionate price, what amount would...
-
Solve the following problems using proportions. The West EssexSchool Board employs 348 teachers for the 7412 students registered in the district's schools in the current year. The enrolment forecast...
-
Solve the following problems using n P r or n C r : (A) How many 3-digit opening combinations are possible on a combination lock with 6 digits if the digits cannot be repeated? (B) Five tennis...
-
Calculate the following integral approximately by using the Simpson's method: 3.6 f. f(x) dx X 0.0 0.6 1.2 1.8 2.4 3.0 3.6 f(x) 0 0.13 0.05 0.6 0.43 0.74 0.93
-
How do you think the growing use of telecommuters, contingent workers, and virtual teams affect HRM? How can managers improve recruiting and retention of these new kinds of employees?
-
Problem require a graphing calculator or a computer that can calculate the linear regression line for a given data set. Find a linear regression model for the data on average annual precipitation in...
-
ABC, Inc. had the following partial balance sheet and partial annual income statement: The industry average DSO is 30 (based on a 365-day year). ABC plans to change its credit policy so as to cause...
-
Maverick Enterprises is planning new product Annual sales unit costs, and unit revenues are as tabulated; the first cost of R&D and setting up the assembly line is $42,000. If i is 10%, what is the...
-
What are the actions taken by the Sprouts Farmers Market in measuring risk and ethical behavior?
-
Prepare a corpo The first step was for the two owners to form an LLC. The new company initially authorized 500,000 shares at a $1.00 par value per share. 1) In recognition of their development of the...
-
Our use of slang illustrates the dynamic quality of language, as well as how language helps us express our identities. Answer the following questions regarding your use of slang: 1. What are your...
-
Outlined the benefits and challenges to organizations implementing work-life policies. An organization can create policies, but cultural change requires more than just a change in policy. As your...
-
Come up with a programming idea. This can be an educational or social activity. Explain your goal, the steps you would take to plan an inclusive event, what resources would you use, how would you...
-
A number of rapes and car break-ins have taken place in the nearby low-come housing project. You are tasked with conducting a new risk assessment and selecting countermeasures for a suburban college...
-
Reflect on resistance to change in different stakeholder groups, what strategies would you use to address the change with each group. Explain why these strategies are considered best practices?...
-
Forthis assignment,take some time to reflect on the following questions. Consider a learning experience - either recent or further back - that was successful for you.Thinking back to the experience...
-
Find the number of years required for $5,000.00 to grow to at least $10,616.00 when deposited at 3%, compounded semiannually (2 times a year). Don't forget to adjust your answer to time in years!!...
-
The maximum pressure that can be developed for a certain fluid power cylinder is 15.0 MPa. Compute the required diameter for the piston if the cylinder must exert a force of 30 kN.
-
Write a function that takes a reference to a string object as its parameter and that converts the contents of the string to uppercase. Use the toupper() function described in Table 6.4 of Chapter...
-
What will the following program display? #include using namespace std; void other(); namespace n1 { int x = 1; } namespace n2 { int x = 2; } int main() { using namespace n1; cout < < x < < endl; {...
-
What are the differences between a friend function and a member function?
-
The treatment of outflows on account of dividend and interest is highly debatable as to their activity classification. Give a serious thought to the issue and express your opinion about the best...
-
Consider the same setting as Problem 18, but suppose instead 80% of the shareholders redeem their shares, and no warrants are exercised. Data from problem 18 a. What is the amount of cash per share...
-
Reliance Industries Ltd. is the biggest private sector company in India. The following fact sheet about the company and its peer group, as extracted from Capitaline Plus database is reproduced in the...
Study smarter with the SolutionInn App