Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
Incorporate Tonya's feedback (#418)
Browse files Browse the repository at this point in the history
* Incorporate Tonya's feedback

* Add activity before 1.7.7 for scaffolding

* Fix graph

* Try to add number line

* Should work but doesn't

* Add other two numberline tasks

* Missing <p> tag

* Draw number lines manually
  • Loading branch information
siwelwerd authored Jul 30, 2024
1 parent d7cda3f commit c83cacf
Show file tree
Hide file tree
Showing 2 changed files with 219 additions and 14 deletions.
75 changes: 75 additions & 0 deletions sage/common.sage
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Library of helpful functions
class TBILPrecal:
@staticmethod
def numberline_plot(center=0, radius=10):
P = arrow((center-radius,0),(center+radius,0),color="black", width=1, arrowsize=1, aspect_ratio=1,head=2)
for i in range(center-radius+1,center+radius):
P += line([(i,-0.2),(i,0.2)],color="black")
P += text(f"${i}$", (i,-0.6),color="black")
return P

@staticmethod
def inequality_plot(
start=None,
strict_start=True,
end=None,
strict_end=True,
label_endpoints=True):
P = Graphics()
if start is None:
P += arrow((end,0),(-10,0),color="#0088ff", width=3, arrowsize=3, aspect_ratio=1)
if end is None:
P += arrow((start,0),(10,0),color="#0088ff", width=3, arrowsize=3, aspect_ratio=1)
if start is not None and end is not None:
P += line([(start,0),(end,0)],color="#0088ff", thickness=3, aspect_ratio=1)

if start is not None:
if label_endpoints:
P += text(f"${round(start,ndigits=2)}$", (start,0.6), color="black")
if strict_start:
P += text("(", (start,0), color="#0088ff", fontsize=18)
else:
P += text("[", (start,0), color="#0088ff", fontsize=18)

if end is not None:
if label_endpoints:
P += text(f"${round(end,ndigits=2)}$", (end,0.6), color="black")
if strict_end:
P += text(")", (end,0), color="#0088ff", fontsize=18)
else:
P += text("]", (end,0), color="#0088ff", fontsize=18)
return P

@staticmethod
def small_rationals(numerators=range(-8,9),
denominators=[2,3,5],
dictionary=True,
length=1):
'''Generates a list or dictionary of unique rational numbers with small numerators and denominators.
For a dictionary, keys are the rationals and values are the denominators.'''
fulldict = {m/n:n for m in numerators for n in denominators if m%n !=0}
dict= { num:fulldict[num] for num in sample(list(fulldict.keys()),length)}
if dictionary:
return dict
return list(dict.keys())

@staticmethod
def small_irrationals(rational_part=range(-8,9),
irrational_part=[2,3,5,6,7,8],
denominators=[i for i in range(-5,6) if i != 0],
dictionary=True,
length=1):
'''Generates a list or dictionary of uniqe irrational numbers of the form (a+sqrt(b))/c.
For a dictionary, keys are tuples of rationals and their conjugate, and values are the denominators.'''
fulldict = { ((a+sqrt(b))/c,(a-sqrt(b))/c):c for a in rational_part for b in irrational_part for c in denominators}
dict= { pair:fulldict[pair] for pair in sample(list(fulldict.keys()),length)}
if dictionary:
return dict
else:
return list(dict.keys())

@staticmethod
def small_complex(real_part=range(-5,6),
imaginary_part=[i for i in range(-5,6) if i != 0],length=1):
'''Generates a list of unique 2-tuples of conjugate pairs of complex (not real) numbers of the form a+bi.'''
return sample([(a+b*I,a-b*I) for a in real_part for b in imaginary_part],length)
158 changes: 144 additions & 14 deletions source/01-EQ/07.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,53 @@
</definition>

<activity xml:id="quadratic-inequality-coeff-less-than-0">
<statement>
<p>Solve the quadratic inequality algebraically<me>2x^2-28 \lt 10x</me>.
Write your solution using interval notation.</p>
<introduction>
<p>Solve the quadratic inequality algebraically<me>2x^2-28 \lt 10x</me>.</p>
</introduction>
<task>
<statement>
<p>Write your solution using interval notation.</p>
<ol marker="A." cols="1">
<li><p> <m>\left(-\infty,-2\right)\cup\left(7,\infty\right)</m> </p></li>
<li><p> <m>\left(-\infty,-7\right)\cup\left(2,\infty\right)</m> </p></li>
<li><p> <m>\left(-7,2\right)</m> </p></li>
<li><p> <m>\left(-2,7\right)</m></p></li>
</ol>
</statement>
<answer><p>D.</p></answer>
</ol>
</statement>
<answer><p>D.</p></answer>
</task>
<task>
<statement>
<p>Draw a number line representing your solution.</p>
</statement>
<answer>
<image>
<sageplot>
<!--<xi:include parse="text" href="../../sage/common.sage"/> -->
#p = TBILPrecal.numberline_plot()
#p += TBILPrecal.inequality_plot(start=-2,end=7,label_endpoints=False)
p = arrow((-10,0),(10,0),color="black", width=1, arrowsize=1, aspect_ratio=1,head=2)
for i in range(-9,10):
p += line([(i,-0.2),(i,0.2)],color="black")
p += text(f"${i}$", (i,-0.6),color="black")
p += line([(-2,0),(7,0)],color="#0088ff", thickness=3, aspect_ratio=1)
p += text("(", (-2,0), color="#0088ff", fontsize=18)
p += text(")", (7,0), color="#0088ff", fontsize=18)
p.axes(False)
p
</sageplot>
</image>
</answer>
</task>
</activity>

<activity xml:id="quadratic-inequality-coeff-greater-than-or-equal-0">
<introduction>
<p>Solve the inequality <me>-2x^2-10x-10 \ge 6x+20</me>.</p>
</introduction>
<task>
<statement>
<p>Solve the inequality <me>-2x^2-10x-10 \ge 6x+20</me>.
Write your solution using interval notation.</p>
<p>Write your solution using interval notation.</p>
<ol marker="A." cols="1">
<li><p><m>[-5,-3]</m> </p></li>
<li><p> <m>(-\infty,-5]\cup[-3,\infty)</m> </p></li>
Expand All @@ -146,6 +176,66 @@
</ol>
</statement>
<answer><p>A.</p></answer>
</task>
<task>
<statement>
<p>Draw a number line representing your solution.</p>
</statement>
<answer>
<image>
<sageplot>
<!--<xi:include parse="text" href="../../sage/common.sage"/> -->
#p = TBILPrecal.numberline_plot()
#p += TBILPrecal.inequality_plot(start=-5,end=3,strict_start=False,strict_end=False,label_endpoints=False)
p = arrow((-10,0),(10,0),color="black", width=1, arrowsize=1, aspect_ratio=1,head=2)
for i in range(-9,10):
p += line([(i,-0.2),(i,0.2)],color="black")
p += text(f"${i}$", (i,-0.6),color="black")
p += line([(-5,0),(3,0)],color="#0088ff", thickness=3, aspect_ratio=1)
p += text("[", (-5,0), color="#0088ff", fontsize=18)
p += text("]", (3,0), color="#0088ff", fontsize=18)
p.axes(False)
p
</sageplot>
</image>
</answer>
</task>
</activity>

<activity xml:id="activity-rational-inequality-0">
<introduction>
<p>
Consider the rational inequality <me> \frac{x+3}{x-2} \leq 0.</me>
</p>
</introduction>
<task>
<statement>
<p>
Use a graphing utility to graph the function <m>f(x)=\dfrac{x+3}{x-2}</m>.
Which part of the graph represents where <m>\dfrac{x+3}{x-2}\leq 0</m>?
Write your answer in interval notation.
</p>
</statement>
<answer>
<image>
<sageplot>
f(x) = (x+3)/(x-2)
fill_opt = {'fillcolor': 'blue', 'thickness': 0}
p=plot(f,(x,-3,2),fill=True,**fill_opt,ymin=-15,ymax=15)+plot(f,(x,-5,5),thickness=3,detect_poles=True)
p
</sageplot>
</image>
<p>The graph is below the <m>x</m>-axis on the interval <m>[-3,2)</m>.</p>
</answer>
</task>
<task>
<statement>
<p> How does the interval you found in part (a) relate to the numerator and the denominator
of the function <m>f(x)=\dfrac{x+3}{x-2}</m>?
</p>
</statement>
<answer><p>The places where the numerator or denominator are zero are the potential places where the sign can change.</p></answer>
</task>
</activity>

<activity xml:id="activity-rational-inequality-1">
Expand All @@ -166,9 +256,23 @@
</task>
<task>
<statement>
<p> Use a graphing utility to graph the function <m>g(x)=\frac{4x+3}{x+2}-x</m>.
Which part of the graph represents where <m>\frac{4x+3}{x+2}-x\gt0</m>?</p>
<p>
Use a graphing utility to graph the function <m>g(x)=\frac{4x+3}{x+2}-x</m>.
Which part of the graph represents where <m>\frac{4x+3}{x+2}-x\gt0</m>?
Write your answer in interval notation.
</p>
</statement>
<answer>
<image>
<sageplot>
f(x) = (4*x+3)/(x+2)-x
fill_opt = {'fillcolor': 'blue', 'thickness': 0}
p=plot(f,(x,-1,3),fill=True,**fill_opt)+plot(f,(x,-7,-2),fill=True,**fill_opt)+plot(f, (x, -7, 7), ymin=-15, ymax=15, color='blue', thickness=3, detect_poles=True)
p
</sageplot>
</image>
<p>The graph is above the <m>x</m>-axis on the interval <m>(-\infty, -2) \cup (-1,3)</m>.</p>
</answer>
</task>
<task>
<statement>
Expand All @@ -184,12 +288,12 @@
</task>
<task>
<statement>
<p> How do these values you found in part (b) relate to the numerator and the denominator
<p> How does the interval you found in part (b) relate to the numerator and the denominator
of the combined rational function in part (c)?
</p>
</statement>
<hint><p>Factor the numerator.</p></hint>
<answer><p>The places where the numerator or denominator vanishes are the potential places where the sign can change.</p></answer>
<answer><p>The places where the numerator or denominator are zero are the potential places where the sign can change.</p></answer>
</task>
<task>
<statement>
Expand All @@ -207,10 +311,10 @@
<statement>
<p> How can we express the answers to part (e) for the rational inequality using interval notation?</p>
<ol marker="A." cols="1">
<li><m>\left(-\infty,-2\right) \cup (-1,3)</m></li>
<li><m>\left(1,3\right) </m></li>
<li><m>\left(-2,-1\right) \cup (3,\infty)</m></li>
<li><m>\left(-2,-1\right) </m></li>
<li><m>\left(1,3\right) </m></li>
<li><m>\left(-\infty,-2\right) \cup (-1,3)</m></li>
</ol>
</statement>
<answer><p>A.</p></answer>
Expand Down Expand Up @@ -241,6 +345,32 @@
</statement>
<answer><p>B.</p></answer>
</task>
<task>
<statement>
<p>Draw a number line representing your solution.</p>
</statement>
<answer>
<image>
<sageplot>
<!--<xi:include parse="text" href="../../sage/common.sage"/> -->
#p = TBILPrecal.numberline_plot()
#p += TBILPrecal.inequality_plot(end=-12,strict_end=False,label_endpoints=False)
#p += TBILPrecal.inequality_plot(start=-5,end=2,label_endpoints=False)
p = arrow((-14,0),(5,0),color="black", width=1, arrowsize=1, aspect_ratio=1,head=2)
for i in range(-14,5):
p += line([(i,-0.2),(i,0.2)],color="black")
p += text(f"${i}$", (i,-0.6),color="black")
p += arrow((-12,0),(-15,0),color="#0088ff", width=3)
p += line([(-5,0),(2,0)],color="#0088ff", thickness=3)
p += text("]", (-12,0), color="#0088ff", fontsize=18)
p += text("(", (-5,0), color="#0088ff", fontsize=18)
p += text(")", (2,0), color="#0088ff", fontsize=18)
p.axes(False)
p
</sageplot>
</image>
</answer>
</task>
<task>
<statement>
<p>
Expand Down

0 comments on commit c83cacf

Please sign in to comment.