Skip to content

add sage images for DF #419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed source/calculus/assets/coop.jpg
Binary file not shown.
131 changes: 39 additions & 92 deletions source/calculus/source/02-DF/01.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -131,26 +131,12 @@
</p>
<figure>
<image width="50%" xml:id="graph-parabola">
<latex-image>
\begin{tikzpicture}[scale=1]
\begin{axis}[
axis lines=middle,
grid=major,
xmin=0, xmax=6,
ymin=-2, ymax=5,
xtick={0,0.5,...,6},
ytick={-2,-1.5,...,7},
tick style={thick},
% x label style={at={(axis description cs:1,0.7)}},
% y label style={at={(axis description cs:0.4,1)}},
ylabel=$y$,
xlabel=$x$,
]
\addplot[domain=0:6, blue, ultra thick] {0.5*x^2-2};
\end{axis}
\end{tikzpicture}

</latex-image>
<sageplot>
x = var('x')
f = 0.5*x^2 - 2
p = plot(f, (x,0,4), ymax = 5, gridlines=True, axes_labels=('$x$','$g(x)$'), thickness=2, aspect_ratio=.5)
p
</sageplot>
</image>
<caption>The graph of <m> g(x)</m></caption>
</figure>
Expand Down Expand Up @@ -276,26 +262,12 @@
<p> In this activity you will study the abolute value function <m>f(x)=|x|</m>. The absolute value function is a piecewise defined function which outputs <m>x</m> when <m>x</m> is positive (or zero) and outputs <m>-x</m> when <m>x</m> is negative. So the absolute value always outputs a number which is positive (or zero). Here is the graph of this function. </p>
<figure>
<image width="50%" xml:id="graph-absolute-value">
<latex-image>
\begin{tikzpicture}[scale=1]
\begin{axis}[
axis lines=middle,
grid=major,
% xmin=-10, xmax=10,
% ymin=-5, ymax=8,
xtick={-4,-3,...,4},
ytick={0,1,...,4},
tick style={thick},
% x label style={at={(axis description cs:1,0.7)}},
% y label style={at={(axis description cs:0.4,1)}},
ylabel=$y$,
xlabel=$x$,
]
\addplot[domain=-4:4, blue, thick] {abs(x)};
\end{axis}
\end{tikzpicture}

</latex-image>
<sageplot>
x = var('x')
f = abs(x)
p = plot(f,(x,-4,4), gridlines=True, axes_labels=('$x$','$f(x)$'), thickness=2, aspect_ratio=2)
p
</sageplot>
</image>
<caption>The graph of <m> |x|</m></caption>
</figure>
Expand Down Expand Up @@ -333,33 +305,22 @@
<p>Consider the graph of function <m>h(x)</m>. </p>
<figure xml:id = "nice-piecewise-graph">
<image width="50%" xml:id="graph-derivative-features">
<latex-image>
\begin{tikzpicture}[scale=1]
\begin{axis}[
axis lines=middle,
grid=major,
xtick={-2,-1,...,7},
ytick={-2,-1,...,4},
ymin=-1.2, ymax=1.2,
tick style={thick},
% x label style={at={(axis description cs:1,0.7)}},
% y label style={at={(axis description cs:0.4,1)}},
ylabel=$y$,
xlabel=$x$,
]
\addplot[domain=-2:1, blue, ultra thick] {(1/3)*(x)-1/3};
\addplot[domain=1:5, blue, ultra thick] {0.0625*(x-5)^2-1};
\addplot[domain=5:7, blue, ultra thick] {(x-6)^2 };
\addplot [only marks, blue] table {
5 1 \\
1 1 \\
};
\draw[fill=white, draw=blue](axis cs:1,0) circle(1mm);
\draw[fill=white, draw=blue](axis cs:5,-1) circle(1mm);
\end{axis}
\end{tikzpicture}

</latex-image>
<sageplot>
x = var('x')
f1 = 5*(1/3)*(x-1)
f2 = 5*0.0625*(x-5)^2-5
f3 = 5*(x-6)^2
p1 = plot(f1, (x,-2,1), gridlines=True, axes_labels=('$x$','$h(x)$'), thickness=2)
p2 = plot(f2, (x,1,5), gridlines=True, axes_labels=('$x$','$h(x)$'), thickness=2)
p3 = plot(f3, (x,5,7), gridlines=True, axes_labels=('$x$', '$h(x)$'), thickness=2)
c1 = circle((1,0), 0.1, fill=True, thickness=1, facecolor='white')
c2 = circle((1,5), 0.1, fill=True, thickness=1, facecolor='blue')
c3 = circle((5,-5), 0.1, fill=True, thickness=1, facecolor='white')
c4 = circle((5,5), 0.1, fill=True, thickness=1, facecolor='blue')
p = p1+p2+p3
c = c1+c2+c3+c4
p+c
</sageplot>
</image>
<caption>The graph of <m> h(x)</m>.</caption>
</figure>
Expand Down Expand Up @@ -445,31 +406,17 @@ The rate of change of <m>f(x)</m> when <m>x=-1</m> is positive

<introduction>
<p>You are given the graph of the function <m>f(x)</m>.</p>
<figure>
<image width="50%" xml:id="graph-tangent-line-estimate">
<latex-image>
\begin{tikzpicture}[scale=1]
\begin{axis}[
axis lines=middle,
grid=major,
% xmin=-10, xmax=10,
% ymin=-5, ymax=8,
xtick={-1,-0.5,...,3},
ytick={-7,-6,...,1},
tick style={thick},
% x label style={at={(axis description cs:1,0.7)}},
% y label style={at={(axis description cs:0.4,1)}},
ylabel=$y$,
xlabel=$x$,
]
\addplot[domain=-1:3, blue, thick] {-x^2+2};
\end{axis}
\end{tikzpicture}

</latex-image>
</image>
<caption>The graph of <m> f(x)</m></caption>
</figure>
<figure>
<image width="50%" xml:id="graph-tangent-line-estimate">
<sageplot>
x = var('x')
f = -x^2+2
p = plot(f,(x,-1,3), gridlines=True, thickness=2, axes_labels=('$x$','$f(x)$'), aspect_ratio=.5)
p
</sageplot>
</image>
<caption>The graph of <m> f(x)</m></caption>
</figure>
</introduction>
<task> <p> Using the graph, estimate the slope of the tangent line at <m>x=2</m>. Make sure you can carefully describe your process for obtaining this estimate! </p>
</task>
Expand Down
62 changes: 24 additions & 38 deletions source/calculus/source/02-DF/05.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -122,44 +122,30 @@
<activity xml:id="chain-rule-practice-graphs">
<introduction> <p>Below you are given the graphs of two functions: <m>a(x)</m> and <m>b(x)</m>. Use the graphs to compute vaules of composite functions and of their derivatives, when possible (there are points where the derivative of these functions is not defined!). Notice that to compute the derivative at a point, you first want to find the derivative as a function of <m>x</m> and then plug in the input you want to study. </p>
<figure>
<image xml:id="graph-chain-rule-practice">
<latex-image>
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
xmin=-5,xmax=5,ymin=-3,ymax=3,
% xtick={-6.28, -4.71,...,6.28},
% ytick={-4, -3,...,4},
% xticklabels={$-2\pi$, $-3\pi/2$, $-\pi$ , $-\pi/2$, 0 , $\pi/2$, $\pi$, $3\pi/2$, $-2\pi$},
xlabel={$x$},
ylabel={$y$}
]
\addplot[domain=-4:-0.1,blue, ultra thick,samples=500] {-2} ;
\addplot[domain=0:4,blue,ultra thick, samples=500] {2} ;
\addplot [only marks, blue] coordinates {(0,2)};
\addplot [only marks, blue, mark=o] coordinates {(0,-2)};
\addplot[mark=none, color=blue, nodes near coords={$a(x)$}] coordinates {(-4,2)};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
xmin=-5,xmax=5,ymin=-3,ymax=3,
% xtick={-6.28, -4.71,...,6.28},
% ytick={-4, -3,...,4},
% xticklabels={$-2\pi$, $-3\pi/2$, $-\pi$ , $-\pi/2$, 0 , $\pi/2$, $\pi$, $3\pi/2$, $-2\pi$},
xlabel={$x$},
ylabel={$y$}
]
\addplot[domain=-4:0,blue, ultra thick, samples=500] {2+x} ;
\addplot[domain=0:4,blue, ultra thick, samples=500] {2-x} ;
\addplot[mark=none, color=blue, nodes near coords={$b(x)$}] coordinates {(4,2)};
\end{axis}
\end{tikzpicture}
</latex-image>
</image>
<caption>The graphs of <m> a(x)</m> and <m> b(x)</m></caption>
</figure>
<sidebyside widths="50% 50%">
<image xml:id="graph-chain-rule-practice-img1">
<sageplot>
x = var('x')
f = 2*sgn(x)
p1 = plot(f,(x,-4,-0.05), gridlines=True, axes_labels=('$x$','$a(x)$'), thickness=2)
p2 = plot(f,(x,.05,4), gridlines=True, axes_labels=('$x$','$a(x)$'), thickness=2)
c1 = circle((0,-2),0.05,fill=True,facecolor='white',thickness=1)
c2 = circle((0,2),0.05, fill=True,facecolor='blue', thickness=1)
p1+p2+c1+c2
</sageplot>
</image>
<image xml:id="graph-chain-rule-practice-img2">
<sageplot>
x = var('x')
f = -2*abs(x)+2
p = plot(f,(x,-4,4),gridlines=True,thickness=2,axes_labels=('$x$','$b(x)$'), aspect_ratio=.5)
p
</sageplot>
</image>
</sidebyside>

<caption>The graphs of <m> a(x)</m> and <m> b(x)</m></caption>
</figure>
</introduction>
<task>
<p> Notice that the derivative of <m>a \circ b</m> is given by <m>a'(b(x)) \cdot b'(x)</m>, so the derivative of <m>a \circ b</m> at <m> x= 4</m> is given by the quantity <m>a'(b(4)) \cdot b'(4) = a'(-2) \cdot b'(4)</m>, because <m>b(4)=-2</m>. Using the graphs to compute slopes, what is the derivative of <m>a \circ b</m> at <m> x= 4</m>? </p>
Expand Down
33 changes: 28 additions & 5 deletions source/calculus/source/02-DF/07.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@
<p>The curve given in <xref ref = "figure-derivative-implicit2"/> is an example of an astroid. The equation of this astroid is <m>x^{2/3} + y^{2/3} = 3^{2/3}</m>. What is the derivative with respect <m>x</m> for this astroid? (Solve for <m>\dfrac{dy}{dx}</m>).</p>
</introduction>
<figure xml:id="figure-derivative-implicit2">
<image width="70%" source="derivative_implicit2_graph.png" />
<caption>Graph of <m>x^{2/3} + y^{2/3} = 3^{2/3}</m>.</caption>
<image width="70%">
<sageplot>
x = var('x')
p = parametric_plot((3*(cos(x))^3,3*(sin(x))^3), (x,0,2*pi),thickness=2, axes_labels=('$x$','$y$'))
p
</sageplot>
</image>
<caption>Graph of <m>x^{2/3} + y^{2/3} = 3^{2/3}</m>.</caption>
</figure>
<ol marker="A." cols="2">
<li><p><m>\frac{dy}{dx} = \frac{x^{-1/3}}{y^{-1/3}}</m></p></li>
Expand All @@ -82,8 +88,14 @@
<p>An example of a lemniscate is given in <xref ref = "figure-derivative-implicit3"/>. The equation of this lemniscate is <m>(x^{2} + y^{2})^2 = x^2 - y^2</m>. What is the derivative with respect <m>x</m> for this lemniscate? (Solve for <m>\dfrac{dy}{dx}</m>).</p>
</introduction>
<figure xml:id="figure-derivative-implicit3">
<image width="70%" source="derivative_implicit3_graph.png" />
<caption>Graph of <m>(x^{2} + y^{2})^2 = x^2 - y^2</m>.</caption>
<image width="70%">
<sageplot>
x = var('x')
p = parametric_plot((cos(x)/(1+(sin(x))^2),(cos(x)*sin(x))/(1+(sin(x))^2)),(x,0,2*pi),thickness=2,axes_labels=('$x$','$y$'))
p
</sageplot>
</image>
<caption>Graph of <m>(x^{2} + y^{2})^2 = x^2 - y^2</m>.</caption>
</figure>
<ol marker="A." cols="2">
<li><p><m>\frac{dy}{dx} = \frac{x(1-2(x^2+y^2))}{y+2(x^2+y^2)}</m></p></li>
Expand Down Expand Up @@ -127,7 +139,18 @@ Explain how to use implicit differentiation to find
<introduction>
Valerie is building a square chicken coop with side length <m>x</m>. Because she needs a separate place for the rooster, she needs to put fence around the square and also along the diagonal line shown. The fence costs $20 per linear meter, and she has a budget of $900.
<figure xml:id="figure-chicken-coop">
<image width="50%" source="coop.jpg" />
<image width="50%">
<sageplot>
sq = polygon([(-1,-1),(-1,1),(1,1),(1,-1)], fill=False, axes=False, color='black',thickness=2)
a = arc((1,1),1, sector=(pi,pi+.36),color='black')
tri = polygon([(-1,1),(-1,0.25),(1,1)],thickness=2,alpha = 0.5, color='grey',edgecolor='black')
l = line([(-1,.25),(1,1)],color='black')
x1 = text('$x$', (1.1,0), fontsize=20, color='black')
x2 = text('$x$', (0,-1.1), fontsize=20, color='black')
y = text('$y$', (-.1,.8), fontsize=20, color='black')
sq+a+tri+x1+x2+y+l
</sageplot>
</image>
<caption> A diagram of the chicken coop.</caption>
</figure>
</introduction>
Expand Down
Loading
Loading