Applications of Nonlinear Functions

import matplotlib.pyplot as plt Let’s look at some textbook applications of nonlinear functions (and models). Stock Prices and Prime Rate It is theorized that the price per share of a stock is inversely proportional to the prime (interest) rate. In January 2010, the price per share \(S\) of Apple Inc. stock was $205.93, and the prime rate \(R\) was 3.25%. The prime rate rose to 4.75% in March 2010. What was the price per share in March 2010 if the assumption of inverse proportionality is correct? …

Posted on

Mathematical Modeling and Curve Fitting in Python

There are a handful of families of functions that form the basic toolkit that we use to model data. Curve fitting is the process of constructing a curve, or mathematical function, that best fits a series of data points. The simplest way to decide which, if any, type of function fits a dataset is to examine a scatterplot of the data. If we can spot a general pattern that looks like any of the functions we would like to model with, then we can try to fit the data with it. …

Posted on

Nonlinear Models, Polynomial Functions

import matplotlib.pyplot as plt import numpy as np import math Linear and quadratic functions are part of a general class of polynomial functions. A polynomial function is given by \[f(x) = a_nx^n + a_{n-1}x^{n-1}, + \dots + a_2x^2 + a_1x^1 + a_0\] where \(n\) is a nonnegative integer and \(a_n, a_{n-1}, \dots, a_1, a_0\) are real numbers, called the coefficients. The number \(a_0\), which is not multiplied by a variable, is called a constant. …

Posted on

Nonlinear Models, Quadratic Functions

A quadratic function is given by \[f(x) = ax^2 + bx + c\] where \(a \neq 0\). The graph of a quadratic function is called a parabola such that: it always has a cup-shaped curve it opens upward if \(a > 0\) or opens downwards if \(a < 0\) it has a turning point, or vertex, whose coordinate is \(x = - \frac{b}{2a}\) the vertical line \(x = \frac{-b}{2a}\) (which is not part of the graph) is the line of symmetry You could think of the vertex as the first \(y\)-value. …

Posted on

Determining the Most Frequent Items in a Sequence

If you have a sequence of items, and want to determine the most frequently occurring items in it, you can use the collections.Counter class. words = [ "look", "into", "my", "eyes", "look", "into", "my", "soul", "it's", "not", "uncommon", "to", "see", "my", "mood", "in", "my", "eyes" ] from collections import Counter wcount = Counter(words) wcount.most_common(3) ## [('my', 4), ('look', 2), ('into', 2)] You can also check how many times a given item appears in the sequence. …

Posted on