Question: Write a function file named SUBTRACTION _ FUN that uses nested loops that will perform the following calculation until the value of y is less

Write a function file named SUBTRACTION_FUN that uses nested loops that will perform the following calculation until the value of y is less than or equal to zero. This process will be completed multiple times, each time with a new value of x.
y=y-(x^2-2x+4)
The initial value of y will always be 3750. The loop should also keep track of the number of iterations while performing the above calculation. Once the value of y is less than or equal to zero, the final value of y and the total number of iterations should each be stored in their own vectors. These two vectors should be the outputs to your function.
The values of x that will be tested should the input to your function. Your outer loop should cycle through these values.
[5 pts] Test your function from part a with the following values of x:
x =[1,2,3,4,5,6,7];

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!