Question: First terms to add ( you will need to sum 1 0 terms ) $$y = 1 / 4 + 3 / 9 + 5

First terms to add (you will need to sum 10 terms)
$$y=1/4+3/9+5/16+\ldots$$
You will need to initialize the variable s, increment the value of s in the body of your for loop, then print the value of s when the loop is finished. Use a variable i for the index of your for loop.Question 1(3 points)
Use a "for" loop to evaluate the following sum, when p=2
s(10)=i=1102i-1(i+1)p
First terms to add (you will need to sum 10 terms)
y=14+39+516+dots
You will need to initialize the variable s, increment the value of s in the body of your for loop, then print the
value of s when the loop is finished. Use a variable i for the index of your for loop.
Question 2(9 points)
2(a)[3 pts]
Write a function that accepts two vectors of equal length and returns
x12+cdots+xn22+y12+cdots+yn22.
Test that your function works correctly by using vectors 1:5 and 2:6.
2(b)[3 pts]
Modify your function from part (a) so it prints an error message and returns NULL if the vectors are not of
the same length. Test that your function works by using vectors 1:5 and 1:6.
2(c)3pts
Modify your function from part (b) so that it returns
x12+cdots+xn22+y12+cdots+yn22
AND
x12+cdots+xn22-y12+cdots+yn22.
Test that your function works correctly by using vectors 1:5 and 2:6.
 First terms to add (you will need to sum 10 terms)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!