diff --git a/source/calculus/source/03-AD/02.ptx b/source/calculus/source/03-AD/02.ptx
index d8a6c2d12..876b9a7e2 100644
--- a/source/calculus/source/03-AD/02.ptx
+++ b/source/calculus/source/03-AD/02.ptx
@@ -51,43 +51,16 @@ Notice that this is obtained by writing the tangent line to f(x) at (a
Sketch the tangent line L(x) on the same plane as the graph of \ln(x) . What do you notice?
-
-
-\begin{minipage}{\textwidth}
-\begin{center}
- \begin{tikzpicture}[scale=0.9]
-\begin{axis}[
- axis lines=middle,
- grid=major,
- xmin=0, xmax=5,
- ymin=-2, ymax=2,
- % xtick={0,10,...,80},
- % ytick={0,10,...,50},
- % yticklabels={0, 0.01, 0.02, 0.03, 0.04, 0.05},
- 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.1:5, blue, ultra thick] {ln(x)} node [pos=0.8,above left , ultra thick] {$\boldsymbol{\ln(x)}$};
-% \addplot [only marks, blue] table {
-% 40 20
-% };
-% \addplot[only marks, color=blue, nodes near coords={$(40,20)$}] coordinates {(30,20)};
-% \addplot[domain=20:70, black, thick] {(x-40)+20} node [pos=0.6, below right, ultra thick] {$\boldsymbol{L(x)}$};
-% \addplot [only marks, black] table {
-% 20 0
-% };
-% \addplot[only marks, color=black, nodes near coords={$(20,0)$}] coordinates {(30,0)};
- \end{axis}
-\end{tikzpicture}
-\end{center}
- \end{minipage}
-
-
- The graph of \ln(x)
-
+
+
+ x = var('x')
+ f = ln(x)
+ p = plot(f,(x,0.1,5), gridlines=True, axes_labels=('$x$','$y$'), thickness=2, aspect_ratio = 1.25)
+ p
+
+
+ The graph of \ln(x)
+
diff --git a/source/calculus/source/03-AD/04.ptx b/source/calculus/source/03-AD/04.ptx
index 34c52f1c3..74c1afd7b 100644
--- a/source/calculus/source/03-AD/04.ptx
+++ b/source/calculus/source/03-AD/04.ptx
@@ -26,30 +26,15 @@
-
-
-\begin{tikzpicture}[scale=1]
-\begin{axis}[
- samples = 900,
- axis lines=middle,
- grid=major,
- % xmin=0, xmax=4,
- ymin=0, ymax=70,
- % xtick={0,0.5,...,4},
- % ytick={-2,-1,...,10},
- % tick style={thick},
-% x label style={at={(axis description cs:1,0.7)}},
-% y label style={at={(axis description cs:0.4,1)}},
- ylabel=$s(t)$,
- xlabel=$t$,
- ]
- \addplot[domain=0:3, blue, thick] {-16*x^2+32*x+48};
-\end{axis}
-\end{tikzpicture}
-
-
-
- The graph of s(t) = -16t^2 + 32t + 48
+
+
+ x = var('x')
+ f = -16*x^2+32*x+48
+ p = plot(f,(x,0,3), gridlines=True, axes_labels=('$t$','$s(t)$'), thickness=2, aspect_ratio = .05)
+ p
+
+
+ The graph of s(t) = -16t^2 + 32t + 48
@@ -101,22 +86,62 @@
For each of the following figures, decide where the global extrema are located.
-
-
-
+
+
+
+ x = var('x')
+ f = sin(x)
+ ticks = [[-pi/2, 0, pi/2, pi, 3*pi/2, 2*pi, 5*pi/2],[-1.5,-1,-0.5,0,0.5,1,1.5]]
+ p = plot(f,(x,0,2*pi), xmin = -pi/2, xmax = 5*pi/2, ymin = -1.5, ymax=1.5, ticks=ticks, tick_formatter=[pi,None], thickness=2, gridlines=True, aspect_ratio=1.5)
+ c1 = circle((0,0),0.05,fill=True)
+ c2 = circle((2*pi,0),0.05,fill=True)
+ p+c1+c2
+
+
+
-
+
-
+
+
+ x=var('x')
+ f(x) = exp(-x) + 1
+ p = plot(f,(x,0,3), ymin = -1, ymax = 3, gridlines=True, thickness=2, aspect_ratio=1)
+ q = plot(4,(x,-1,4), ymin=-1, ymax=3, gridlines=True, thickness=2, aspect_ratio=1)
+ c1 = circle((0,f(0)), 0.05, fill=True)
+ c2 = circle((3,f(3)),0.05, fill=True)
+ p+c1+c2+q
+
+
-
+
+
+ x=var('x')
+ f(x) = -x^3+2*x^2
+ c1 = circle((-0.5,f(-0.5)),0.05,fill=True)
+ c2 = circle((2.2,f(2.2)),0.05,fill=True)
+ p = plot(f,(x,-0.5,2.2),ymin=-2,ymax=2,thickness=2,gridlines=True,aspect_ratio=1)
+ q = plot(3,(x,-1,3),ymin=-2,ymax=2,aspect_ratio=1)
+ c1+c2+p+q
+
+
-
+
+
+ x=var('x')
+ f(x) = abs(-(x-1)^(1/3))
+ c1 = circle((0,f(0)),0.05,fill=True)
+ c2 = circle((3,f(3)),0.05,fill=True)
+ p = plot(f,(x,0,3),ymin=-1,ymax=2,thickness=2,gridlines=True,aspect_ratio=1)
+ q = plot(3,(x,-1,3.5),ymin=-1,ymax=2,aspect_ratio=1)
+ c1+c2+p+q
+
+
diff --git a/source/calculus/source/03-AD/06.ptx b/source/calculus/source/03-AD/06.ptx
index a781dd5dd..3a519e1a5 100644
--- a/source/calculus/source/03-AD/06.ptx
+++ b/source/calculus/source/03-AD/06.ptx
@@ -28,7 +28,36 @@
Three increasing functions
-
+
+
+
+ x = var('x')
+ f = 2*exp(4*x-3)
+ ticks=[[],[]]
+ p = plot(f,(x,.2,1), xmin = -10, xmax = 1, ymin = -1, ymax = 3, gridlines=True,thickness=2, ticks=ticks, aspect_ratio=.2)
+ p
+
+
+
+
+ x = var('x')
+ f = x+.75
+ ticks=[[],[]]
+ p = plot(f,(x,.05,1), xmin = -10, xmax = 1, ymin = -1, ymax = 3, gridlines=True,thickness=2, ticks=ticks, aspect_ratio=.25)
+ p
+
+
+
+
+ x = var('x')
+ f = (x-1.5)^3+2.5
+ ticks=[[],[]]
+ p = plot(f,(x,.25,1.25), ymin = -1, ymax = 3, gridlines=True,thickness=2, ticks=ticks, aspect_ratio=.25)
+ p
+
+
+
+
@@ -91,7 +120,35 @@
From left to right, three functions that are all decreasing.
-
+
+
+
+ x = var('x')
+ f = -(x-1.5)^3+.5
+ ticks=[[],[]]
+ p = plot(f,(x,.25,1.25), ymin = -1, ymax = 3, gridlines=True,thickness=2, ticks=ticks, aspect_ratio=.25)
+ p
+
+
+
+
+ x = var('x')
+ f = -2*x + 3
+ ticks = [[],[]]
+ p = plot(f, (x,.25, 1.25), ymin = -1, ymax = 3, gridlines=True, thickness=2, ticks=ticks, aspect_ratio = 0.25)
+ p
+
+
+
+
+ x = var('x')
+ f = -(x)^3+2.5
+ ticks=[[],[]]
+ p = plot(f,(x,.25,1.25), ymin = -1, ymax = 3, gridlines=True,thickness=2, ticks=ticks, aspect_ratio=.25)
+ p
+
+
+
@@ -148,12 +205,54 @@
Look at in . Which curve is concave up? Which one is concave down? Why? Try to explain using the graph!
-
- Two concavity, which is which?
-
-
+
+ Two concavities, which is which?
+
+
+
+ x = var('x')
+ f(x) = (x-1)^2 + 1
+ line1 = -3*(x+0.5)+f(-0.5)
+ line2 = -1*(x-0.5)+f(0.5)
+ line3 = (x-1.5)+f(1.5)
+ line4 = 3*(x-2.5)+f(2.5)
+ p1 = plot(f,(x,-1,3), ymin = 0, ymax = 6, gridlines=True,thickness=2, aspect_ratio=1)
+ p2 = plot(line1,(x,-.75,-.25), color="green", thickness=2.5)
+ p3 = plot(line2,(x,.25,.75), color="green", thickness=2.5)
+ p4 = plot(line3,(x,1.25,1.75), color="green", thickness=2.5)
+ p5 = plot(line4,(x,2.25,2.75), color="green", thickness=2.5)
+ c1 = circle((-.5,f(-.5)),0.1,fill=True,facecolor="red", aspect_ratio="automatic")
+ c2 = circle((.5,f(.5)),0.1,fill=True,facecolor="red", aspect_ratio="automatic")
+ c3 = circle((1.5,f(1.5)),0.1,fill=True,facecolor="red", aspect_ratio="automatic")
+ c4 = circle((2.5,f(2.5)),0.1,fill=True,facecolor="red", aspect_ratio="automatic")
+ p1+p2+p3+p4+p5+c1+c2+c3+c4
+
+
+
+
+ x = var('x')
+ f(x) = -(x-1)^2 +2
+ line1 = 3*(x+0.5)+f(-0.5)
+ line2 = 1*(x-0.5)+f(0.5)
+ line3 = -(x-1.5)+f(1.5)
+ line4 = -3*(x-2.5)+f(2.5)
+ p1 = plot(f,(x,-1,3), ymin = -3, ymax = 3, gridlines=True,thickness=2, aspect_ratio=1)
+ p2 = plot(line1,(x,-.75,-.25), color="green", thickness=2.5)
+ p3 = plot(line2,(x,.25,.75), color="green", thickness=2.5)
+ p4 = plot(line3,(x,1.25,1.75), color="green", thickness=2.5)
+ p5 = plot(line4,(x,2.25,2.75), color="green", thickness=2.5)
+ c1 = circle((-.5,f(-.5)),0.1,fill=True,facecolor="red", aspect_ratio="automatic")
+ c2 = circle((.5,f(.5)),0.1,fill=True,facecolor="red", aspect_ratio="automatic")
+ c3 = circle((1.5,f(1.5)),0.1,fill=True,facecolor="red", aspect_ratio="automatic")
+ c4 = circle((2.5,f(2.5)),0.1,fill=True,facecolor="red", aspect_ratio="automatic")
+ p1+p2+p3+p4+p5+c1+c2+c3+c4
+
+
+
+
+
-
+
diff --git a/source/calculus/source/03-AD/07.ptx b/source/calculus/source/03-AD/07.ptx
index e5d171a69..4ce56073e 100644
--- a/source/calculus/source/03-AD/07.ptx
+++ b/source/calculus/source/03-AD/07.ptx
@@ -21,10 +21,18 @@
Which of the following features best describe the curve graphed below?
-
+
-
-
+
+
+ x = var('x')
+ f = -(x)^3+2.5
+ ticks=[[],[]]
+ p = plot(f,(x,.25,1.25), ymin = -1, ymax = 3, gridlines=True,thickness=2, ticks=ticks, aspect_ratio=.25)
+ p
+
+
+
@@ -47,7 +55,15 @@
-
+
+
+ x = var('x')
+ f = (x-1.5)^3+2.5
+ ticks=[[],[]]
+ p = plot(f,(x,.25,1.25), ymin = -1, ymax = 3, gridlines=True,thickness=2, ticks=ticks, aspect_ratio=.25)
+ p
+
+
diff --git a/source/calculus/source/03-AD/08.ptx b/source/calculus/source/03-AD/08.ptx
index 5b2d04573..1f6ebe0c5 100644
--- a/source/calculus/source/03-AD/08.ptx
+++ b/source/calculus/source/03-AD/08.ptx
@@ -29,18 +29,252 @@
Which of the following diagrams best illustrates how the box is created?
-
- Square of side length 8 with square corners of side length x removed
+
+
+ # Import necessary library
+ from sage.plot.graphics import Graphics
+
+ # Define variables
+ x = 2
+ side_large_square = 8
+ side_small_square = 2
+ side_inner_square = side_large_square - 2 * side_small_square
+
+ # Create the large square
+ large_square = polygon2d([(0, 0), (side_large_square, 0),
+ (side_large_square, side_large_square),(0, side_large_square)], fill=True, color='lightgray', edgecolor="black")
+
+ # Create the inner square
+ inner_square = polygon2d([(x, x), (side_large_square - x, x), (side_large_square - x, side_large_square - x), (x, side_large_square - x)], fill=True, color='lightgray')
+ inner_square2 = polygon2d([(x,x), (side_large_square - x,x), (side_large_square - x, side_large_square -x), (x, side_large_square - x)], thickness=2, color='darkgray')
+
+ # Create the small squares (one corner example, replicate for all corners)
+ small_square_1 = polygon2d([(0, 0), (x, 0), (x, x), (0, x)], fill=True, color='gray', edgecolor="black")
+ small_square_2 = polygon2d([(side_large_square - x, 0), (side_large_square, 0), (side_large_square, x), (side_large_square - x, x)], fill=True, color='gray', edgecolor="black", )
+ small_square_3 = polygon2d([(0, side_large_square - x), (x, side_large_square - x), (x, side_large_square), (0, side_large_square)], fill=True, color='gray', edgecolor="black")
+ small_square_4 = polygon2d([(side_large_square - x, side_large_square - x), (side_large_square, side_large_square - x), (side_large_square, side_large_square), (side_large_square - x, side_large_square)], fill=True, color='gray', edgecolor="black")
+
+ line_above_small_square = line2d([(6, 8.5), (8, 8.5)], color='black')
+ side_label_line = line2d([(8.5,6), (8.5,2)], color="black")
+ lass1 = line2d([(6,8.25), (6,8.75)])
+ lass2 = line2d([(8,8.25), (8,8.75)])
+ sll1 = line2d([(8.25,6),(8.75,6)])
+ sll2 = line2d([(8.25,2),(8.75,2)])
+ label_side = text("8-2x", (9.1,4), fontsize=15,color='black')
+ label_x = text("x", (7,8.75), fontsize=15, color='black')
+
+ # Combine all parts into one graphic
+ geometry = Graphics()
+ geometry += large_square
+ geometry += inner_square
+ geometry += inner_square2
+ geometry += small_square_1
+ geometry += small_square_2
+ geometry += small_square_3
+ geometry += small_square_4
+ geometry += line_above_small_square
+ geometry += lass1
+ geometry += lass2
+ geometry += label_x
+ geometry += side_label_line
+ geometry += sll1
+ geometry += sll2
+ geometry += label_side
+
+ # Set axes and title
+ geometry.set_axes_range(-1, side_large_square + 1, -1, side_large_square + 1)
+ geometry.axes(False)
+
+ # Show the plot
+ geometry
+
-
+
+
+ # Import necessary library
+ from sage.plot.graphics import Graphics
+
+ # Define variables
+ x = 2
+ side_large_square = 8
+ side_small_square = 2
+ side_inner_square = side_large_square - 2 * side_small_square
+
+ # Create the large square
+ large_square = polygon2d([(0, 0), (side_large_square, 0),
+ (side_large_square, side_large_square),(0, side_large_square)], fill=True, color='lightgray', edgecolor="black")
+
+ # Create the inner square
+ inner_square = polygon2d([(x, x), (side_large_square - x, x), (side_large_square - x, side_large_square - x), (x, side_large_square - x)], fill=True, color='lightgray')
+ inner_square2 = polygon2d([(x,x), (side_large_square - x,x), (side_large_square - x, side_large_square -x), (x, side_large_square - x)], thickness=2, color='darkgray')
+
+ # Create the small squares (one corner example, replicate for all corners)
+ small_square_1 = polygon2d([(0, 0), (x, 0), (x, x), (0, x)], fill=True, color='gray', edgecolor="black")
+ small_square_2 = polygon2d([(side_large_square - x, 0), (side_large_square, 0), (side_large_square, x), (side_large_square - x, x)], fill=True, color='gray', edgecolor="black", )
+ small_square_3 = polygon2d([(0, side_large_square - x), (x, side_large_square - x), (x, side_large_square), (0, side_large_square)], fill=True, color='gray', edgecolor="black")
+ small_square_4 = polygon2d([(side_large_square - x, side_large_square - x), (side_large_square, side_large_square - x), (side_large_square, side_large_square), (side_large_square - x, side_large_square)], fill=True, color='gray', edgecolor="black")
+
+ line_above_small_square = line2d([(6, 8.5), (8, 8.5)], color='black')
+ side_label_line = line2d([(8.5,6), (8.5,2)], color="black")
+ lass1 = line2d([(6,8.25), (6,8.75)])
+ lass2 = line2d([(8,8.25), (8,8.75)])
+ sll1 = line2d([(8.25,6),(8.75,6)])
+ sll2 = line2d([(8.25,2),(8.75,2)])
+ label_side = text("8-x", (9,4), fontsize=15,color='black')
+ label_x = text("x", (7,8.75), fontsize=15, color='black')
+
+ # Combine all parts into one graphic
+ geometry = Graphics()
+ geometry += large_square
+ geometry += inner_square
+ geometry += inner_square2
+ geometry += small_square_1
+ geometry += small_square_2
+ geometry += small_square_3
+ geometry += small_square_4
+ geometry += line_above_small_square
+ geometry += lass1
+ geometry += lass2
+ geometry += label_x
+ geometry += side_label_line
+ geometry += sll1
+ geometry += sll2
+ geometry += label_side
+
+ # Set axes and title
+ geometry.set_axes_range(-1, side_large_square + 1, -1, side_large_square + 1)
+ geometry.axes(False)
+
+ # Show the plot
+ geometry
+
+
-
+
+
+ # Import necessary library
+ from sage.plot.graphics import Graphics
+
+ # Define variables
+ x = 2
+ side_large_square = 8
+ side_small_square = 2
+ side_inner_square = side_large_square - 2 * side_small_square
+
+ # Create the large square
+ large_square = polygon2d([(0, 0), (side_large_square, 0),
+ (side_large_square, side_large_square),(0, side_large_square)], fill=True, color='lightgray', edgecolor="black")
+
+ # Create the inner square
+ inner_square = polygon2d([(x, x), (side_large_square - x, x), (side_large_square - x, side_large_square - x), (x, side_large_square - x)], fill=True, color='lightgray')
+ inner_square2 = polygon2d([(x,x), (side_large_square - x,x), (side_large_square - x, side_large_square -x), (x, side_large_square - x)], thickness=2, color='darkgray')
+
+ # Create the small squares (one corner example, replicate for all corners)
+ small_square_1 = polygon2d([(0, 0), (x, 0), (x, x), (0, x)], fill=True, color='gray', edgecolor="black")
+ small_square_2 = polygon2d([(side_large_square - x, 0), (side_large_square, 0), (side_large_square, x), (side_large_square - x, x)], fill=True, color='gray', edgecolor="black", )
+ small_square_3 = polygon2d([(0, side_large_square - x), (x, side_large_square - x), (x, side_large_square), (0, side_large_square)], fill=True, color='gray', edgecolor="black")
+ small_square_4 = polygon2d([(side_large_square - x, side_large_square - x), (side_large_square, side_large_square - x), (side_large_square, side_large_square), (side_large_square - x, side_large_square)], fill=True, color='gray', edgecolor="black")
+
+ line_above_small_square = line2d([(6, 8.5), (8, 8.5)], color='black')
+ side_label_line = line2d([(8.5,6), (8.5,2)], color="black")
+ lass1 = line2d([(6,8.25), (6,8.75)])
+ lass2 = line2d([(8,8.25), (8,8.75)])
+ sll1 = line2d([(8.25,6),(8.75,6)])
+ sll2 = line2d([(8.25,2),(8.75,2)])
+ label_side = text("y", (8.75,4), fontsize=15,color='black')
+ label_x = text("x", (7,8.75), fontsize=15, color='black')
+
+ # Combine all parts into one graphic
+ geometry = Graphics()
+ geometry += large_square
+ geometry += inner_square
+ geometry += inner_square2
+ geometry += small_square_1
+ geometry += small_square_2
+ geometry += small_square_3
+ geometry += small_square_4
+ geometry += line_above_small_square
+ geometry += lass1
+ geometry += lass2
+ geometry += label_x
+ geometry += side_label_line
+ geometry += sll1
+ geometry += sll2
+ geometry += label_side
+
+ # Set axes and title
+ geometry.set_axes_range(-1, side_large_square + 1, -1, side_large_square + 1)
+ geometry.axes(False)
+
+ # Show the plot
+ geometry
+
+
-
+
+
+ # Import necessary library
+ from sage.plot.graphics import Graphics
+
+ # Define variables
+ x = 2
+ side_large_square = 8
+ side_small_square = 2
+ side_inner_square = side_large_square - 2 * side_small_square
+
+ # Create the large square
+ large_square = polygon2d([(0, 0), (side_large_square, 0),
+ (side_large_square, side_large_square),(0, side_large_square)], fill=True, color='lightgray', edgecolor="black")
+
+ # Create the inner square
+ inner_square = polygon2d([(x, x), (side_large_square - x, x), (side_large_square - x, side_large_square - x), (x, side_large_square - x)], fill=True, color='lightgray')
+ inner_square2 = polygon2d([(x,x), (side_large_square - x,x), (side_large_square - x, side_large_square -x), (x, side_large_square - x)], thickness=2, color='darkgray')
+
+ # Create the small squares (one corner example, replicate for all corners)
+ small_square_1 = polygon2d([(0, 0), (x, 0), (x, x), (0, x)], fill=True, color='gray', edgecolor="black")
+ small_square_2 = polygon2d([(side_large_square - x, 0), (side_large_square, 0), (side_large_square, x), (side_large_square - x, x)], fill=True, color='gray', edgecolor="black", )
+ small_square_3 = polygon2d([(0, side_large_square - x), (x, side_large_square - x), (x, side_large_square), (0, side_large_square)], fill=True, color='gray', edgecolor="black")
+ small_square_4 = polygon2d([(side_large_square - x, side_large_square - x), (side_large_square, side_large_square - x), (side_large_square, side_large_square), (side_large_square - x, side_large_square)], fill=True, color='gray', edgecolor="black")
+
+ line_above_small_square = line2d([(6, 8.5), (8, 8.5)], color='black')
+ side_label_line = line2d([(8.5,6), (8.5,2)], color="black")
+ lass1 = line2d([(6,8.25), (6,8.75)])
+ lass2 = line2d([(8,8.25), (8,8.75)])
+ sll1 = line2d([(8.25,6),(8.75,6)])
+ sll2 = line2d([(8.25,2),(8.75,2)])
+ label_side = text("8", (8.75,4), fontsize=15,color='black')
+ label_x = text("x", (7,8.75), fontsize=15, color='black')
+
+ # Combine all parts into one graphic
+ geometry = Graphics()
+ geometry += large_square
+ geometry += inner_square
+ geometry += inner_square2
+ geometry += small_square_1
+ geometry += small_square_2
+ geometry += small_square_3
+ geometry += small_square_4
+ geometry += line_above_small_square
+ geometry += lass1
+ geometry += lass2
+ geometry += label_x
+ geometry += side_label_line
+ geometry += sll1
+ geometry += sll2
+ geometry += label_side
+
+ # Set axes and title
+ geometry.set_axes_range(-1, side_large_square + 1, -1, side_large_square + 1)
+ geometry.axes(False)
+
+ # Show the plot
+ geometry
+
+
@@ -199,7 +433,43 @@
A rectangular parcel with a square end.
-
+
+
+ from sage.plot.graphics import Graphics
+ geometry = Graphics()
+ front_border=polygon2d([(0,0), (0,2), (2,2), (2,0)], fill=False,color='black',thickness=2)
+ right_border = polygon2d([(2,0), (2,2), (6,4),(6,2)],fill=False, color='black', thickness=2)
+ front_bottom = polygon2d([(0,0),(2,0),(2,1)],color='cyan',alpha=1)
+ front = polygon2d([(0,0),(2,1),(2,2),(0,2)],color='powderblue')
+ left_top = polygon2d([(0,2),(2,2),(4,3),(4,4)],color='powderblue')
+ right_top = polygon2d([(4,3),(4,4),(6,4)],color='powderblue')
+ back = polygon2d([(4,3),(6,4),(6,2),(4,2)],color='powderblue')
+ middle = polygon2d([(2,1),(2,2),(4,3),(4,2)],color='powderblue')
+ bottom = polygon2d([(2,0),(2,1),(4,2),(6,2)],color='cyan',axes=False)
+ dash1 = line(([(0,0),(2,1)]),linestyle='dashed',color='black',thickness=2)
+ dash2 = line(([(2,1),(4,2)]),linestyle='dashed',color='black',thickness=2)
+ dash3 = line(([(4,2),(6,2)]),linestyle='dashed',color='black',thickness=2)
+ dash4 = line(([(4,2),(4,4)]),linestyle='dashed',color='black',thickness=2)
+ topline1 = line(([(4,4),(6,4)]),color='black',thickness=2)
+ topline2 = line(([(0,2),(4,4)]),color='black',thickness=2)
+ geometry += dash1
+ geometry += dash2
+ geometry += dash3
+ geometry += dash4
+ geometry += topline1
+ geometry += topline2
+ geometry += front_bottom
+ geometry += front
+ geometry += left_top
+ geometry += right_top
+ geometry += back
+ geometry += middle
+ geometry += bottom
+ geometry += front_border
+ geometry += right_border
+ geometry
+
+
diff --git a/source/calculus/source/04-IN/01.ptx b/source/calculus/source/04-IN/01.ptx
index 35ce1ff27..040f985ce 100644
--- a/source/calculus/source/04-IN/01.ptx
+++ b/source/calculus/source/04-IN/01.ptx
@@ -109,9 +109,29 @@
The graph of g(t) and the areas A_1, A_2, A_3 are given below.
-
-
-
+
+
+
+
+ x = var('x')
+ f = -0.0019378058*x^5+0.0272617825*x^4-0.0281391103*x^3-0.6767556453*x^2 + 1.6980068882*x-0.0048902147
+ p = plot(f,(x,0,10),thickness=2, gridlines=True, aspect_ratio=1.5, axes_labels=('$t$','$g(t)$'))
+ p
+
+
+
+
+ x = var('x')
+ f = -0.0019378058*x^5+0.0272617825*x^4-0.0281391103*x^3-0.6767556453*x^2 + 1.6980068882*x-0.0048902147
+ p = plot(f,(x,0,10),thickness=2, gridlines=True, aspect_ratio=1.5, fill=True, axes_labels=('$t$','$g(t)$'))
+ a1 = text("$A_1 = 2$",(1.25,0.5), fontsize=12, color='black')
+ a2 = text("$A_2 = 2.5$", (4.75, -0.5), fontsize=12, color='black')
+ a3 = text("$A_3 = 9$", (8.25,1.75), fontsize=12, color='black')
+ p+a1+a2+a3
+
+
+
+
Find \int_{3}^{3} g(t) \, dt
Find \int_{3}^{6} g(t) \, dt
diff --git a/source/calculus/source/04-IN/02.ptx b/source/calculus/source/04-IN/02.ptx
index 8b17a3702..c2e8f7806 100644
--- a/source/calculus/source/04-IN/02.ptx
+++ b/source/calculus/source/04-IN/02.ptx
@@ -31,6 +31,26 @@
axes for plotting y = v(t) ;
at right, for plotting
y = s(t) .
+
+
+
+ x = var('x')
+ f = 0
+ ticks = [True,[a for a in (1..8)]]
+ p = plot(f,(x,0,2.25), thickness=0, ymin = 0.25, ymax = 8.25, gridlines='minor', axes_labels=('hrs','mph'), axes_labels_size=1, aspect_ratio=.25, ticks=ticks)
+ p
+
+
+
+
+ x = var('x')
+ f = 0
+ ticks = [True,[a for a in (1..8)]]
+ p = plot(f,(x,0,2.25), thickness=0, ymin = 0.25, ymax = 8.25, gridlines='minor', axes_labels=('hrs','miles'), axes_labels_size=1, aspect_ratio=.25, ticks=ticks)
+ p
+
+
+
@@ -130,7 +150,27 @@
The graph of y = v(t) .
-
+
+
+ x = var('x')
+ f = (x-1)^3 + 2.5
+ p = plot(f, (x,-.25,2.25), thickness=2, ymin=0, ymax = 3.5, gridlines=True, axes_labels=('hrs','mph'), axes_labels_size=1, aspect_ratio=.6)
+ a = text("$y = v(t)$",(1, 2.65), fontsize=12, color='black')
+ p + a
+
+
+
@@ -214,51 +254,64 @@
A generic Riemann sum.
-
- \begin{tikzpicture}
- \draw[thick] (0,0) -- (5,0);
- \draw[fill=gray!50] (0, 0) rectangle (0.8, 1);
- \draw[fill=gray!50] (0.8, 0) rectangle (1.9, 1.75);
- \draw[fill=gray!50] (1.9, 0) rectangle (3.4, -1.2);
- \draw[fill=gray!50] (3.4, 0) rectangle (4.2, 0.85);
- \draw[fill=gray!50] (4.2, 0) rectangle (5.7, 0.35);
- \draw[fill=gray!50] (5.7, 0) rectangle (6, -0.5);
- \draw[fill=black] (0.2, 1.0) circle (0.05);
- \draw[fill=black] (1.55, 1.75) circle (0.05);
- \draw[fill=black] (2.15, -1.2) circle (0.05);
- \draw[fill=black] (3.8, 0.85) circle (0.05);
- \draw[fill=black] (4.5, 0.35) circle (0.05);
- \draw[fill=black] (6.0, -0.5) circle (0.05);
- \node[above, font=\tiny] at (0.2, 1.0) {$(s_1, f(s_1))$};
- \node[above, font=\tiny] at (1.55, 1.75) {$(s_2, f(s_2))$};
- \node[below, font=\tiny] at (2.15, -1.2) {$(s_3, f(s_3))$};
- \node[above, font=\tiny] at (3.8, 0.85) {$(s_4, f(s_4))$};
- \node[above, font=\tiny] at (4.5, 0.35) {$(s_5, f(s_5))$};
- \node[below, font=\tiny] at (6.0, -0.5) {$(s_6, f(s_6))$};
- \draw[thick, style=dashed, color=blue]
- (0, 0.8) .. controls (0.1, 0.9) and (0.1, 1.1) ..
- (0.2, 1.0) .. controls (1, 2) and (1, -1.0) ..
- (1.55, 1.75) .. controls (1.8, -0.42) and (2.1, 1.9) ..
- (2.15, -1.2) .. controls (2.6, -1.3) and (3.2, -1.1) ..
- (3.8, 0.85) .. controls (3.9, 0.9) and (3.9, 0.8) ..
- (4.5, 0.35) .. controls (4.6, 0.4) and (4.6, 0.3) ..
- (6.0, -0.5)
- ;
- \node[font=\tiny] at (0,-0.15) {$x_0$};
- \node[font=\tiny] at (0.8,-0.15) {$x_1$};
- \node[font=\tiny] at (1.9,-0.15) {$x_2$};
- \node[font=\tiny] at (3.4,-0.15) {$x_3$};
- \node[font=\tiny] at (4.2,-0.15) {$x_4$};
- \node[font=\tiny] at (5.7,-0.15) {$x_5$};
- \node[font=\tiny] at (6,-0.15) {$x_6$};
- \end{tikzpicture}
-
- %(2.15, -1.2)
- %(3.8, 0.85)
- %(4.5, 0.35)
- %(6.0, -0.5)
-
-
+
+ # Import necessary library
+ from sage.plot.graphics import Graphics
+
+ # Create a new graphics object
+ geometry = Graphics()
+
+ # Add rectangles
+ rectangles = [
+ ((0, 0), (0.8, 1)),
+ ((0.8, 0), (1.9, 1.75)),
+ ((1.9, 0), (3.4, -1.2)),
+ ((3.4, 0), (4.2, 0.85)),
+ ((4.2, 0), (5.7, 0.35)),
+ ((5.7, 0), (6, -0.5)),
+ ]
+ for rect in rectangles:
+ geometry += polygon2d(
+ [rect[0], (rect[1][0], rect[0][1]), rect[1], (rect[0][0], rect[1][1])],
+ fill=True, color='lightgray', edgecolor='black'
+ )
+
+ # Add points and their labels
+ points = [
+ (0.2, 1.0, "$(s_1, f(s_1))$", "above"),
+ (1.55, 1.75, "$(s_2, f(s_2))$", "above"),
+ (2.15, -1.2, "$(s_3, f(s_3))$", "below"),
+ (3.8, 0.85, "$(s_4, f(s_4))$", "above"),
+ (4.5, 0.35, "$(s_5, f(s_5))$", "above"),
+ (6.0, -0.5, "$(s_6, f(s_6))$", "below"),
+ ]
+ for (x, y, label, position) in points:
+ geometry += point((x, y), color="black", size=20)
+ geometry += text(label, (x, y + (0.2 if position == "above" else -0.2)), fontsize=12, color="black")
+
+ # Add x-axis labels
+ x_labels = [
+ (0, "$x_0$"), (0.8, "$x_1$"), (1.9, "$x_2$"), (3.4, "$x_3$"),
+ (4.2, "$x_4$"), (5.7, "$x_5$"), (6, "$x_6$")
+ ]
+ for (x, label) in x_labels:
+ geometry += text(label, (x, -0.15), fontsize=12, color="black")
+
+ # Define the Bézier path
+ bezier_segments = [
+ bezier_path([[(0, 0.8), (0.1, 0.9), (0.1, 1.1), (0.2, 1.0)]], alpha=0.75, color = 'blue', thickness=2, linestyle='dashed'),
+ bezier_path([[(0.2, 1.0), (1, 2), (1, -1.0), (1.55, 1.75)]], alpha=0.75, color = 'blue', thickness=2, linestyle='dashed'),
+ bezier_path([[(1.55, 1.75), (1.8, -0.42), (2.1, 1.9), (2.15, -1.2)]], alpha=0.75, color = 'blue', thickness=2, linestyle='dashed'),
+ bezier_path([[(2.15, -1.2), (2.6, -1.3), (3.2, -1.1), (3.8, 0.85)]], alpha=0.75, color = 'blue', thickness=2, linestyle='dashed'),
+ bezier_path([[(3.8, 0.85), (3.9, 0.9), (3.9, 0.8), (4.5, 0.35)]], alpha=0.75, color = 'blue', thickness=2, linestyle='dashed'),
+ bezier_path([[(4.5, 0.35), (4.6, 0.4), (4.6, 0.3), (6.0, -0.5)]], alpha=0.75, color = 'blue', thickness=2, linestyle='dashed')
+ ]
+
+ # Add the Bézier curves to the graphics
+ geometry += sum(bezier_segments, Graphics())
+ geometry.axes(False)
+ geometry
+
@@ -374,36 +427,22 @@
Explain how to approximate the area under the curve
- f(x) = -\frac{1}{5} (x-4)(x-10)(x-12)
+ f(x) = \frac{1}{5} (x-4)(x-10)(x-12)
on the
interval [4,10] using a right Riemann
sum with 3 subintervals.
- The graph of the function f(x) = -1/5 (x-4)(x-10)(x-12)
+ The graph of the function f(x) = 1/5 (x-4)(x-10)(x-12)
crosses the x -axis upward at (4,0) and downward at (10,0)
with a maximum at about (6.3, 9.7) .
-
- \begin{tikzpicture}
- \begin{axis}[
- axis lines=middle,
- grid=both,
- xmin=3,
- xmax=11,
- ymin=-1,
- ymax=12,
- xlabel=$x$,
- ylabel=$y$,
- xtick={3,4,...,10},
- ytick={0,1,...,12},
- legend pos=north east,
- ]
- \addplot[domain=3:11, smooth, thick, blue] {1/5*(x-4)*(x-10)*(x-12)};
- \addlegendentry{{\tiny $f(x)=\frac{1}{5}(x-4)(x-10)(x-12)$}}
- \end{axis}
- \end{tikzpicture}
-
+
+ x = var('x')
+ f = 0.2*(x-4)*(x-10)*(x-12)
+ p = plot(f,(x,3,10.5),gridlines=True,ymin = -1, ymax = 11, thickness=2, axes_labels=('$x$','$y$'))
+ p
+
diff --git a/source/calculus/source/04-IN/05.ptx b/source/calculus/source/04-IN/05.ptx
index 0f7c7e425..285c071c4 100644
--- a/source/calculus/source/04-IN/05.ptx
+++ b/source/calculus/source/04-IN/05.ptx
@@ -18,7 +18,15 @@
-
+
+
+ x= var('x')
+ f = 0.5*x+2
+ ticks = [[-4,-3,-2,-1,0,1,2,3,4,5,6,7,8],[1,2,3,4,5,6]]
+ p = plot(f,(x,-4,8),gridlines=True, thickness=2, axes_labels=('$x$','$f(x)$'), aspect_ratio=1.25, ticks=ticks)
+ p
+
+
@@ -27,7 +35,14 @@
Approximate the area under the curve f(x)=(x-1)^2+2 on the interval [1,5] using a left Riemann sum with four uniform subdivisions. Draw your rectangles on the graph.
-
+
+
+ x = var('x')
+ f = (x-1)^2 + 2
+ p = plot(f,(x,0,5), gridlines=True, thickness=2, axes_labels=('$x$','$f(x)$'), aspect_ratio = .25)
+ p
+
+
@@ -96,21 +111,44 @@
\displaystyle \int_0^2 \left(x^2+3\right) \, dx
-
+
+
+ x = var('x')
+ f = x^2 + 3
+ ticks = [True, [1..12]]
+ p = plot(f,(x,-3,3), ymin = 0, gridlines=True, thickness=2, axes_labels=('$x$','$y$'),ticks=ticks)
+ p
+
+
\displaystyle \int_1^4 \left(\sqrt{x}\right) \, dx
-
+
+
+ x = var('x')
+ f = sqrt(x)
+ p = plot(f,(x,0,6), gridlines=True, thickness=2, axes_labels=('$x$','$y$'))
+ p
+
+
\displaystyle \int_{-\pi/4}^{\pi/2} \left(\cos x\right) \, dx
-
+
+
+ x = var('x')
+ f = cos(x)
+ ticks = [[-pi/2, -pi/4,0,pi/4,pi/2,3*pi/4,pi],True]
+ p = plot(f,(x,-pi/2,pi), gridlines='minor', thickness=2, axes_labels=('$x$','$y$'), tick_formatter=[pi,None], ticks=ticks)
+ p
+
+
@@ -124,7 +162,14 @@
-
+
+
+ x = var('x')
+ f = 2*x-6
+ p = plot(f,(x,0,8), gridlines=True, thickness=2, axes_labels=('$x$','$f(x)$'))
+ p
+
+
What do you notice?
@@ -134,7 +179,14 @@
Find the area bounded by the curves f(x)=e^x-2 , the x -axis, x=0 , and x=1 .
-
+
+
+ x = var('x')
+ f = exp(x)-2
+ p = plot(f,(x,-1,1.5), gridlines=True, thickness=2, axes_labels=('$x$','$f(x)$'))
+ p
+
+
@@ -147,12 +199,29 @@
y=\frac{1}{x^2}
+
+
+ x = var('x')
+ f = 1/x^2
+ p1 = plot(f,(x,.5,3.5), gridlines=True, thickness=2, axes_labels=('$x$','$y$'))
+ p2 = plot(f,(x,1,3),fill=True)
+ p1+p2
+
+
y=3x^2-x^3
-
+
+
+ x=var('x')
+ f = 3*x^2-x^3
+ p1 = plot(f,(x,-1,4),ymin = -2, thickness=2,gridlines=True, axes_labels=('$x$','$y$'))
+ p2 = plot(f,(x,0,2),fill=True)
+ p1+p2
+
+
diff --git a/source/calculus/source/04-IN/08.ptx b/source/calculus/source/04-IN/08.ptx
index 7fd03c4bd..56ca66010 100644
--- a/source/calculus/source/04-IN/08.ptx
+++ b/source/calculus/source/04-IN/08.ptx
@@ -60,9 +60,30 @@
We now look for a general way of writing definite integrals for the area between two given curves, f(x) and g(x) . Consider this area, illustrated in .
- Area between f(x) and g(x) .
-
-
+ Area between f(x) and g(x) .
+
+
+ x=var('x')
+ f(x) = 4*(.5*(x-1))-(.5*(x-1))^2+1
+ g(x) = (.5*(x-1))^2+1
+ pf1 = plot(f,(x,0,5.25), ticks=[[],[]], color='blue', aspect_ratio=1)
+ pg1 = plot(g,(x,0,5.25), ticks=[[],[]], color='red', aspect_ratio=1)
+ pf2 = plot(f,(x,1,5), fill=f, ticks=[[],[]], color='blue', aspect_ratio=1)
+ pg2 = plot(g,(x,1,5), fill=f, ticks=[[],[]], color='red', aspect_ratio=1)
+ t1 = text('$f(x)$', (2, f(2)+1), color='blue', fontsize=12)
+ t2 = text('$g(x)$', (3.5, g(3.5)-1), color='red', fontsize=12)
+ c1 = circle((1,f(1)), 0.1, fill=True, color='black', facecolor='black')
+ c2 = circle((5,f(5)), 0.1, fill=True, color='black', facecolor='black')
+ line1 = line(([1,f(1)],[1,0]), linestyle='dashed', color='black')
+ line2 = line(([5,f(5)],[5,0]), linestyle='dashed', color='black')
+ c3 = circle((1,0), 0.1, fill=True, color='black', facecolor='black')
+ c4 = circle((5,0), 0.1, fill=True, color='black', facecolor='black')
+ t3 = text('$a$',(1,-0.5), fontsize=12, color='black')
+ t4 = text('$b$',(5,-0.5), fontsize=12, color='black')
+ pf1+pf2+pg1+pg2+t1+t2+c1+c2+line1+line2+c3+c4+t3+t4
+
+
+
diff --git a/source/calculus/source/07-CO/04.ptx b/source/calculus/source/07-CO/04.ptx
index 65799cd9d..5389a1024 100644
--- a/source/calculus/source/07-CO/04.ptx
+++ b/source/calculus/source/07-CO/04.ptx
@@ -37,7 +37,23 @@
A point in the polar coordinate system.
A point in the polar coordinate system.
-
+
+ circ = arc((0,0),1,sector=(0,pi/2),color='black',thickness=2,linestyle='dashed',axes=False)
+ xaxis = arrow((0,0),(1.5,0),color='black',axes=False)
+ xaxis_label = text('$x$',(1.6,0),color='black',fontsize=13)
+ yaxis = arrow((0,0),(0,1.5),color='black')
+ yaxis_label = text('$y$',(0,1.6),color='black',fontsize=13)
+ radius = arrow((0,0),(sqrt(2)/2,sqrt(2)/2),color='black')
+ radius_label = text('$r$',(0.35,0.45), color='black',fontsize=15)
+ yline = line(([(0,sqrt(2)/2),(sqrt(2)/2,sqrt(2)/2)]),linestyle='dashed',color='red')
+ yline_label = text('$y$',(-.1,sqrt(2)/2),color='red',fontsize=15)
+ xline = line(([(sqrt(2)/2,sqrt(2)/2),(sqrt(2)/2,0)]),color='red',linestyle='dashed')
+ xline_label = text('$x$',(sqrt(2)/2,-.1),color='red',fontsize=15)
+ pt = text('$(r,\\theta)$',(sqrt(2)/2+.1,sqrt(2)/2+.1),color='black',fontsize=15)
+ inner_arc = arc((0,0),.2,sector=(0,pi/4),color='black')
+ inner_arc_label = text('$\\theta$', (.25,.2*sqrt(2)/3),color='black',fontsize=15)
+ circ + xaxis + xaxis_label + yaxis + yaxis_label + radius + radius_label + yline + yline_label + xline + xline_label + pt + inner_arc + inner_arc_label
+
@@ -47,13 +63,28 @@
The polar grid.
The polar grid
-
-
+
+circ_range = [1,..,5]
+plt = Graphics()
+for i in circ_range:
+ plt += polar_plot(i-0.5,x,0,2*pi,thickness=1,figsize=10)
+ plt += polar_plot(i,(x,0,2*pi), axes=False, thickness=1.5,figsize=10)
+ bbox = {'boxstyle': 'square,pad=0.05','fc':"white", 'ec':"white"}
+ lbl = text(i,(i,-.25),color='black',background_color='white',bounding_box = bbox,fontsize=13)
+ plt += lbl
+for angle in [0,1,..,23]:
+ plt += line(([(0,0),(5*cos(angle*pi/12),5*sin(angle*pi/12))]))
+ actual_angle = angle*pi/12
+ if denominator(actual_angle) != 1:
+ plt += text(f"$\\dfrac{{{latex(numerator(actual_angle))}}}{{{denominator(actual_angle)}}}$",(5.5*cos(angle*pi/12),5.5*sin(angle*pi/12)),color='black',fontsize=13)
+ else:
+ plt += text(f"${latex(angle*pi/12)}$",(5.5*cos(angle*pi/12),5.5*sin(angle*pi/12)),color='black',fontsize=13)
+xaxis = arrow((0,0),(5.25,0),arrowsize=0.5,color='black')
+plt += xaxis
+plt
+
-
-
-
-
+
diff --git a/source/calculus/source/07-CO/06.ptx b/source/calculus/source/07-CO/06.ptx
index b0c936503..1e9a99a14 100644
--- a/source/calculus/source/07-CO/06.ptx
+++ b/source/calculus/source/07-CO/06.ptx
@@ -30,66 +30,45 @@
Finding the polar area differential
Illustration of polar area differential.
-
- \begin{tikzpicture}[>=latex]
-
-% Draw the lines at multiples of pi/12
-\foreach \ang in {0,...,31} {
- \draw [lightgray] (0,0) -- (\ang * 180 / 16:4);
-}
-
-% Concentric circles and radius labels
-\foreach \s in {0, 1, 2, 3} {
- \draw [lightgray] (0,0) circle (\s + 0.5);
- \draw (0,0) circle (\s);
- \node [fill=white] at (\s, 0) [below] {\scriptsize $\s$};
-}
-
-% Add the labels at multiples of pi/4
-\foreach \ang/\lab/\dir in {
- 0/0/right,
- 1/{\pi/4}/{above right},
- 2/{\pi/2}/above,
- 3/{3\pi/4}/{above left},
- 4/{\pi}/left,
- 5/{5\pi/4}/{below left},
- 7/{7\pi/4}/{below right},
- 6/{3\pi/2}/below} {
- \draw (0,0) -- (\ang * 180 / 4:4.1);
- \node [fill=white] at (\ang * 180 / 4:4.2) [\dir] {\scriptsize $\lab$};
-}
-
-% The double-lined circle around the whole diagram
-\draw [style=double] (0,0) circle (4);
-
-\draw [fill=red!50!black, opacity=0.4] ({cos(30)},{sin(30)})--plot [domain=pi/6:pi/3]
- (xy polar cs:angle=\x r, radius= {2+2*cos(\x r)})--plot [domain=pi/3:pi/6]
- (xy polar cs:angle=\x r, radius= {1})--({cos(30)},{sin(30)});
-\draw [thick, color=red, domain=0:2*pi, samples=200, smooth]
- plot (xy polar cs:angle=\x r, radius={2+2*cos(\x r)});
-\draw [thick, color=blue, domain=0:2*pi, samples=200, smooth]
- plot (xy polar cs:angle=\x r, radius={1});
-
-\draw [fill=blue!50!black, opacity=0.4] ({cos(30)},{sin(30)})--plot [domain=pi/6:4*pi/18]
- (xy polar cs:angle=\x r, radius= {2+2*cos(pi/6 r)})--plot [domain=4*pi/18:pi/6]
- (xy polar cs:angle=\x r, radius= {1})--({cos(30)},{sin(30)});
-
-\draw [fill=blue!50!black, opacity=0.4] ({cos(40)},{sin(40)})--plot [domain=4*pi/18:5*pi/18]
- (xy polar cs:angle=\x r, radius= {2+2*cos(4*pi/18 r)})--plot [domain=5*pi/18:4*pi/18]
- (xy polar cs:angle=\x r, radius= {1})--({cos(40)},{sin(40)});
-
-\draw [fill=blue!50!black, opacity=0.4] ({cos(50)},{sin(50)})--plot [domain=5*pi/18:6*pi/18]
- (xy polar cs:angle=\x r, radius= {2+2*cos(5*pi/18 r)})--plot [domain=6*pi/18:5*pi/18]
- (xy polar cs:angle=\x r, radius= {1})--({cos(50)},{sin(50)});
-%\node [fill=white] at (2,1) {$r=1+\cos\theta$};
-
-\draw[purple, dashed] (0,0)--({cos(30)*(2+2*cos(30))}, {sin(30)*(2+2*cos(30))});
-\draw[purple, dashed] (0,0)--({cos(40)*(2+2*cos(30))}, {sin(40)*(2+2*cos(30))});
-\draw[purple, dashed] (0,0)--({cos(50)*(2+2*cos(40))}, {sin(50)*(2+2*cos(40))});
-\draw[purple, dashed] (0,0)--({cos(60)*(2+2*cos(50))}, {sin(60)*(2+2*cos(50))});
-
-\end{tikzpicture}
-
+
+ x = var('x')
+ f(x) = 2 + 2*cos(x)
+ g(x) = 1
+ plt = Graphics()
+ circ_range = [1,..,5]
+ for i in circ_range:
+ plt += polar_plot(i,(x,0,2*pi), axes=False, thickness=1.5,figsize=10,color='black')
+ bbox = {'boxstyle': 'square,pad=0.05','fc':"white", 'ec':"white"}
+ lbl = text(i,(i,-.25),color='black',background_color='white',bounding_box = bbox,fontsize=13)
+ plt += lbl
+ for angle in [0,1,..,23]:
+ plt += line(([(0,0),(5*cos(angle*pi/12),5*sin(angle*pi/12))]),color='black',thickness=0.5)
+ actual_angle = angle*pi/12
+ if denominator(actual_angle) != 1:
+ plt += text(f"$\\dfrac{{{latex(numerator(actual_angle))}}}{{{denominator(actual_angle)}}}$",(5.5*cos(angle*pi/12),5.5*sin(angle*pi/12)),color='black',fontsize=13)
+ else:
+ plt += text(f"${latex(angle*pi/12)}$",(5.5*cos(angle*pi/12),5.5*sin(angle*pi/12)),color='black',fontsize=13)
+ xaxis = arrow((0,0),(5.25,0),arrowsize=0.5,color='black')
+ def polar_rectangle(start,end):
+ radius = f(start)
+ a = arc((0,0),radius,sector=(start,end),thickness=2)
+ a_side1 = line(([(0,0),(radius*cos(start),radius*sin(start))]),thickness=2,linestyle='dashed',color='darkblue')
+ a_side2 = line(([(0,0),(radius*cos(end),radius*sin(end))]),thickness=2,linestyle='dashed',color='darkblue')
+ pp = polar_plot(f,(x,start,end),fill=g,fillcolor='cyan')
+ d = polar_plot(radius,(x,start,end),fill=g,fillcolor='grey',fillalpha=0.5)
+ p = a + a_side1 + a_side2 + pp + d
+ return p
+ rec1 = polar_rectangle(pi/12,pi/6)
+ rec2 = polar_rectangle(pi/6,pi/4)
+ rec3 = polar_rectangle(pi/4,pi/3)
+ plt += polar_plot(f(x),(x,0,2*pi),color = 'red',thickness=2)
+ plt += polar_plot(g(x),(x,0,2*pi),color = 'blue',thickness=2)
+ plt += rec1
+ plt += rec2
+ plt += rec3
+ plt += xaxis
+ plt
+
diff --git a/source/calculus/source/08-SQ/06.ptx b/source/calculus/source/08-SQ/06.ptx
index 4b29f89ab..d5fa05f77 100644
--- a/source/calculus/source/08-SQ/06.ptx
+++ b/source/calculus/source/08-SQ/06.ptx
@@ -311,48 +311,33 @@
Plots of \{a_n\}, \{b_n\}
Plots of sequences \{a_n\}, \{b_n\} where a_n\geq b_n\geq 0 .
-
- \begin{tikzpicture}
- \draw[->] (-1, 0) -- (10.2, 0) node[below right] {$x$};
- \draw[->] (0, -1) -- (0, 4.2) node[above] {$y$};
-
-
- \draw[blue] (0,4)\foreach \x in {0,...,9}{
- --({\x+1}, {4/(\x+1)})--({\x+1}, {4/(\x+2)})};
- \draw (0,0)--(0,4);
- \foreach \x in {0,...,9}{
- \draw[blue] ({\x+1}, {4/(\x+2)})--({\x+1}, {0});}
-
- \draw[blue, fill, opacity=0.2] (0,0)--(0,4)\foreach \x in {0,...,9}{
- --({\x+1}, {4/(\x+1)})--({\x+1}, {4/(\x+2)})}
- --(10,0)
- --cycle;
-
- \draw[red] (0,4)\foreach \x in {0,...,9}{
- --({\x+1}, {4/(\x+1)^2})--({\x+1}, {4/(\x+2)^2})};
- \draw (0,0)--(0,4);
- \foreach \x in {0,...,9}{
- \draw[red] ({\x+1}, {4/(\x+2)^2})--({\x+1}, {0});}
-
- \draw[red, fill, opacity=0.2] (0,0)--(0,4)\foreach \x in {0,...,9}{
- --({\x+1}, {4/(\x+1)^2})--({\x+1}, {4/(\x+2)^2})}
- --(10,0)
- --cycle;
-
- \draw[blue] (0,4)--node[left]{$a_0$} (0,4);
- \draw[red] (1,4)--node[right]{$b_0$} (1,4);
-
- \draw[blue] (2,4/2)--node[ right]{$a_1$} (2,4/2);
- \draw[red] (2,4/2^2)--node[ right]{$b_1$} (2,4/2^2);
-
- \draw[blue] (3,4/3)--node[ right]{$a_2$} (3,4/3);
- \draw[red] (3,4/3^2)--node[right]{$b_2$} (3,4/3^2);
-
- \draw (10,0)-- node[above right]{$\cdots$} (10,0);
-
-
- \end{tikzpicture}
-
+
+ x = var('x')
+ plt = Graphics()
+ f(x) = 4*0.8^(x+1)
+ g(x) = 4*0.7^(x+1)
+ for i in [0,..,10]:
+ plt += polygon(([(i,0),(i,f(i)),(i+1,f(i)),(i+1,0)]),fill='blue',alpha=0.25,edgecolor='black',axes=False)
+ plt += polygon(([(i,0),(i,g(i)),(i+1,g(i)),(i+1,0)]),color='red',alpha=0.25,edgecolor='black')
+ a0 = text('$a_0$',(1.25,f(0)),color='blue',fontsize=12)
+ b0 = text('$b_0$',(1.25,g(0)),color='red',fontsize=12)
+ a1 = text('$a_1$',(2.25,f(1)),color='blue',fontsize=12)
+ b1 = text('$b_1$',(2.25,g(1)),color='red',fontsize=12)
+ a2 = text('$a_2$',(3.25,f(2)),color='blue',fontsize=12)
+ b2 = text('$b_2$',(3.25,g(2)),color='red',fontsize=12)
+ plt += a0
+ plt += b0
+ plt += a1
+ plt += b1
+ plt += a2
+ plt += b2
+ plt += text('$\\cdots$',(11.5,.1),color='black',fontsize=15)
+ plt += arrow((0,0),(12.5,0),arrowsize=0.5,color='black')
+ plt += text('$x$', (12.75,0), color='black',fontsize=13)
+ plt += arrow((0,0),(0,4),arrowsize=0.5,color='black')
+ plt += text('$y$', (0,4.25),color='black',fontsize=13)
+ plt
+
@@ -449,67 +434,26 @@
Plots of \{a_n\}, \{b_n\}
Plots of sequences \{a_n\}, \{b_n\} where a_n\geq b_n\geq 0 initially but eventually a_n\leq b_n\geq 0 .
-
- \begin{tikzpicture}
- \draw[->] (-1, 0) -- (10.2, 0) node[below right] {$x$};
- \draw[->] (0, -1) -- (0, 4.2) node[above] {$y$};
-
-
- \draw[blue] (0,4)\foreach \x in {0,...,4}{
- --({\x+1}, {4*(0.8^(\x))})--({\x+1}, {4*0.8^(\x+1)})};
- \draw (0,0)--(0,4);
- \foreach \x in {0,...,4}{
- \draw[blue] ({\x+1}, {4*0.8^(\x+1)})--({\x+1}, {0});}
-
- \draw[blue, fill, opacity=0.2] (0,0)--(0,4)\foreach \x in {0,...,4}{
- --({\x+1}, {4*0.8^(\x)})--({\x+1}, {4*0.8^(\x+1)})}
- --(5,0)
- --cycle;
-
- \draw[red] (0,4)\foreach \x in {0,...,4}{
- --({\x+1}, {4*(0.7^(\x))})--({\x+1}, {4*0.7^(\x+1)})};
- \draw (0,0)--(0,4);
- \foreach \x in {0,...,4}{
- \draw[red] ({\x+1}, {4*0.7^(\x+1)})--({\x+1}, {0});}
-
- \draw[red, fill, opacity=0.2] (0,0)--(0,4)\foreach \x in {0,...,4}{
- --({\x+1}, {4*0.7^(\x)})--({\x+1}, {4*0.7^(\x+1)})}
- --(5,0)
- --cycle;
-
- \draw (5.5,0)--node[above]{$\cdots$} (5.5,0);
-
- \draw[blue] (6,4*0.75^9)\foreach \x in {6,...,9}{
- --({\x+1}, {4*(0.75^(\x+3))})--({\x+1}, {4*0.75^(\x+4)})};
- \draw[blue] (6,0)--(6,4*0.75^9);
- \foreach \x in {6,...,9}{
- \draw[blue] ({\x+1}, {4*0.75^(\x+4)})--({\x+1}, {0});}
-
- \draw[blue, fill, opacity=0.2] (6,0)--(6,4*0.75^9)\foreach \x in {6,...,9}{
- --({\x+1}, {4*0.75^(\x+3)})--({\x+1}, {4*0.75^(\x+4)})}
- --(10,0)
- --cycle;
-
-
- \draw[red] (6,4*0.8^9)\foreach \x in {6,...,9}{
- --({\x+1}, {4*(0.8^(\x+3))})--({\x+1}, {4*0.8^(\x+4)})};
- \draw[blue] (6,0)--(6,4*0.8^9);
- \foreach \x in {6,...,9}{
- \draw[red] ({\x+1}, {4*0.8^(\x+4)})--({\x+1}, {0});}
-
- \draw[red, fill, opacity=0.2] (6,0)--(6,4*0.8^9)\foreach \x in {6,...,9}{
- --({\x+1}, {4*0.8^(\x+3)})--({\x+1}, {4*0.8^(\x+4)})}
- --(10,0)
- --cycle;
-
- \draw (6,-0.1)--(6,0.1);
- \draw (6,-0.1)--node[below]{$100$} (6,-0.1);
-
- \draw (10.5,0)--node[above]{$\cdots$} (10.5,0);
-
-
- \end{tikzpicture}
-
+
+ x = var('x')
+ plt = Graphics()
+ f(x) = 4*0.8^(x+1)
+ g(x) = 4*0.7^(x+1)
+ for i in [0,..,4]:
+ plt += polygon(([(i,0),(i,f(i)),(i+1,f(i)),(i+1,0)]),fill='blue',alpha=0.25,edgecolor='black',axes=False)
+ plt += polygon(([(i,0),(i,g(i)),(i+1,g(i)),(i+1,0)]),color='red',alpha=0.25,edgecolor='black')
+ plt += text('$\\cdots$',(5.5,.5),color='black',fontsize=15)
+ for i in [6,..,10]:
+ plt += polygon(([(i,0),(i,f(i)),(i+1,f(i)),(i+1,0)]),color='cyan',alpha=0.25,edgecolor='black',axes=False)
+ plt += polygon(([(i,0),(i,g(i)),(i+1,g(i)),(i+1,0)]),color='red',alpha=0.25,edgecolor='black')
+ plt += arrow((0,0),(12.5,0),arrowsize=0.5,color='black')
+ plt += text('$x$', (12.75,0), color='black',fontsize=13)
+ plt += arrow((0,0),(0,4),arrowsize=0.5,color='black')
+ plt += text('$y$', (0,4.25),color='black',fontsize=13)
+ plt += text('100', (6,-0.25),color='black',fontsize=15)
+ plt += text('$\\cdots$',(11.5,0.2),color='black',fontsize=15)
+ plt
+
diff --git a/source/calculus/source/09-PS/01.ptx b/source/calculus/source/09-PS/01.ptx
index 02cbbf260..8ff868cd3 100644
--- a/source/calculus/source/09-PS/01.ptx
+++ b/source/calculus/source/09-PS/01.ptx
@@ -418,33 +418,13 @@
Plots of y=f_5(x), y=e^x .
Plots of y=f_5(x), y=e^x .
-
- \begin{tikzpicture}
- \begin{axis}[
- axis lines=middle,
- grid=major,
- xmin=-2,
- xmax=2,
- ymin=-1,
- ymax=8,
- xlabel=$x$,
- ylabel=$y$,
- xtick={-2,-1,...,2},
- ytick={0,1,...,7},
- tick style={very thick},
- legend style={
- at={(rel axis cs:0,1)},
- anchor=north west,draw=none,inner sep=0pt,fill=gray!10}
- ]
-
- \addplot[blue,samples=100] {e^x};
- \addlegendentry{$y=e^x$}
-
- \addplot[red, dashed,samples=100] {1+x+x^2/2+x^3/6+x^4/24+x^5/120};
- \addlegendentry{$y=f_5(x)$}
- \end{axis}
- \end{tikzpicture}
-
+
+ g = Graphics()
+ taylor = 1 + x + x^2/2 + x^3/6 + x^4/24 + x^5/120
+ g += plot(exp(x),(x,-2,2),color='blue',thickness=2,axes_labels=('$x$','$y$'),legend_label = '$y = e^x$')
+ g += plot(taylor,(x,-2,2),color='red',thickness=1.5, linestyle='dashed',legend_label = '$y = f_5(x)$')
+ g
+
What might we conclude?
diff --git a/source/precalculus/source/03-LF/06.ptx b/source/precalculus/source/03-LF/06.ptx
index 273bc3a80..288c036d5 100644
--- a/source/precalculus/source/03-LF/06.ptx
+++ b/source/precalculus/source/03-LF/06.ptx
@@ -32,11 +32,10 @@
- 4a+2c=128.50
- a+c=128.50
-
- 4c+2a=128.50
- a+c=336.50
+ 2c+4a=\$128.50
+ c+a=\$128.50
+ 4c+2a=\$128.50
+ c+a=\$336.50
@@ -52,11 +51,10 @@
- 6c+4a=208
- a+c=208
-
- 4a+6c=208
- a+c=336.50
+ 6c+4a=\$208
+ c+a=\$208
+ 4c+6a=\$208
+ c+a=\$336.50
@@ -634,4 +632,4 @@
Videos
It would be great to include videos down here, like in the Calculus book!
-->
-
\ No newline at end of file
+