Scientific Computing Maastricht Science Program Week 4 Frans - - PowerPoint PPT Presentation

scientific computing
SMART_READER_LITE
LIVE PREVIEW

Scientific Computing Maastricht Science Program Week 4 Frans - - PowerPoint PPT Presentation

Scientific Computing Maastricht Science Program Week 4 Frans Oliehoek <frans.oliehoek@maastrichtuniversity.nl> Recap Matlab...! Supervised Learning find f that maps {x 1 (j) ,...,x D (j) } y (j) Interpolation f


slide-1
SLIDE 1

Scientific Computing

Maastricht Science Program

Week 4

Frans Oliehoek <frans.oliehoek@maastrichtuniversity.nl>

slide-2
SLIDE 2

Recap

 Matlab...!  Supervised Learning

 find f that maps {x1

(j),...,xD (j)} → y(j)

 Interpolation

 f goes through the data points

 linear regression

 lossy fit, minimizes 'vertical' SSE

 Unsupervised Learning

 PCA  We just have data points {x1

(j),...,xD (j)}

x2 x1

u=(u1,u2)

slide-3
SLIDE 3

Numerical Differentiation and Integration

slide-4
SLIDE 4

Numerical Differentiation and Integration

 Finding derivatives or primitives of a function f  not always easy or possible....

 no closed form solution exists  the solution is a very complex expression that is hard to

evaluate

 we may not know f (as before!)

→ numerical methods

slide-5
SLIDE 5

Numerical Differentiation

 If we want to know the rate of change...  E.g.:

 fluid in a cylinder with a hole in the bottom, measured

every 5 seconds.

 High-speed camera images of animal movements,

(jumping in frogs and insects, suction feeding in fish, and the strikes of mantis shrimp)

 determine speed  and acceleration

slide-6
SLIDE 6

Numerical Differentiation

 Determine the vertical speed at t=0.25  what would you do?

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 frog height(t)

slide-7
SLIDE 7

Numerical Differentiation

 Determine the vertical speed at t=0.25...

 a few options...

0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 frog height(t)

slide-8
SLIDE 8

Numerical Differentiation

 Determine the vertical speed at t=0.25...

 a few options...

0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 frog height(t)

slide-9
SLIDE 9

Numerical Differentiation

 Determine the vertical speed at t=0.25...

 a few options...

0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 frog height(t)

forward finite difference backward finite difference

slide-10
SLIDE 10

Numerical Differentiation

 Determine the vertical speed at t=0.25...

 a few options...

0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 frog height(t)

forward finite difference backward finite difference

Other Ideas?

slide-11
SLIDE 11

Numerical Differentiation

 Determine the vertical speed at t=0.25...

 a few options...

0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.35 0.36 0.36 0.37 0.37 0.38 0.38 0.39 0.39 frog height(t)

Centered finite difference

slide-12
SLIDE 12

Numerical Integration

 Integration: the reversed problem...  Suppose we travel in a car with a broken odometer  Speedometer is working...

slide-13
SLIDE 13

Numerical Integration

 maintain speeds, to figure out traveled distance

t v(t) km/h 80 30 120 65 128 120 122 728 120 733 798 20 836 20 941 70 970 120 1350 123 1404 90

enter highway ramp exit highway ramp traffic jam

slide-14
SLIDE 14

Numerical Integration

 maintain speeds, to figure out traveled distance

t v(t) km/h 80 30 120 65 128 120 122 728 120 733 798 20 836 20 941 70 970 120 1350 123 1404 90

enter highway ramp exit highway ramp traffic jam

200 400 600 800 1000 1200 1400 1600 20 40 60 80 100 120 140 v(t) km/h

slide-15
SLIDE 15

Numerical Integration

 maintain speeds, to figure out traveled distance

t v(t) km/h 80 30 120 65 128 120 122 728 120 733 798 20 836 20 941 70 970 120 1350 123 1404 90

enter highway ramp exit highway ramp traffic jam

200 400 600 800 1000 1200 1400 1600 20 40 60 80 100 120 140 v(t) km/h

How far did we travel?

slide-16
SLIDE 16

Midpoint Formula

 Approximate the integral with a finite sum

integration interval

y x ̄ x1 ̄ xM x0 x1 xM

slide-17
SLIDE 17

Midpoint Formula

integration interval

y x ̄ x1 ̄ xM x0 x1 xM H size of interval

slide-18
SLIDE 18

Midpoint Formula

integration interval

y x ̄ x1 ̄ xM x0 x1 xM ̄ xk= xk−1+xk 2

Approximation of the integral:

I MP(f )=H∑

k=1 M

f (̄ xk)

slide-19
SLIDE 19

Trapezoid Formula

integration interval

y x I1 I M x0 x1 xM

slide-20
SLIDE 20

Trapezoid Formula

integration interval

y x I1 I M x0 x1 xM I k=H f (xk−1)+f (xk) 2

Approximation of the integral:

I MP(f )=∑

k=1 M

I k

slide-21
SLIDE 21

Symbolic Integration

 Finally: when faced with

a difficult integral... → try 'symbolic' packages!

slide-22
SLIDE 22

Symbolic Integration

 Finally: when faced with

a difficult integral... → try 'symbolic' packages!