Math Review Lecture Notes, Lecture notes of Vector Analysis

Lecture notes on Math Review for EECS 442 WI 2021. The lecture covers topics such as Floating Point Arithmetic, Adding Numbers, Fixed-Point Arithmetic, and Floating Point Numbers. The lecture also discusses the Free Drinks in Vegas Theorem and some Gotchas. The document highlights that computer numbers aren’t math numbers and that overflow, accidental zeros, roundoff error, and other issues can occur.

Typology: Lecture notes

2020/2021

Uploaded on 05/11/2023

goldr4k3
goldr4k3 🇺🇸

4.4

(31)

286 documents

1 / 137

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Justin Johnson & David Fouhey January 28, 2021
EECS 442 WI 2021: Lecture 4 -
Lecture 4:
Math Review
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Math Review Lecture Notes and more Lecture notes Vector Analysis in PDF only on Docsity!

Lecture 4:

Math Review

Administrative

HW0 out, due 2/

HW1 out soon

This Lecture: Goal

  • Not a “Linear algebra in one lecture” – that’s

impossible.

  • You should have seen this before
  • Aimed at reviving your knowledge and plugging any

gaps

  • Aimed at giving you intuitions
  • I’ll intentionally go fast ; intent is for slides to be a

reference for you to review later

Floating Point Arithmetic

Free Drinks in Vegas

Each game/variable has mean $0.10, std $

100 games is

uncertain and

fun!

100K games is

guaranteed profit:

99.999999% lowest

value is $0.064.

$0.01 for drinks

$0.054 for profits

Let’s make it big

  • Suppose we take the average of 50M normally

distributed numbers (mean=31, std=1)

  • Theory : Average is a normally distributed random

variable with mean 31 and std

(

)*+

≈ 10

,)

  • Practice :

Result:

17.4695??

What is a number?

7

6

5

4

3

2

1

0

Adding two numbers

“Integers” on a computer are integers modulo 2

k

Carry

Flag

Result

8

7

6

5

4

3

2

1

0

Some Gotchas

42

32 + 9 x 40 / 10 =

32 + 104 / 10 =

Overflow

32 + (9 x 40) / 10 =

uint

32 + (9 x 40) / 10 = 68

math

Why 104?

9 x 40 = 360

360 % 256 = 104

Should be:

9x4=

32 + 10 =

42

What is a number?

7

6

5

4

3

2

1

0

How can we do fractions?

5

4

3

2

1

0

  • 1
  • 2

Floating Point Numbers

Sign (S) Exponent (E)

Fraction (F)

𝑺

𝑬#𝒃𝒊𝒂𝒔

𝟑

7 - 7

0

Bias: allows exponent to be negative (bias = - 127 for float32)

Note: fraction = significant = mantissa;

exponents of all ones or all zeros are special numbers

Floating Point Numbers

Sign Exponent

Fraction

  • 2

0

x 1.00 = - 1

0/

  • 2

0

x 1.125 = - 1.

1/

  • 2

0

x 1.25 = - 1.

0 1 0

2/

  • 2

0

x 1.75 = - 1.

  • 2

0

x 1.875 = - 1.

6/

7/

7 - 7=

(-bias)

  • 1

−𝟏

𝑺

𝟐

𝑬#𝒃𝒊𝒂𝒔

𝟏 +

𝑭

𝟐

𝟑

Floating Point Numbers

Sign Exponent

Fraction

  • 2

0

x 1.00 = - 1

  • 2

0

x 1.125 = - 1.

  • 2

2

x 1.00 = - 4

  • 2

2

x 1.125 = - 4.

Gap between numbers is relative , not absolute

Adding Floating Point Numbers

Sign Exponent Fraction

  • 2

2

x 1.00 = - 4

  • 2
    • 1

x 1.00 = - 0.

  • 2

2

x 1.125 = - 4.

Actual implementation is complex