Assignment 2 - Coding Problems: Due Friday 2/10 / MATLAB
Assignment 2 - Coding Problems: Due Friday 2/10/. Matlab. Complete
Assignment 2 - Coding Problems: Due Friday 2/10/. Matlab. Complete the quadratic equation solver yournameQuadEqn.m. See the comments at the top for specific directions, but the main idea is to avoid loss of significance by re-writing one of roots. The formula for the root r1 has potential loss of significance when b > 0 and b2 > 4ac; the second root r2 is best left as is. The formula for the root r2 has potential loss of significance when b 2 > 4ac. The first r1 is best left as is.
Write a C program for estimating adding numbers in a 2D grid. See the file yournameGridSum.c to get started. This program will exhibit the effect of cumulative rounding error caused by adding many small values. Consider an N x N grid dividing the unit square into smaller squares. Each square has width w = 1 / N. Let (xi, yj) denote the midpoint of the square in column i, row j, with xi = (i − 0.5) * w. Your task is to compute the double sum:
S = ∑i=1 to N ∑j=1 to N 3 w2 [ (xi)2 + (yj)2 ].
For large N, the value of S should approach 2. You will compute S in two ways:
- Summing up the numbers 1 by 1 in a nested for loop.
Pseudocode:
- Initialize: width=1/N; sum1=0;
- For row=1 to N:
- rowSum=0;
- y = (row - 0.5) * width;
- For col=1 to N:
- x = (col - 0.5) * width;
- rowSum = rowSum + (x x + y y);
- sum1 = sum1 + rowSum;
- Final result: finalResult1= 3 width width * sum1.
- Sum all the numbers in a row, then add to the overall sum.
Pseudocode:
- Initialize: sum2=0;
- For row=1 to N:
- rowSum=0;
- y = (row - 0.5) * width;
- For col=1 to N:
- x = (col - 0.5) * width;
- rowSum = rowSum + (x x + y y);
- sum2 = sum2 + rowSum;
- Final result: finalResult2= 3 width width * sum2.
- Decision Making Model Names:___________________________________________________
- Pick ONE ethical/legal QUESTION relating to Ms. Lawrence case. Place a check next to the one you chose to answer.
- ______ ___________ What should Ms. Lawrence do in this situation?
- ______ ___________ What should the doctor do?
Part II: List 5 solutions to this question. Then rank them 1-5 with one being your choice.
- ________________________________________________________________
- ________________________________________________________________
- ________________________________________________________________
- ________________________________________________________________
- ________________________________________________________________
Restate your #1 solution____________________________________________________
Part III: List four or more reasons that support your #1 solution
- 1.______________________________________________________________
- 2.______________________________________________________________
- 3.______________________________________________________________
- 4.______________________________________________________________
Part IV: If Ms. L chooses your #1 solution, what will happen? List three possible outcomes.
- ______________________________________________________________
- ______________________________________________________________
- ______________________________________________________________
Part V: List three reasons someone might not agree with your decision.
- 1.______________________________________________________________
- 2.______________________________________________________________
- 3.______________________________________________________________
Part VI: Possible legal ramifications (list three):
- ______________________________________________________________
- ______________________________________________________________
- ______________________________________________________________