Vous êtes sur la page 1sur 2

MAS162 Foundations of Discrete Mathematics

First Semester 2014 Internal Assignment 1 Due by: 3:00 pm on Thursday April 3, 2013 Note that for each computing question, you need to submit a printout of your MATLAB program together with the input and output (including plots). 1. (a) Find, showing all working, a formula for the n-th term tn of the sequence (tn ) dened by t1 = 3; tn = 3tn1 /2, n 2.

(b) Find, showing all working, a recursive denition of the sequence with general term tn = 3(n + 1)! 2n , n 1. 2. At the beginning of week 1 there are 200kg of sand lying scattered on a carpark. Soon after the beginning of each week, a street sweeping machine removes 80% of the sand on the carpark at a cost of $0.50 per kg removed. During week n, for n 1, the wind blows 60(n + 2) = n kg of sand onto the carpark. Let an be the amount in kg of sand on the carpark at the beginning of week n for n 1. Let cn be the total cumulative cost of the sweeping machine up to the beginning of week n for n 1. (a) Draw a neat timeline showing all relevant information up to and for an . Hence nd a recursive denition for an . (b) Find by hand an for n = 1, 2, 3.. (c) Write a MATLAB program to compute an and cn for n = 1, 2, . . . , num, and display the values in three columns: n, an and cn , with appropriate headings. Allow the user to enter the value of num and run the program for num = 10. Use format bank. 3. A mineral survey has found good surface concentrations of gold in a certain area of dimensions 10 km 10 km. The concentration in ppm (parts per million) is given by the function f (x, y ) = 2 + 0.1x + 0.008(x + y )2 + sin(x y ) (1)

where x and y are the coordinates (in km) of points in the area (from the bottom left hand corner). (a) Write a MATLAB program that uses the mesh command to plot the surface dened by z = f (x, y ) for 0 x 10 and 0 y 10 (with grid spacing 0.2 for x and y , and using the default view). Also in the program use the contour command to plot contours at the concentration values f = 1.5, 2, 2.5, . . . , 6. Label the axes of both plots. Label by hand the contour for f = 1.5 and the contour for f = 6. (b) The only track through the area lies along the line y = 5. Write a MATLAB program to plot the concentration g (x) = f (x, 5) on the track for 0 x 10, and, using a function M-le and the fzero command, nd the interval for x in which the concentration g (x) is greater than or equal to 4.

CONTINUED OVER PAGE

4. It is known that for any number p and any number x such that 1 < x < 1, (1 + x)p can be expressed as the series (1 + x)p = 1 + px + p(p 1) 2 p(p 1)(p 2) 3 x + x + 12 123

which is called the binomial series and was discovered by Isaac Newton. Write a MATLAB program with a for loop to compute an approximation s of (1 + x)p using the rst few terms of this series. Allow the user to enter the value of x, the power p and the nal power nn of x in the series. Run the program three times with p = 0.5, nn = 20 and each of x = 0.3, x = 0.6 and x = 0.9, and print out the values of s, (1 + x)p and E = (1 + x)p s (using format long). 5. For each of the following, use hand calculation, showing your working. (a) Convert (A4B 2.3)12 to decimal. (b) Convert the decimal number 254763 to octal. (c) Express (C 3B 0)16 as an octal number. (d) Add (28A5D)16 and (C 3B 0)16 in hexadecimal. (e) If (0.52643)8 86 is rounded to (0.5264)8 86 , nd the absolute error written in octal oating point form. [A = 10, B = 11, C = 12, D = 13, E = 14, F = 15]

Vous aimerez peut-être aussi