University of Waterloo Faculty of Engineering Department of

advertisement
University of Waterloo
Faculty of Engineering
Department of Electrical and Computer Engineering
MATH 211/MATH 215
Pre-Laboratory 1
Prepared by
Surname, Surname, Legal Given Name(s)
UW Student ID Number: 2NNNNNNN
UW User ID: uwuserid @uwaterloo.ca
2A Electrical/Computer Engineering
8 February 2016
You will note that the number of each question is associated with a section within
Laboratory 1 (http://ece.uwaterloo.ca/~math211/Laboratories/01/). The
answer for each question can be found in that section.
1.1a Not including the prompts (>>), enter the following into Matlab:
>>
>>
>>
>>
>>
>>
>>
>>
>>
22/7
pi
sqrt(2)
exp(1)
format long
22/7
pi
sqrt(2)
exp(1)
Copy and paste your Matlab output here
1.1b Continue to use format long throughout the rest of this pre-laboratory and all
future laboratories unless instructed otherwise. Use Matlab to evaluate the expression
523 – 5 × 522 + 4 × 52 + 78.
Copy and paste your Matlab commands and the output here.
1.1c Use Matlab to evaluate the following expression by intelligently assigning one of the
numbers to a variable first:
52.8479281533 – 5 × 52.8479281532 + 4 × 52.847928153 + 78
You are, of course, welcome to simplify your life by using variables.
Copy and paste your Matlab commands and the output here.
2c
b  b 2  4ac
1.1d Demonstrate that the two formulas,
and
, do in fact
2a
b  b 2  4ac
give the correct roots by finding the roots of ax 2  bx  c by finding the roots of the
polynomial x 2  5 x  2 .
(-b+sqrt(b^2-4*a*c))/(2*a);
(-b-sqrt(b^2-4*a*c))/(2*a);
(-2*c)/(b+sqrt(b^2-4*a*c));
(-2*c)/(b-sqrt(b^2-4*a*c));
Ensure you use format long
Copy and paste your Matlab commands and the output here.
1.1e If you want to enter 1020 in Matlab, do you use 10e20 or 1e20?
Enter the correct input here.
1.1f If you want to enter 3.54 × 10-5 in Matlab, do you use 354e-5, 3.54e-5, 0.354e5 or -3.54e5?
Enter the correct input here.
1.1g Use both formulas to find the roots of the polynomial 2 104 x 2  8.5 103 x  6 105 .
Copy and paste your Matlab commands and the output here.
Are these answers as accurate as the answers in Question 1.1d?
Yes/No
1.1h Consider the output of 3.2i and 3.2j and discuss using j as the imaginary unit in
Matlab. Does the choice make a difference?
Yes/No
2
1.1.2.1a Using the appropriate mathematical functions in Matlab, calculate the following
mathematical expressions: e2, tan(1), sin–1(sin(5)), sin (sin–1(5)), ln(e-2 + 3j).
Copy and paste your Matlab commands and the output here.
1.1.2.1b Compare the output of atan(3/(-2)), atan(-3/2), atan2(-3,2),
atan2(3,-2), atan2( 3, -2 ) - pi.
Copy and paste your Matlab commands and the output here.
1.1.2.2a If z = 5.32 – 3.24j, demonstrate that z  zz * where z* is the complex
2
conjugate of z;
z
ze
angle z 0.5 j
; z  z*  2  z  , and z  z*  2 j z  where   z 
and  z  are the real and imaginary parts of z, respectively.
Copy and paste your Matlab commands and the output here.
1.1.2.3a Approximate ln(100!) and 100·ln(100) – 100 in Matlab.
Copy and paste your Matlab commands and the output here.
1.1.3a Using Matlab, what are the absolute and relative errors of 2.718 as an
approximation to e (see Question 1.1a)?
Copy and paste your Matlab commands and the output here.
1.1.4a In your own words, describe rounding to n digits. It should be clear from your
description that 12750 and 0.08245 round to 12800 and 0.0824 when rounding to three
digits of precision.
Your discussion here.
3
1.1.5a By putting an “x” in the most appropriate column, explain which type of rounding
we are using when we round the following numbers to four decimal digits of precision.
Value
0.841470984807897
485164995.4097903
858.515
0.00757055
50.080500
31789500.
Four-Decimal
Digits of
Precision
Round
Down
50···
and
Round
Down
50···
and
Round
Up
Round
Up
8.415 × 10-1
4.852 × 108
8.585 × 102
7.571 × 10-3
5.008 × 101
3.179 × 107
1.1.5b By putting an “x” in the most appropriate column, explain which type of rounding
we are using when we round the following numbers to five decimal digits of precision.
Value
0.841470984807897
485164995.4097903
858.515
0.00757055
50.080500
31789500.
Five-Decimal
Digits of
Precision
Round
Down
8.4147 × 10-1
4.8516 × 108
8.5852 × 102
7.5706 × 10-3
5.0080 × 101
3.1790 × 107
4
50···
and
Round
Down
50···
and
Round
Up
Round
Up
1.2.1a What number is represented by +654321 represented as a number in the form
m.nnn × 10ee?
m.nnn × 10ee
1.2.1.1a Using Matlab, what is the ratio between the largest positive floating-point
number +999999 and the smallest positive (denormalized) floating-point number
+000001?
Copy and paste your Matlab commands and the output here.
1.2.1.2a Assuming we allowed the first digit of the mantissa to be zero; which value is
different from the others: +300050, +270500, +285000, +310005, +290500?
Your answer.
1.2.1.3a Sort the following six numbers from smallest (most negative) to largest:
-255617
1
2
+665624
-835723
3
+665623
4
+187278
5
-255672
6
1.2.1.4a Using Matlab, what is the relative error of the floating-point number +522981
as an approximation of e8?
Copy and paste your Matlab commands and the output here.
1.2.2.1a As we have a signed zero, what would the product of -471932 and -000000 ?
Your answer.
1.2.2.2a The result of dividing +001935 by 10 is +000194. What is the result of
dividing +001935 by 2?
Your answer.
1.2.2.3a The result of multiplying +991935 by 10 is +990000. What is the result of
multiplying +991935 by 2?
Your answer.
5
1.2.3a What is the result of adding +372583 and +374923?
Your answer.
1.2.3b What is the result of adding +615323 and +619492?
Your answer.
1.2.3c What is the result of multiplying +474500 and +448190?
Your answer.
6
Download