There may be other types of questions, but being able to do these should mean you will do well on this test.
We will use functions from the MTH229
package
using MTH229
(This allows us to use limit
, the "'" for differentiation, diff
, plotif
, tangent
, ...)
f(x) = (sqrt(x+25) - 5) / x c = 0 plot(f, c-1, c+1)
The limit looks to be $0.1$.
g(x) = abs(x)/x c = 0 plot(g, c-1, c+1, linewidth=5) # linewidth set to show horizontal parts of graph
There is no limit at $0$, there are different left and right limits.
h(x) = ( 1/(3+x) - 1/(3-x)) / x c = 0 plot(h, c-1, c+1)
The limit is around $-0.22$.
i(x) = log(1/abs(x))^(-1/32) c = 0 plot(i, c, c+1/2)
Tricky, looks like it will be just below 1, but it dives to $0$.
lim
or just look at $f(0.1), f(0.01), f(0.001), ...$)lim(f, 0)
6x2 Array{Float64,2}: 0.1 0.0999002 0.01 0.09999 0.001 0.099999 0.0001 0.0999999 1.0e-5 0.1 1.0e-6 0.1
Again, we see the answer is $0.1$
lim(g, 0)
6x2 Array{Float64,2}: 0.1 1.0 0.01 1.0 0.001 1.0 0.0001 1.0 1.0e-5 1.0 1.0e-6 1.0
This seems to say the answer is 1, but this is only a right limit, The left limit is different:
lim(g, 0, dir="-")
6x2 Array{Float64,2}: -0.1 -1.0 -0.01 -1.0 -0.001 -1.0 -0.0001 -1.0 -1.0e-5 -1.0 -1.0e-6 -1.0
lim(h, 0)
6x2 Array{Float64,2}: 0.1 -0.222469 0.01 -0.222225 0.001 -0.222222 0.0001 -0.222222 1.0e-5 -0.222222 1.0e-6 -0.222222
We see again $-0.22...$
lim(i, 0, dir="+")
6x2 Array{Float64,2}: 0.1 0.974273 0.01 0.953397 0.001 0.941392 0.0001 0.932967 1.0e-5 0.926484 1.0e-6 0.92122
This is not $0$, as we expected from the graph. But we know graphs can be misleading. This is just a tricky question – the graphical and numeric tools don't show the right answer, but limit
will do so:
limit(i, 0, dir="+")
SymPy
(the limit
function) to find the following limits:Checking both sides we have:
f(x) = (sqrt(1+x) - sqrt(1-x))/x c = 0 limit(f, c), limit(f, c, dir="-")
(1,1)
The left and right limits are both $1$.
(Use: f(x) = (x^(3//2) - 8) / (x - 4)
.)
f(x) = (x^(3//2) - 8) / (x-4) c = 4 limit(f, c), limit(f, c, dir="-")
(3,3)
c = 0 limit(h, c, dir="+"), limit(h, c, dir="-")
(-2/9,-2/9)
c = 0 limit(i, c, dir="+")
We assume you have run the following code:
f(x) = sin(x) a,b = -pi/3, pi/3 m = (f(b) - f(a)) / (b-a)
f'(a), f'(b)
(0.5000000000000001,0.5000000000000001)
(Recall, the derivative of $\sin(x)$ is an even function, so the two answers being the same makes sense.)
forward(f, c, h) = (f(c+h) - f(c)) / h ad = forward(sin, pi/3, 1e-6)
sin'(pi/3)
?f'(b) - ad
So we have accuracy around the size of our small value of $h$ in this problem.
Find the rate of change of height at time $t=1$. Find the rate of change of height at the instant the arrow strikes the grount.
f(t) = -16t^2 +25t + 5 f'(1)
And to do the last one we must solve first for the time which is a zero of f
:
t0 = fzero(f, 5) f'(t0)
Plotting shows both signs (both negative) are correct, as the tangent lines are clearly sloping downwards:
plot(f, 0, t0) plot!([tangent(f, 1), tangent(f, t0)], 0, t0)
fzero
find when $V'(t) = a$ between $0$ and $100$.f(x) = x * airy(x)
over the interval $[-3, 3]$. From your graph, answer: on what intervals is $f(x)$ positive? increasing? concave up?This graph will show where $f$ is positive:
f(x) = x * airy(x) plotif(f, f, -3, 3)
This graph will show where $f$ is increasing, by showing where $f'(x) > 0$. (These need not be exactly the same, but usually are.)
plotif(f, f', -3, 3)
Finally, this graph will show concave up by showing where $f''(x) > 0$.
plotif(f, f'', -3, 3)
We find the critical points using fzeros
:
f(x) = 2x - x^2/6 - x^3/9 cps = fzeros(f) # a polynomial, so f'=0 gives all critical points
3-element Array{Real,1}: -5.05842 0.0 3.55842
To find the value of f''
can be done by typing f''(value1)
, ... or with:
map(f'', cps)
3-element Array{Float64,1}: 3.03895 -0.333333 -2.70561
We make a quick plot to see that critical points are where the derivative is $0$ – and not undefined, as the case may be if the function has cusps:
f(x) = 1/x + x # x > 0 plot(f, .1, 5) # only one
We have the lone critical point is near $1$ so we use that as a starting point for fzero
:
cp = fzero(f', 1) f''(cp)
(We need to specify a range here, as even though f
is a polynomial, the result of f''
will not be for technical reasons. Alternatively, you can differentiate by hand if you want to find f''
.)
f(x) = 2x - x^2/6 - x^3/9 fzeros(f'', -5,5) # zeros of f'' are inflection points if concavity changes sign
1-element Array{Float64,1}: -0.5
(How might you know that there are no other ones outside of the interval :([-5,5])?)
f(x) = x^3 - 3x + 5 cps = fzeros(f', -10, 10) plot(f', -2, 2) ## look for + -> - or - -> + scatter!(cps, map(f', cps))
We see that at the left critical point the derivative changes sign from positive to negative, so this will be a relative maxima for $f$. The right one, the story is opposite, so we have a relative minima.
f(x) = x^2 * exp(-x/3) plot(f, -5, 15)
The critical points seem to be around 0 and 10:
cps = fzeros(f', -5, 15)
2-element Array{Float64,1}: -0.0 6.0
We plot to see what the derivative is doing at $0$ and $6$:
plot(f', -1, 7)
So at $0$ we have $f'(x)$ changes sign from negative to positive – corresponding to a relative minimuma for $f(x)$. At $6$, we have $f'(x)$ changes sign from positive to negative, so this will correspond to a relative maxima for $f$ (as the graph showed).
f(x) = (x^2)^(1/3)*(2-x)
. Make a plot over $[-4,4]$ and identify graphically any critical points. Are all the critical points found by fzeros(f, -4, 4)
? Can the second derivative test classify all the critical points? Can the first derivative test classify all the critical points?f(x) = (x^2)^(1/3) * (2-x) plot(f, -4, 4) ## look 0 and 0.8 cps = fzeros(f', -4, 4) # finds both
2-element Array{Float64,1}: 0.0 0.8
There are two critical points found.
plot(f', -.5, 1) # can tell -- big skip - to + at 0; change of sign at 1
The critical point at $x=0$ is not where the derivative is $0$, but rather undefined. No matter to the first derivative test – the derivative changes sign at $x=0$ from negative to postive, so this will be a relative minium. At $x = 0.8$, as the derivative changes sign from positive to negative, we have a relative maximum.
The second derivative test is not conclusive at $x=0$, as the second derivative is neither positive or negative, but in this case undefined. The second derivative at $x=0.8$ being negative is no surprise, that value corresponds to a relative maximum.
map(f'', cps) # 0 is NaN
2-element Array{Float64,1}: NaN -1.79536
Finally graphing $f$ shows our analysis was correct:
plot(f, -1, 3) scatter!(cps, map(f, cps))