Computers, Lies and the Fishing Season Liz Arnold May 21, 2003 - - PowerPoint PPT Presentation

computers lies and the fishing season
SMART_READER_LITE
LIVE PREVIEW

Computers, Lies and the Fishing Season Liz Arnold May 21, 2003 - - PowerPoint PPT Presentation

1/47 Computers, Lies and the Fishing Season Liz Arnold May 21, 2003 Introduction Computers, lies and the fishing season takes a look at computer soft- 2/47 ware programs. As mathematicians, we depend on


slide-1
SLIDE 1

1/47

  • Computers, Lies and the Fishing Season

Liz Arnold

May 21, 2003

slide-2
SLIDE 2

2/47

  • Introduction

Computers, lies and the fishing season takes a look at computer soft- ware programs. As mathematicians, we depend on computers for nu- merical answers. As we will see in this presentation, problems will occur in our computer computations. What you may think is the correct an- swer, is in fact not. We will consider two examples of the pendulum that illustrate this point. Then, we will consider two models of “harvested” populations and how the limitations of differential equation solver soft- ware may give “weird” or “incorrect” answers.

slide-3
SLIDE 3

3/47

  • The Pendulum

L θ m −mg −mg cos θ −mg sin θ θ T µ ˙ θ

slide-4
SLIDE 4

4/47

  • Finding the equation for the pendulum

We know that θ = s r. However, in this case r = L, so θ = s/L and s = Lθ. Differentiating with respect to time (where L is constant), ds dt = Ldθ dt v = L ˙ θ, where v is the velocity.

slide-5
SLIDE 5

5/47

  • Differentiating again with respect to time,

dv dt = Ld¨ θ dt a = L¨ θ, where a is the acceleration. According to Newton’s second law, the sum of the forces acting on an object equals its mass times acceleration. Thus, ma =

  • F

ma = −mg sin θ − µL ˙ θ + f(t), where f(t) is the driving term. Substituting a = L¨ θ we get mL¨ θ = −mg sin θ − µL ˙ θ + f(t). Dividing through by mL, ¨ θ = −g L sin θ − µ m ˙ θ + g(t) (1)

slide-6
SLIDE 6

6/47

  • Linearization

Now that we have the equation of a pendulum, let’s look at the case where there is no driving term. Our equations now becomes ¨ θ = −g L sin θ − µ m ˙ θ. Notice that the term −g sin θ/L makes this equation non-linear. In fact, the sin θ is the key term that is making this equation non- linear. If we assume that θ is small, we can use the approximation sin θ ≈ θ. Now our equation becomes ¨ θ = −g Lθ − µ m ˙ θ. (2) Notice that our equation is now linear. So, for very small amplitudes

  • f oscillations, the motion can be described by equation (2).
slide-7
SLIDE 7

7/47

  • Example 1

Sampling Rates To begin with we are going to look at the linearized equation of a pendulum with no damping term involved. We are going to examine the simple harmonic oscillator equation, ¨ θ + 4θ = 0, given that θ(0) = 0, ˙ θ(0) = 1. We are going to show 8 plots of the solution that satisfies the initial

  • conditions. The interval 0 ≤ t ≤ 100 was divided by 1000 equally spaced

points and a fourth-order Runge-Kutta method was used to approximate the solution at these points. To graph the solutions, we are going to chose every point, every fifth point, every tenth point and every twentieth point. Each set of points will be plotted in the tθ-plane and θ ˙ θ-plane.

slide-8
SLIDE 8

8/47

  • Plotting Solution Curves and orbits of the harmonic os-

cillator tθ-plane using every point

10 20 30 40 50 60 70 80 90 100 −0.5 −0.4 −0.3 −0.2 −0.1 0.1 0.2 0.3 0.4 0.5 t θ

slide-9
SLIDE 9

9/47

  • θ ˙

θ-plane using every point

−0.5 −0.4 −0.3 −0.2 −0.1 0.1 0.2 0.3 0.4 0.5 −1 −0.8 −0.6 −0.4 −0.2 0.2 0.4 0.6 0.8 1 θ θ’

slide-10
SLIDE 10

10/47

  • tθ-plane using every fifth point

10 20 30 40 50 60 70 80 90 100 −0.5 −0.4 −0.3 −0.2 −0.1 0.1 0.2 0.3 0.4 0.5 t θ

slide-11
SLIDE 11

11/47

  • θ ˙

θ-plane using every fifth point

−0.5 −0.4 −0.3 −0.2 −0.1 0.1 0.2 0.3 0.4 0.5 −1 −0.8 −0.6 −0.4 −0.2 0.2 0.4 0.6 0.8 1 θ θ’

slide-12
SLIDE 12

12/47

  • tθ-plane using every tenth point

10 20 30 40 50 60 70 80 90 100 −0.5 −0.4 −0.3 −0.2 −0.1 0.1 0.2 0.3 0.4 0.5 t θ

slide-13
SLIDE 13

13/47

  • θ ˙

θ-plane using every tenth point

−0.5 −0.4 −0.3 −0.2 −0.1 0.1 0.2 0.3 0.4 0.5 −1 −0.8 −0.6 −0.4 −0.2 0.2 0.4 0.6 0.8 1 θ θ’

slide-14
SLIDE 14

14/47

  • tθ-plane using every twentieth point

10 20 30 40 50 60 70 80 90 100 −0.5 −0.4 −0.3 −0.2 −0.1 0.1 0.2 0.3 0.4 0.5 t θ

slide-15
SLIDE 15

15/47

  • θ ˙

θ-plane using every twentieth point

−0.5 −0.4 −0.3 −0.2 −0.1 0.1 0.2 0.3 0.4 0.5 −1 −0.8 −0.6 −0.4 −0.2 0.2 0.4 0.6 0.8 1 θ θ’

slide-16
SLIDE 16

16/47

  • As fewer and fewer points are plotted notice how the graphs are mod-
  • ulated. Also, notice that the period of the graphs plotting every point,

every fifth point and every tenth point seem to have the same value of π, but the graph of plotting every twentieth point seems to have doubled to 2π.

20 40 60 80 100 −0.5 0.5 t θ tθ−plane using every point 20 40 60 80 100 −0.5 0.5 t θ tθ−plane using every twentieth point

slide-17
SLIDE 17

17/47

  • What is going on here? Is the accuracy of the solver to blame? No.

The accuracy of all the points taken are just as good as the other ones. All of the points were sampled from the same list of 1000 approximate

  • values. What we observed from looking at the graphs always occurs

when an oscillatory curve is approximated by a finite number of equally spaced points connected by a straight line segment. As the number of sampled points per unit time decrease, the graphs appear to worsen. Aliasing Aliasing occurs when there is not enough discrete points to reconstruct the shape of the original graph. Notice how the graph looks when plotting every point. But when you sample fewer than two sample points per period as in the graph plotting every twentieth point, the graphical representation appears to have a larger period.

slide-18
SLIDE 18

18/47

  • Conclusion

What can we do to correct the misrepresentation in representing a con- tinuous periodic function by a discrete point set? If the experimenter knew before hand, the period of oscillation, then the “sampling rate” could be set high enough to decrease the problem.

slide-19
SLIDE 19

19/47

  • Example 2

The Driven Pendulum We have just examined the equation of a pendulum with no damping

  • term. Now we are going to look at the equation of a pendulum with a

damping term involved. Recall that the equation for a pendulum with a damping term is ¨ θ = −g L sin θ − µ m ˙ θ + g(t). The equation that we are going to examine is ¨ θ = − sin θ − 0.1 ˙ θ + cos t.

slide-20
SLIDE 20

20/47

  • What Does The Motion Look Like?

This picture shows the motion of our pendulum resulting from 15 dif- ferent sets of initial angular velocities. Each solution starts with the position θ(0) = 0, while the initial angular velocities are evenly spaced between 1.85 and 2.1. The graph is plotted on the intervals 0 < t < 200 and −10 < θ < 50.

50 100 150 200 −10 10 20 30 40 50 t θ Fifteen different solutions to θ"+0.1θ’+sin(θ)=cos(t)

slide-21
SLIDE 21

21/47

  • Notice how the 15 solutions are different from one another even

though they have the same starting position. The initial angular veloci- ties affect each solution differently. The difference in the initial angular velocities is only 0.25 and the solutions behave in this way. Imagine how the solutions would look like if the difference between the initial angular velocities was greater than 0.25.

50 100 150 200 −10 10 20 30 40 50 t θ Fifteen different solutions to θ"+0.1θ’+sin(θ)=cos(t)

slide-22
SLIDE 22

22/47

  • We saw what happens to our damped pendulum when you change the

initial angular velocities slightly. Now, let’s look at the case we where we reduce the relative and absolute local error tolerance. We are going to continue to use the equation ¨ θ = − sin θ − 0.1 ˙ θ + cos t, with the initial position of θ(0) = 0 and the initial angular velocity of ˙ θ(0) = 2. Graph a) is the graph of the pendulum with an absolute local error tolerance of 4 × 10−4 and a relative local error tolerance of 4 × 10−4. Graph b) is the graph of the pendulum with an absolute local error tolerance of 4 × 10−6 and a relative local error tolerance of 4 × 10−6.

slide-23
SLIDE 23

23/47

  • Notice how graph a) is settling down at about 25 while graph b) is

settling down at about 12.

20 40 60 80 100 120 140 160 180 200 −10 10 20 30 t x Graph a) 20 40 60 80 100 120 140 160 180 200 −5 5 10 15 t x Graph b)

slide-24
SLIDE 24

24/47

  • Which Graph Is The Correct Solution?

Just by reducing the relative and absolute local error tolerance, you see that we get two completely different answers for the same problem. Which one is the correct answer? The answer is the graph with the smaller relative and absolute local tolerances, which is graph b).

20 40 60 80 100 120 140 160 180 200 −5 5 10 15 t x Graph b)

When graphing these, you should experiment with different values

  • f the relative and local error tolerances until you get two graphs that

look similar and then you know that the graph you have is the correct solution.

slide-25
SLIDE 25

25/47

  • Conclusion

As we saw, when graphing a damped harmonic oscillator, you can have different solutions just by increasing or decreasing the relative and ab- solute local tolerances. You must experiment with different values for relative and local error tolerances until you are satisfied that you have a correct representation of the graph.

slide-26
SLIDE 26

26/47

  • Example 3

The Logistic Model With A Fishing Season We are now going to look at model for a bounded population with a harvesting rate. The best known equation for this model is x′ = rx

  • 1 − x

K

  • − F,

where x(t) is the population at time t, r, and K are positive constants, and F is the harvesting rate. x(t) is measured in tons, and t is measured in years. The equation that we are going to examine is x′ = x(1 − x/12) − F.

slide-27
SLIDE 27

27/47

  • If there is no fishing (F = 0), then the fish population tends to the

equilibrium level K as shown.

1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 t x x ’ = x (1 − x/12) − F F = 0

slide-28
SLIDE 28

28/47

  • Continuous fishing at a constant but low, rate (F = 2), leads to a

stable equilibrium below K as shown. Notice that if the initial population level is too low, extinction for the fish is inevitable.

1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 t x x ’ = x (1 − x/12) − F F = 2

slide-29
SLIDE 29

29/47

  • Continuous fishing at a high constant rate (F = 6), leads to extinction

eventually, regardless of the initial condition.

1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 t x x ’ = x (1 − x/12) − F F = 6

slide-30
SLIDE 30

30/47

  • A high fishing rate will not lead to extinction if the fishing season

is restricted to a few months each year. Using the high fishing rate equation x′ = x(1−x/12)−6, look what happens to the fish population maintained over a four-month fishing season as well as an eight-month fishing season. Four-month fishing season

2 4 6 8 10 5 10 15 20 t x x ’ = x (1 − x/12) − 6 sqw(t,1,33.3)

slide-31
SLIDE 31

31/47

  • Eight-month fishing season

2 4 6 8 10 5 10 15 20 t x x ’ = x (1 − x/12) − 6 sqw(t,1,66.6)

As you see when having a high rate of fishing and a four-month fishing season, the fish population will continue to remain if there are more than 3.2 tons of fish. For the case of an eight-month fishing season, you see that the fish population is headed for extinction no matter what.

slide-32
SLIDE 32

32/47

  • Computer Lies

How good are the computed zigzag solution curves in out graphs that we just saw? The zigzag solutions are are pretty accurate if the maximal step size of the solver is kept small enough so that the solver recognizes the points in time when the harvesting function F switches on or off.

2 4 6 8 10 5 10 15 20 t x x ’ = x (1 − x/12) − 6 sqw(t,1,33.3)

slide-33
SLIDE 33

33/47

  • If the maximal step size of the solver is made large enough, then

the solver will not be able to recognize the points in time when the harvesting function F switches on or off.

2 4 6 8 10 5 10 15 20 t x x ’ = x (1 − x/12) − 6 sqw(t,1,33.3)

Alternatively, a large maximal step size is allowed if the local error bounds of the solver are set to very small levels.

slide-34
SLIDE 34

34/47

  • This graph, reading from top to bottom, shows with accuracy the

consequences of no fishing, a four month fishing season, an eight month fishing season and continuous fishing on an initial population of x(0) = 20 tons of fish. The relative local error tolerance is 1 × 10−7 and the absolute local error tolerance is 1 × 10−10.

2 4 6 8 10 5 10 15 20 t−axis x−axis no fishing continuous fishing four−month fishing eight−month fishing

slide-35
SLIDE 35

35/47

  • Now, when we increase the local error bounds of the solver, notice

what happens to our solutions. The relative local error tolerance is increased to 1 × 10−2 and the absolute local error tolerance is increased to 1 × 10−2.

2 4 6 8 10 5 10 15 20 t−axis x−axis no fishing continuous fishing four−month fishing eight−month fishing

You can see that the this graph is telling “lies” about the fishing season.

slide-36
SLIDE 36

36/47

  • What happens when changing the step size of the solver set, fourth-
  • rder Runge-Kutta? The computer tells more “lies.” When the step

size is changed, you get different solutions as shown.

2 4 6 8 10 −5 5 10 15 20 t−axis x−axis h=1/30 h=0.4 h=0.96

slide-37
SLIDE 37

37/47

  • Conclusion

When working with computers and graphs, keeping the step size of your solver small enough will help the solver recognize the points in time that are important and that will lead to accurate solutions. Also, if you have a large step size, then setting the local error bounds low enough will lead to accurate solutions as well. If neither of these conditions are met, then your computer solver may tell “lies” about your solution.

slide-38
SLIDE 38

38/47

  • Example 4

Predator-Prey Dynamics With Fishing Finally, we are going to look at a predator-prey system of equations. The best known system of equations for the predator species x(t) and the prey species y(t) are: x′ = ax(−1 + by) − H1x y′ = cy(1 − dx) − H2y where a, b, c, d are positive constants and H1 and H2 are nonnegative ”harvesting” coefficients. The harvesting terms H1x and H2y model constant effort harvesting rather than the constant rate harvesting that we examined previously.

slide-39
SLIDE 39

39/47

  • We are going to plot the solutions of x′ = x(−1 + y), and y′ =

y(1−x), on the xy-plane, tx-plane, and the ty-plane. These equations examine no harvesting.

1 2 3 4 0.5 1 1.5 2 2.5 3 3.5 4 x y 10 20 30 1 2 3 4 t x 10 20 30 1 2 3 4 t y

slide-40
SLIDE 40

40/47

  • Now, we are going to plot the solutions of x′ = x(−1 + y) − 0.7x,

and y′ = y(1 − x) − 0.7y, on the xy-plane, tx-plane, and the ty-plane. These equations examine continuous light fishing.

2 4 6 1 2 3 4 5 6 7 8 x y 10 20 30 2 4 6 t x 10 20 30 2 4 6 8 t y

slide-41
SLIDE 41

41/47

  • Nonlinear Phenomenon

A distinctly nonlinear phenomenon is occurring with the graph contain- ing no harvesting. When the periods of the solutions increase with the amplitude of the cycle, a nonlinear phenomenon has occurred.

5 10 15 20 25 30 2 4 t y

slide-42
SLIDE 42

42/47

  • Seasonal Harvesting

Now, we are going to show what happens to a particular population cycle if both species are harvested with the high harvesting coefficients, H1 = H2 = 4, but with a short, one month harvest season per year. The graph shows an oval orbit of the no fishing case and an extinction orbit

  • f the constant, heavy fishing case, and an orbit of fishing one month

per year. The maximal step size is 0.01 and the relative local error tolerance is 1×10−7 and the absolute local error tolerance is 1×10−10. The time span is 100 years and the number of points plotted is 10, 000.

slide-43
SLIDE 43

43/47

  • 0.2

0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0.5 1 1.5 2 2.5 x−axis y−axis no fishing heavy fishing

  • ne month fishing

Each arc of the “bracelet” is an arc of one of the population ovals in the no-harvest case or an arc of an extinction curve in the continuous high-rate harvest case.

slide-44
SLIDE 44

44/47

  • If we reduce the time span to 20 years and the number of plotted

points to 2000, we get:

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0.5 1 1.5 2 2.5 x−axis y−axis no fishing heavy fishing

  • ne month fishing
slide-45
SLIDE 45

45/47

  • If we increase the step size to 0.20, we get:

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0.5 1 1.5 2 2.5 x−axis y−axis no fishing heavy fishing

  • ne month fishing

The computer is now telling lies about the population. The maximal step size is too large so the solver can’t “see” the sudden breaks in the harvesting coefficient when they occur so the solver produces this graph.

slide-46
SLIDE 46

46/47

  • If we now leave the step size at 0.20, and decrease the relative absolute

local tolerance to 1 × 10−9, and decrease the absolute local tolerance to 1 × 10−12, we get:

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0.5 1 1.5 2 2.5 x−axis y−axis no fishing heavy fishing

  • ne month fishing
slide-47
SLIDE 47

47/47

  • Conclusion

As we have seen in the case of the harmonic oscillator, the driven pendulum, the logistic model with a fishing season and the predator- prey dynamics with fishing, what you may think is a correct answer is in fact not. Every differential solver has is “kinks,” so the user must experiment with their equations. You should not rely on the first graph that you see because the graph could be a lie.