Linear and Exponential Functions.
1. Linear Functions
| > | f:= x-> 3*x+1; |
| > | plot(f(x),x=-1..1); |
Note that the graph of f(x) is a straight line passing through the point (0,1). This point is called the y-intercept of f(x).
To determine the slope, take any two values of x, say x1 and x2, and form the difference quotient. The result will always be the same.
| > | x1:=1.0; x2:=2.0; |
| > | (f(x2)-f(x1))/(x2-x1); |
| > | x1:=.5; x2:=-.25; |
| > | (f(x2)-f(x1))/(x2-x1); |
| > | x1:=Pi; x2:=sin(1); |
| > | (f(x2)-f(x1))/(x2-x1); |
| > | evalf(%); |
In fact, any function of the form f(x)=m*x+b or any function which can be placed in that form is a linear function, with slope m and y-intercept (0,b).
Now, given a table of function values, how can we determine if that function is linear? Consider #29, p. 10.
| > | g:=[[1,23],[2,24],[3,26],[4,29],[5,33],[6,38]]; |
| > | plot(g,style=point,symbol=circle); |
The plot does not look linear but let's check some difference quotients.
| > | (g[3,2]-g[1,2])/(g[3,1]-g[1,1]); |
| > | (g[3,2]-g[4,2])/(g[3,1]-g[4,1]); |
| > | (g[5,2]-g[2,2])/(g[5,1]-g[2,1]); |
| > | (g[6,2]-g[2,2])/(g[6,1]-g[2,1]); |
| > | (g[6,2]-g[4,2])/(g[6,1]-g[4,1]); |
While two of the difference quotients are the same, they all would have to be the same in order for the function to be truly linear. Clearly, the list g does not come from a linear function.
| > | h:=[[1,10],[2,20],[3,29],[4,37],[5,44],[6,50]]; |
| > | plot(h,style=point,symbol=circle); |
| > | (h[3,2]-h[1,2])/(h[3,1]-h[1,1]); |
| > | (h[3,2]-h[4,2])/(h[3,1]-h[4,1]); |
| > | (h[5,2]-h[2,2])/(h[5,1]-h[2,1]); |
| > | (h[6,2]-h[2,2])/(h[6,1]-h[2,1]); |
| > | (h[6,2]-h[4,2])/(h[6,1]-h[4,1]); |
Certainly h does not come from a linear function either.
| > | k:=[[1,2.2],[2,2.5],[3,2.8],[4,3.1],[5,3.4],[6,3.7]]; |
| > | plot(k,style=point,symbol=circle); |
| > | (k[3,2]-k[1,2])/(k[3,1]-k[1,1]); |
| > | (k[3,2]-k[4,2])/(k[3,1]-k[4,1]); |
| > | (k[5,2]-k[2,2])/(k[5,1]-k[2,1]); |
| > | (k[6,2]-k[2,2])/(k[6,1]-k[2,1]); |
| > | (k[6,2]-k[4,2])/(k[6,1]-k[4,1]); |
While we have not yet tested all possible pairs, it seems that k comes from a linear function with slope 0.3.
How can we figure out its y-intercept?
We know that k(t)=m*t+b, and that m=0.3.
We also know that if t=1, then k(1)=2.2.
This gives us the equation: 2.2 = (0.3)*1 + b.
| > | fsolve(2.2=(0.3)*1+b,b); |
| > | k1:=t->(0.3)*t+(1.9); |
| > | plot([k,k1(t)],t=0..7, style=[point,line],symbol=[circle,point]); |
Now let's consider exponential functions.
| > | f:=x->(1.5)^x; |
| > | plot(f(x),x=-4..4); |
For any value of x, call it x0, the ratio of f(x0+1) and f(x0) is a fixed number. For a linear function the difference between f(x0+1) and f(x0) is a fixed number (the slope).
| > | x0:=2.0; |
| > | f(x0+1)/f(x0); |
| > | x0:=-2.0; |
| > | f(x0+1)/f(x0); |
| > | x0:=3.75; |
| > | f(x0+1)/f(x0); |
If I look now at the ratio of f(x0+a) and f(x0) for some other value of a than a=1, then the number is still constant but is a different constant. Lets take first a=1/2.
| > | x0:=2.0; |
| > | f(x0+1/2)/f(x0); |
| > | x0:=-2.0; |
| > | f(x0+1/2)/f(x0); |
| > | x0:=3.75; |
| > | f(x0+1/2)/f(x0); |
| > | x0:=2.0; |
| > | f(x0+2)/f(x0); |
| > | x0:=-2.0; |
| > | f(x0+2)/f(x0); |
| > | x0:=3.75; |
| > | f(x0+2)/f(x0); |
Evidently there is some number T with 1<T<2 such that the growth factor between f(x0+T) and f(x0) is exactly 2, no matter what x0 we pick. This is called the doubling time of the function f(x). Only exponential functions have constant doubling times.
Let's find T for our example. It is easy to take x0=0. Then f(x0)=f(0)=1, and f(x0+T)=f(T)=(1.5)^T. So we need to solve (1.5)^T=2 for T.
| > | fsolve((1.5)^T=2,T); |
| > | x0:=2.0; |
| > | f(x0+1.709511291)/f(x0); |
| > | x0:=-2.0; |
| > | f(x0+1.709511291)/f(x0); |
| > | x0:=3.75; |
| > | f(x0+1.709511291)/f(x0); |
| > |