(Use R) Suppose x is a vector. Write a code that return the sum of the products of the components of x with their corresponding positions. For example if x = c(2, 5, 7), then it should return 2 * 1 + 5 *2 +7*3 = 33.

Linear Algebra: A Modern Introduction
4th Edition
ISBN:9781285463247
Author:David Poole
Publisher:David Poole
Chapter5: Orthogonality
Section: Chapter Questions
Problem 2RQ
icon
Related questions
Question
(Use R) Suppose x is a vector. Write a code that return the sum of the products of the
components of x with their corresponding positions. For example if x = c(2, 5, 7), then it
should return 2 * 1 + 5 *2 +7*3 = 33.
Transcribed Image Text:(Use R) Suppose x is a vector. Write a code that return the sum of the products of the components of x with their corresponding positions. For example if x = c(2, 5, 7), then it should return 2 * 1 + 5 *2 +7*3 = 33.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Linear Algebra: A Modern Introduction
Linear Algebra: A Modern Introduction
Algebra
ISBN:
9781285463247
Author:
David Poole
Publisher:
Cengage Learning
Algebra & Trigonometry with Analytic Geometry
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage
Algebra and Trigonometry (MindTap Course List)
Algebra and Trigonometry (MindTap Course List)
Algebra
ISBN:
9781305071742
Author:
James Stewart, Lothar Redlin, Saleem Watson
Publisher:
Cengage Learning