︠1dbcee2f-181a-4874-b0fa-47a85ea01896i︠ %html

Curve Properties

This worksheet will provide you with examples of code to:

︡f09fe4a3-216e-4143-81ed-d506df26cbf2︡{"html": "

Curve Properties

\n

This worksheet will provide you with examples of code to:

\n"}︡ ︠c7414f13-efc3-4cad-bee1-408021d2ddcei︠ %html

Using Rolle's Theorem and The Intermediate Value Theorem to show there is only one root.

Type in a function and a range of values (if $(-\infty,\infty)$, then put in two finite values).  The code below will evaluate the function at the endpoints of your interval (hopefully showing one value is positive while the other is negative). Then it will compute the derivative and find where it is zero.  If the derivative is never zero on the interval, then you immediately know that the function cannot have two zeros, otherwise Rolle's theorem would require that $f'=0$ somewhere on the interval.

︡3db3ffc5-866b-4668-9887-109a153197f1︡{"html": "

Using Rolle's Theorem and The Intermediate Value Theorem to show there is only one root.

\n

Type in a function and a range of values (if $(-\\infty,\\infty)$, then put in two finite values).  The code below will evaluate the function at the endpoints of your interval (hopefully showing one value is positive while the other is negative). Then it will compute the derivative and find where it is zero.  If the derivative is never zero on the interval, then you immediately know that the function cannot have two zeros, otherwise Rolle's theorem would require that $f'=0$ somewhere on the interval.

"}︡ ︠bca9a491-08df-4c2e-955e-027ee87afaff︠ f(x)=x^3+3*x+2 xrange=(-10,10) Df=diff(f,x) html.table([ ["f",f(x)], ["f at left endpoint", f(xrange[0])], ["f at right endpoint", f(xrange[1])], ["f'",Df(x)==Df(x).factor()], ["f'=0",solve(Df(x)==0,x)], ["Graph",plot(f,xrange)] ]) ︡6150f112-7529-410f-bbfd-870d1c3919bc︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
fx^{3} + 3 \\, x + 2
f at left endpoint-1028
f at right endpoint1032
f'3 \\, x^{2} + 3 = 3 \\, x^{2} + 3
f'=0\\text{[\nx == -I,\nx == I\n]}
Graph
\n
\n"}︡ ︠d84f5f30-3a1d-4add-84bc-e63ce0cb5560i︠ %html

The Mean Value Theorem

Recall that the mean value theorem guarantees the existence of a value $c$ in the interval $(a,b)$ such that $$f'(c)=\frac{f(b)-f(a)}{b-a}.$$ The code below will help you find that value of $c$.

︡9ad21743-ef25-45bb-8f18-1b2452a24e64︡{"html": "

The Mean Value Theorem

\n

Recall that the mean value theorem guarantees the existence of a value $c$ in the interval $(a,b)$ such that $$f'(c)=\\frac{f(b)-f(a)}{b-a}.$$ The code below will help you find that value of $c$.

"}︡ ︠df964bb7-01e3-4e1f-8e69-366abbe71c39︠ f(x)=x^3-3*x xrange=(-3,3) Df=diff(f,x) a=xrange[0] #grab the left endpoint b=xrange[1] #grab the right endpoint m=(f(b)-f(a))/(b-a) #use m to simplify typing the average slope sol=solve(Df(x)==m,x) #find where f'(c)=m p=plot(f,xrange) #plot f p+=plot(f(a)+m*(x-a),xrange,color='green') #add the line connecting the endpoints sols=[] #Get rid of solutions not in [a,b], and graph them. for cp in sol: c=x.subs_expr(cp) if(c>a): if(c\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
fx^{3} - 3 \\, x
f'3 \\, x^{2} - 3
m=(f(b)-f(a))/(b-a)6
c such that f'(c)=m\\left[x = -\\sqrt{3}, x = \\sqrt{3}\\right]
Graph
\n\n"}︡ ︠9df3abe9-0b85-4bdd-b0c3-54378cafdcdfi︠ %html

The code can be much shorter, but then the output is not as nice.

︡07a16425-36b3-493d-8a1b-4edd0a1cfd98︡{"html": "

The code can be much shorter, but then the output is not as nice.

"}︡ ︠e52e4191-aef4-4598-af90-0addef70fc38︠ f(x)=x^3-3*x xrange=(-3,3) Df=diff(f,x) a=xrange[0] b=xrange[1] m=(f(b)-f(a))/(b-a) sol=solve(Df(x)==m,x) sol ︡aad188ef-f18f-4e6c-becd-9b8f51f378b5︡{"stdout": "[x == -sqrt(3), x == sqrt(3)]"}︡ ︠c4bff321-149e-4283-9282-e16fc2721921i︠ %html

Antiderivatives

To compute antiderivatives (indefinite integrals), use the integrate command. Notice that the computer does not include the $+C$. You have to do that yourself.

︡e0d52cdd-17a8-4949-9d0b-80ea1e8bebe2︡{"html": "

Antiderivatives

\n

To compute antiderivatives (indefinite integrals), use the integrate command. Notice that the computer does not include the $+C$. You have to do that yourself.

"}︡ ︠51fc7347-58b9-4da9-8618-9a4df3d4ce26︠ integrate(x^2,x) ︡730ad452-19cb-413b-a897-4b43e3164422︡{"stdout": "1/3*x^3"}︡ ︠25972b39-4839-48bd-8222-bf1b8914e6c8︠ f=x^2-sqrt(x)+sin(4*x)-1/(1+x^2) integrate(f,x).show() ︡6c1adc90-e975-4734-81dc-904a05534b73︡{"html": "
\\frac{1}{3} \\, x^{3} - \\frac{2}{3} \\, x^{\\left(\\frac{3}{2}\\right)} - \\frac{1}{4} \\, \\cos\\left(4 \\, x\\right) - \\arctan\\left(x\\right)
"}︡ ︠9c4e1b6a-69aa-4e48-ac05-1bf55d9246d7i︠ %html

Position from Velocity

If you know the velocity of an object, then all you have to do is integrate to find the position. If the initial position is $s_0$ at time $t_0$, then you can replace each $s$ with $s_0$ and $t$ with $t_0$ to find the constant $C$ from integration.

︡a0911a79-8717-4a97-b444-1de9f5fc6c5e︡{"html": "

Position from Velocity

\n

If you know the velocity of an object, then all you have to do is integrate to find the position. If the initial position is $s_0$ at time $t_0$, then you can replace each $s$ with $s_0$ and $t$ with $t_0$ to find the constant $C$ from integration.

"}︡ ︠72205de7-141a-4bb5-a460-427437806f5f︠ var('t,s,v,C') v=t^2+exp(t) t0=0 s0=2 s=integrate(v,t)+C sol=solve(s(t=t0)==s0,C) html.table([ ["a",a], ["v",v], ["s = integral of v",s], ["[t0,s0]",[t0,s0]], ["Equation to find C",s0==s(t=t0)], ["s",s.subs_expr(sol[0])] ]) ︡5804a527-185c-42e9-9db3-82e89418b3bc︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
a-3
vt^{2} + e^{t}
s = integral of v\\frac{1}{3} \\, t^{3} + C + e^{t}
[t0,s0]\\left[0, 2\\right]
Equation to find C2 = C + 1
s\\frac{1}{3} \\, t^{3} + e^{t} + 1
\n
\n"}︡ ︠0c67a543-b8f4-4ea2-98df-3f6a4ee7664fi︠ %html

Position from Acceleration

If you know the acceleration at any time $t$, as well as the velocity and position at a single time $t$, then you can use the following code to find equations for the velocity and position.  The table output at the end shows all the work involved.

︡9de9933a-f3e1-4615-b98d-5906efb0600c︡{"html": "

Position from Acceleration

\n

If you know the acceleration at any time $t$, as well as the velocity and position at a single time $t$, then you can use the following code to find equations for the velocity and position.  The table output at the end shows all the work involved.

"}︡ ︠34ed5e58-fe9f-440f-84ad-e3e3a70f045a︠ var('t,s,v,a,C,D') #we have to start by defining our variables a=t^2+exp(t) t0=0 s0=2 v0=3 #Find v first. v=integrate(a,t)+C solC=solve(v(t=t0)==v0,C) vn=v.subs_expr(solC[0]) #Now find s. s=integrate(vn,t)+D solD=solve(s0==s(t=t0),D) sn=s.subs_expr(solD[0]) #Now format the output to look really nice. html.table([ ["a",a], ["v = integral of a",v], ["[t0,v0]",[t0,v0]], ["Equation to find C",v0==v(t=t0)], ["v",vn], ["s = integral of v",s], ["[t0,s0]",[t0,s0]], ["Equations to find D",s0==s(t=t0)], ["s",sn] ]) ︡788ff83c-8118-4cdb-875a-4f200b708b34︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
at^{2} + e^{t}
v = integral of a\\frac{1}{3} \\, t^{3} + C + e^{t}
[t0,v0]\\left[0, 3\\right]
Equation to find C3 = C + 1
v\\frac{1}{3} \\, t^{3} + e^{t} + 2
s = integral of v\\frac{1}{12} \\, t^{4} + D + 2 \\, t + e^{t}
[t0,s0]\\left[0, 2\\right]
Equations to find D2 = D + 1
s\\frac{1}{12} \\, t^{4} + 2 \\, t + e^{t} + 1
\n
\n"}︡ ︠d989a0e3-bf76-4f24-a89e-01b53a5ab838i︠ %html

Differentials

The derivative gives us the slope of a tangent line.  If you increase the $x$ value of a function from $x$ to $x+dx$, then how much does the $y$ value increase?  The notation $\dfrac{dy}{dx}=f'(x)$ suggests that we can find a small change in $y$ by multiplying both sides by $dx$ to obtain the differential $$dy = f'(x)dx.$$ Think of $dy$ as a small change in $y$.  Think of $dx$ as a small change in $dx$.  The quantities $dy$ and $dx$ are called differentials. You can use differentials to estimate how much $y$ will change if $x$ changes by $dx$. The example below illustates how to do this.  In high dimensional calculus, the differentials become vectors and the derivative becomes a matrix. This differential equation is the key equation needed to extend calculus to higher dimensions.

︡f4d046bb-7913-4b8d-a2f9-e42fbb8d2a58︡{"html": "

Differentials

\n

The derivative gives us the slope of a tangent line.  If you increase the $x$ value of a function from $x$ to $x+dx$, then how much does the $y$ value increase?  The notation $\\dfrac{dy}{dx}=f'(x)$ suggests that we can find a small change in $y$ by multiplying both sides by $dx$ to obtain the differential $$dy = f'(x)dx.$$ Think of $dy$ as a small change in $y$.  Think of $dx$ as a small change in $dx$.  The quantities $dy$ and $dx$ are called differentials. You can use differentials to estimate how much $y$ will change if $x$ changes by $dx$. The example below illustates how to do this.  In high dimensional calculus, the differentials become vectors and the derivative becomes a matrix. This differential equation is the key equation needed to extend calculus to higher dimensions.

"}︡ ︠92c2f6fe-9978-41cc-bb51-1d32f01fd58a︠ var('x,dx') f=x^2 dy=diff(f)*dx dy ︡7b90d421-7b0a-43e6-983d-2456c3a7b8ec︡{"stdout": "2*dx*x"}︡ ︠79b3acd8-0c29-43a3-be9a-28abcf62a08a︠ xvalue=2 dx=1/2 dy(x=xvalue,dx=dx) ︡561c7995-9859-45a1-847c-75bad8d23357︡{"stdout": "2"}︡ ︠98284601-af25-45be-834b-07920930310ei︠ %html

The picture below illustrates graphically how the differential comes from using the tangent line to approximate a function.

︡ed38f5b4-2686-4a97-a7da-95e56a069d30︡{"html": "

The picture below illustrates graphically how the differential comes from using the tangent line to approximate a function.

"}︡ ︠095c57aa-27ac-4ca8-bfbd-2ec19e14da28︠ xrange=(x,xvalue-2*dx,xvalue+2*dx) p=plot(f,xrange) p+=point((xvalue,f(x=xvalue)),pointsize=30) p+=plot(f(x=xvalue)+diff(f)(x=xvalue)*(x-xvalue),xrange,color='red') p+=line([(xvalue,f(x=xvalue)),(xvalue+dx,f(x=xvalue))],rgbcolor='purple') p+=line([(xvalue+dx,f(x=xvalue)),(xvalue+dx,f(x=xvalue)+dy(x=xvalue,dx=dx))],rgbcolor='purple') p+=line([(xvalue,f(x=xvalue)),(xvalue,f(x=xvalue+dx))],rgbcolor='green') p+=line([(xvalue,f(x=xvalue+dx)),(xvalue+dx,f(x=xvalue+dx))],rgbcolor='green') p+=point((xvalue+dx,f(x=xvalue)+dy(x=xvalue,dx=dx)),rgbcolor='purple',pointsize=20) p+=point((xvalue+dx,f(x=xvalue+dx)),rgbcolor='green',pointsize=20) p.show() ︡d53ef9d1-6eca-4029-8a03-e8a0290e2753︡{"html": ""}︡ ︠0d2a4e6f-b054-4e91-8ec8-f0578bc8c3f0i︠ %html

The code below illustrates numerically how $dy$ is approximately the same as $\Delta y = f(x+dx)-f(x)$.

︡6f570f2a-2ab1-4c39-b6eb-0ab62c2542ee︡{"html": "

The code below illustrates numerically how $dy$ is approximately the same as $\\Delta y = f(x+dx)-f(x)$.

"}︡ ︠8c584f00-8af0-4fb0-8a23-b374a0e809a5︠ var('x,dx') f(x)=x^2 xValue=1 dxValue=.01 Df=diff(f,x) dy=Df(x)*dx html.table([ ["f",f(x)], ["f'",Df(x)], ["dy",dy], ["dy evaluated at x and dx",dy(x=xValue,dx=dxValue).n()], ["f at the x value",f(xValue)], ["f at x+dx",f(xValue+dxValue)], ["The actual change in y",f(xValue+dxValue)-f(xValue)], ["The approximate change in y = dy",dy(x=xValue,dx=dxValue).n()], ]) ︡805aa9f4-da96-4c9f-9dd3-ec79dc93f41f︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
fx^{2}
f'2 \\, x
dy2 \\, \\mbox{dx} x
dy evaluated at x and dx0.0200000000000000
f at the x value1
f at x+dx1.02010000000000
The actual change in y0.0201000000000000
The approximate change in y = dy0.0200000000000000
\n
\n"}︡ ︠dbf629ba-36f2-4aab-9c70-a5bddae83224i︠ %html

The linearization of $f(x)$ is just another name for the tangent line.  The code below compute the linearization of $(1+x)^k$ for any real number $k$.

︡5eb7f4bf-9ccb-45ce-86db-318a50b102af︡{"html": "

The linearization of $f(x)$ is just another name for the tangent line.  The code below compute the linearization of $(1+x)^k$ for any real number $k$.

"}︡ ︠b54f3b73-a3d6-4f3a-b98d-243745c0f174︠ var('k') f(x)=(1+x)^k c=0 Df=diff(f,x) L(x)=f(c)+Df(c)*(x-c) L(x) ︡4836f758-8e6d-4cf9-a598-0f35b54a339c︡{"stdout": "k*x + 1"}︡ ︠59392a64-1eed-4479-b484-19820a9c2442i︠ %html

L'Hopital's Rule

If you cannot find a limit because it is of the form $\dfrac{0}{0}$ or $\dfrac{\infty}{\infty}$, then L'Hopital's rule can often help.  The idea is to take the derivative of the top and bottom separately, and then find the limit.  If is exists, then the original limit equals the limit you found.  You can repeat this as many times as needed, provide at each stage the limit is still of the form $\dfrac{0}{0}$ or $\dfrac{\infty}{\infty}$. The example below illustrates this process for $\dfrac{1-\cos(x)}{x^2}$. Notice that after putting in zero in the top and bottom in both the original and after taking derivatives, you get 0/0 in both cases. Only after 2 derivatives do you get 1/2.

︡bfad95ac-4feb-4bf1-9cba-4511af96ab35︡{"html": "

L'Hopital's Rule

\n

If you cannot find a limit because it is of the form $\\dfrac{0}{0}$ or $\\dfrac{\\infty}{\\infty}$, then L'Hopital's rule can often help.  The idea is to take the derivative of the top and bottom separately, and then find the limit.  If is exists, then the original limit equals the limit you found.  You can repeat this as many times as needed, provide at each stage the limit is still of the form $\\dfrac{0}{0}$ or $\\dfrac{\\infty}{\\infty}$. The example below illustrates this process for $\\dfrac{1-\\cos(x)}{x^2}$. Notice that after putting in zero in the top and bottom in both the original and after taking derivatives, you get 0/0 in both cases. Only after 2 derivatives do you get 1/2.

"}︡ ︠6fdf3d90-55d6-4da0-840b-08573efad014︠ f(x) = (1-cos(x))/x^2 c=0 num=numerator(f(x)) den=denominator(f(x)) html.table([ ["top",num,limit(num,x=c),"bottom",den,limit(den,x=c)], ["top",diff(num),limit(diff(num),x=c),"bottom",diff(den),limit(diff(den),x=c)], ["top",diff(num,2),limit(diff(num,2),x=c),"bottom",diff(den,2),limit(diff(den,2),x=c)], ]) limit(f(x),x=c) ︡806d4fde-38c8-4ab9-9a33-f924fda4c121︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
top-\\cos\\left(x\\right) + 10bottomx^{2}0
top\\sin\\left(x\\right)0bottom2 \\, x0
top\\cos\\left(x\\right)1bottom22
\n
\n"}︡{"stdout": "1/2"}︡ ︠7d303d77-3789-4f8b-8d0e-b2aa95b959a0i︠ %html

You can also use this rule when $c=\infty$. In the example below, the second line gives $\dfrac{0}{1}=0$, so you not take 2 derivatives.

︡009bce8d-387a-4a75-b4a0-3cbbe692d796︡{"html": "

You can also use this rule when $c=\\infty$. In the example below, the second line gives $\\dfrac{0}{1}=0$, so you not take 2 derivatives.

"}︡ ︠b9994e33-f29b-49ed-9b88-154e7da4d483︠ f(x) = log(x)/x c=infinity num=numerator(f(x)) den=denominator(f(x)) html.table([ ["top",num,limit(num,x=c),"bottom",den,limit(den,x=c)], ["top",diff(num),limit(diff(num),x=c),"bottom",diff(den),limit(diff(den),x=c)], ["top",diff(num,2),limit(diff(num,2),x=c),"bottom",diff(den,2),limit(diff(den,2),x=c)], ]) limit(f(x),x=c) ︡c99997eb-819c-4435-af54-86e1f64a4911︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
top\\ln\\left(x\\right)+\\inftybottomx+\\infty
top\\frac{1}{x}0bottom11
top-\\frac{1}{x^{2}}0bottom00
\n
\n"}︡{"stdout": "0"}︡