Assignment title: Management


Write a function that accepts a year as an input argument and determines whether the year is a leap year. Use the mod function. The output should be the variable extra_day, which should be 1 if the year is a leap year and 0 otherwise. The rules for determining leap years in the Gregorian calendar are as follows: 1. All years evenly divisible by 400 are leap years. 2. Years evenly divisible by 100, but not by 400, are not leap years. 3. Years divisible by 4, but not by 100, are leap years. 4. All other years are not leap years. For example, the years 1800, 1900, 2100, 2300 and 2500 are not leap years, but 2400 is a leap year. You must write a script file that thoroughly tests whether your function works correctly. Q2 2. Question 22 from Chapter 4, which is: a. Use a for loop to determine the sum of the first 10 terms in the series 5k3, where k=1,2,3,...,10. Report your answer to the Command Window. b. Repeat part (a) without using a loop. Submit your solution as m-files Q3 3. Question 32 from Chapter 4, which is: a. Use a while loop to determine how many terms in the series 2k, where k=1,2,3,…, are required for the sum of the terms to exceed 2000. Report your answer to the Command Window. b. What is the sum for this number of terms? Report your answer to the Command Window. Submit your solution as m-files Q4 Estimate the roots of the equation by plotting the equation and observing what the values of the roots are from the plot. Report your result by displaying the values to the Command Window. The estimate only needs to be accurate to 2 significant figures. Submit your solution as m-files Q5 Write a function that solves a system of linear equations. Use your function to solve the following: a). b). c). Submit your solution as m-files Q6 The following data give the stopping distance d as a function of initial speed v, for a certain car model. Find a quadratic polynomial that fits the data. Determine the quality of the curve fit by computing J, S and R2. Compare the quality of the quadratic curve-fit to an exponential curve-fit graphically and numerically. v (mi/hr) 20 30 40 50 60 70 d (ft) 45 80 130 185 250 330 Submit your solution as m-files