Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Lecture slides for UCLA LS 30B, Spring 2020

Views: 14462
License: GPL3
Image: ubuntu2004
Kernel: SageMath 9.3
import numpy as np

Oscillatory behavior: periodic functions

When you think of oscillating, you probably think of something going up and down, or back and forth, repeatedly.

The key idea here is the last word in that sentence: repeatedly. The key to the mathematical definition of oscillation is repeating the same behavior over and over again, forever.

More specifically, for a mathematical function (draw a graph), oscillating means that the value of the function goes up and down, again and again, repeating the exact same pattern. This is called a periodic function.

f(t) = 2*sin(2*pi/3*(t-1)) + 2.5 p = plot(f, (t, 0, 15), thickness=2) p.show(ymin=0, ymax=6, aspect_ratio=0.65, axes_labels=("$t$", "$y$"), figsize=7)
Image in a Jupyter notebook

Definition: A function f:RRf: \mathbb{R} \to \mathbb{R} is called periodic if there is a positive number pp such that f(t+p)=f(t)for all real numbers t f(t + p) = f(t) \qquad \text{for all real numbers } t The smallest number pp for which this is true is called the period of the function ff.

In short, the function repeats itself over and over.

Oscillatory behavior in dynamical systems

Suppose we have a system of differential equations: {X=blah blah blahY=yada yada\qquad \begin{cases} X' = \text{blah blah blah} \\ Y' = \text{yada yada} \\ \hspace{1.4em} \vdots \end{cases}

A solution of this system is a set of functions X(t)X(t), Y(t)Y(t), etc.

We say this solution oscillates, or has oscillatory behavior, if each of the functions X(t)X(t), Y(t)Y(t), etc, is periodic, with the same period.

What does this look like?

Remember, we have two ways of visualizing solutions to our differential equations: trajectories, and time series. Therefore we have two different ways to visualize oscillatory behavior.

Visualizing oscillatory behavior: Time series

Since the time series of a differential equation consists of just the graph(s) of the state variable(s) (X(t)X(t), Y(t)Y(t), etc) versus time (tt), we've already seen what oscillatory behavior looks like in time series graphs:

vectorfield(H, L) = (0.3*H - 0.02*H*L, 0.01*H*L - 0.2*L) initial_state = (30, 5) t_range = srange(0, 130, 0.1) solution = desolve_odeint(vectorfield, initial_state, t_range, [H, L]) solution = np.insert(solution, 0, t_range, axis=1) hares_plot = list_plot(solution[:,(0,1)], plotjoined=True, color="lightgray", thickness=2, ymin=0, ymax=80, legend_label="$H$ (hares)", axes_labels=("$t$", "Populations")) lynx_plot = list_plot(solution[:,(0,2)], plotjoined=True, color="gold", thickness=2, ymin=0, ymax=80, legend_label="$L$ (lynx)", axes_labels=("$t$", "Populations")) @interact(show=selector(["Hares", "Lynx", "Both"], buttons=True, label="Show:")) def _(show): if show=="Hares": p = hares_plot elif show=="Lynx": p = lynx_plot else: p = hares_plot + lynx_plot p.show(aspect_ratio=0.5, figsize=7)

The time series are graphs of periodic functions.

Visualizing oscillatory behavior: Trajectories

Suppose we have an oscillating solution to a system of differential equations. In other words, the state variables are periodic functions. What does the corresponding trajectory look like?

trajectory_plot = list_plot(solution[:300,1:], plotjoined=True, color="red", thickness=2, xmin=0, ymin=0, xmax=65, ymax=45, axes_labels=("$H$ (hares)", "$L$ (lynx)")) trajectory_plot.show(figsize=6)
Image in a Jupyter notebook

In short, the trajectory forms a loop in the state space.

Summary

When you think of oscillatory behavior, you should think “repeating over and over”. And you should get used to visualizing this in two ways: as time series that repeat over and over, from left to right, and as a trajectory that forms a closed loop in the state space.

p = hares_plot + lynx_plot p += text("Time series", (65, 75), color="black", fontsize=20, aspect_ratio=1) trajectory_plot += text("Trajectory", (32, 42), color="black", fontsize=20, aspect_ratio=1) p = graphics_array([[p, trajectory_plot]]) p.show(figsize=10)
Image in a Jupyter notebook