Question: Task #10: See the vector below called inventory. This vector represents both the price and quantity sold of items from a clothing store. The odd
Task #10: See the vector below called inventory. This vector represents both the price and quantity sold of items from a clothing store. The odd indexes, ( 1, 3, 5, ...) represent the quantity sold of a given item - and the value immediatlely to the right is the corresponding price. Create a vector called revenue which will store the sales revenue of each item (quantity sold * price.) Do not manually copy & paste values - instead use vector indexing and element-wise multiplication, .* , to solve this problem. For reference, revenue should have 6 values, and the first value should be 12 (quantity) * 23.25 (price) ==> 279
Task #11: Find the sum of the first 100 elements in the harmonic series: 1 + 1/2 + 1/3 + 1/4 + .... + 1/100 You can use vector element-wise division in a couple of different ways to generate a vector that houses the above series of numbers. You can then use the sum function to add all 100 elements of that vector together. Save this sum to a new variable called sumHS.
Step by Step Solution
There are 3 Steps involved in it
Certainly Lets tackle each task step by step Task 10 Step 1 Given Vector The vector inventory contai... View full answer
Get step-by-step solutions from verified subject matter experts
