Skip to content

Custom SageMath Functionality

Drew Lewis edited this page Feb 27, 2025 · 13 revisions

Authors can use the custom TBIL SageMath module in either SagePlots:

<image>
  <sageplot>
<xi:include parse="text" href="../../../common/sagemath/library.sage"/>
# code goes here, fully flush left (the above line needs to also be fully flushed left)
  </sageplot>
</image>

and in CheckIt generators:

# at top of file
load("../../../source/common/sagemath/library.sage")

See below for various options, along with their defaults if not provided. (If this page gets stale, see the code at https://github.com/TeamBasedInquiryLearning/library/blob/main/source/common/sagemath/library.sage for the most up-to-date versions.)

plot_angle

TBIL.plot_angle(
    angle, # in radians, multiply degrees by pi/180
    reference_angle=0,
    show_axes=True,
    show_unit_circle=False,
    show_unit_point=False,
    show_angle_value=False
)

plot_angle

TBIL.numberline_plot(
    center=0,
    radius=10
)

inequality_plot

TBIL.inequality_plot(
    start=None, 
    strict_start=True, 
    end=None, 
    strict_end=True,
    label_endpoints=True,
    scale=10
)

intervals_from_inequality

TBIL.intervals_from_inequality(
  inequality,
  partition_points,
  undefined_points=None,
  checkpoints=None
)

numberline_from_intervals

TBIL.numberline_from_intervals(
  intervals
)

small_rationals

def small_rationals(
    numerators=range(-8,9), 
    denominators=None, # defaults to [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.'''

small_irrationals

TBIL.small_irrationals(
    rational_part=range(-8,9), 
    irrational_part=None,
    denominators=None,
    dictionary=True,
    length=1,
    full_list=False
)

small_complex

line_from_points

line_from_point_slope

config_matrix_typesetting

RowOp

SetBuilder

BracedSet

VectorSet

VectorList

LinearCombination

Equation

VectorEquation

choices_from_list

Clone this wiki locally