Question: Q 2 ( a ) : Write a function in RStudio called my _ sum using two for loops to find x = 1 n

Q2(a): Write a function in RStudio called my_sum using two for loops to find x=1ny=1mx2y2|x-2|+y.
For example, my_sum (n=5,m=6)=113.1786284.
Q2(b)*: Write a function in Rstudio called my_sum2 without any loops (for loops, while loops, repeat loops) to do the same task in Q2(a).
Hint: you may define two matrices A and B of suitable dimensions, obtain a new matrix C by performing
vectorized operators on A and B such that the sum of all the elements in C gives you the required sum.
 Q2(a): Write a function in RStudio called my_sum using two for

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!