./answers/PGfunctionevaluators.pl:# Until we get the PG cacheing business sorted out, we need to use
./answers/PGfunctionevaluators.pl:# PG_restricted_eval to get the correct values for some(?) PG environment
./answers/PGfunctionevaluators.pl:# variables. We do this once here and place the values in lexicals for later
./answers/PGfunctionevaluators.pl:# access.
./answers/PGfunctionevaluators.pl:## The following answer evaluator for comparing multivarable functions was
./answers/PGfunctionevaluators.pl:## contributed by Professor William K. Ziemer
./answers/PGfunctionevaluators.pl:## (Note: most of the multivariable functionality provided by Professor Ziemer
./answers/PGfunctionevaluators.pl:## has now been integrated into fun_cmp and FUNCTION_CMP)
./answers/PGfunctionevaluators.pl:############################
./answers/PGfunctionevaluators.pl:# W.K. Ziemer, Sep. 1999
./answers/PGfunctionevaluators.pl:# Math Dept. CSULB
./answers/PGfunctionevaluators.pl:# email: wziemer@csulb.edu
./answers/PGfunctionevaluators.pl:############################
./answers/PGfunctionevaluators.pl:## LOW-LEVEL ROUTINE -- NOT NORMALLY FOR END USERS -- USE WITH CAUTION
./answers/PGfunctionevaluators.pl:## NOTE: PG_answer_eval is used instead of PG_restricted_eval in order to insure that the answer
./answers/PGfunctionevaluators.pl:## evaluated within the context of the package the problem was originally defined in.
./answers/PGfunctionevaluators.pl:## Includes multivariable modifications contributed by Professor William K. Ziemer
./answers/PGfunctionevaluators.pl:##
./answers/PGfunctionevaluators.pl:## IN: a hash consisting of the following keys (error checking to be added later?)
./answers/PGfunctionevaluators.pl:## correctEqn -- the correct equation as a string
./answers/PGfunctionevaluators.pl:## var -- the variable name as a string,
./answers/PGfunctionevaluators.pl:## or a reference to an array of variables
./answers/PGfunctionevaluators.pl:## limits -- reference to an array of arrays of type [lower,upper]
./answers/PGfunctionevaluators.pl:## tolerance -- the allowable margin of error
./answers/PGfunctionevaluators.pl:## tolType -- 'relative' or 'absolute'
./answers/PGfunctionevaluators.pl:## numPoints -- the number of points to evaluate the function at
./answers/PGfunctionevaluators.pl:## mode -- 'std' or 'antider'
./answers/PGfunctionevaluators.pl:## maxConstantOfIntegration -- maximum size of the constant of integration
./answers/PGfunctionevaluators.pl:## zeroLevel -- if the correct answer is this close to zero,
./answers/PGfunctionevaluators.pl:## then zeroLevelTol applies
./answers/PGfunctionevaluators.pl:## zeroLevelTol -- absolute tolerance to allow when answer is close to zero
./answers/PGfunctionevaluators.pl:## test_points -- user supplied points to use for testing the
./answers/PGfunctionevaluators.pl:## function, either array of arrays, or optionally
./answers/PGfunctionevaluators.pl:## reference to single array (for one variable)
./answers/PGfunctionevaluators.pl:#
./answers/PGfunctionevaluators.pl:# The original version, for backward compatibility
./answers/PGfunctionevaluators.pl:# (can be removed when the Parser-based version is more fully tested.)
./answers/PGfunctionevaluators.pl:#
./answers/PGnumericevaluators.pl:# Until we get the PG cacheing business sorted out, we need to use
./answers/PGnumericevaluators.pl:# PG_restricted_eval to get the correct values for some(?) PG environment
./answers/PGnumericevaluators.pl:# variables. We do this once here and place the values in lexicals for later
./answers/PGnumericevaluators.pl:# access.
./answers/PGnumericevaluators.pl:#########################################################################
./answers/PGnumericevaluators.pl:#########################################################################
./answers/PGnumericevaluators.pl:#########################################################################
./answers/PGnumericevaluators.pl:#########################################################################
./answers/PGnumericevaluators.pl:#legacy code for compatability purposes
./answers/PGnumericevaluators.pl:## Similar to std_num_cmp but accepts a list of numbers in the form
./answers/PGnumericevaluators.pl:## std_num_cmp_list(relpercentTol,format,ans1,ans2,ans3,...)
./answers/PGnumericevaluators.pl:## format is of the form "%10.3g" or "", i.e., a format suitable for sprintf(). Use "" for default
./answers/PGnumericevaluators.pl:## You must enter a format and tolerance
./answers/PGnumericevaluators.pl:## See std_num_cmp_list for usage
./answers/PGnumericevaluators.pl:## See std_num_cmp_list for usage
./answers/PGnumericevaluators.pl:## See std_num_cmp_list for usage
./answers/PGnumericevaluators.pl:## See std_num_cmp_list for usage
./answers/PGnumericevaluators.pl:## See std_num_cmp_list for usage
./answers/PGnumericevaluators.pl:## See std_num_cmp_list for usage
./answers/PGnumericevaluators.pl:## See std_num_cmp_list for usage
./answers/PGnumericevaluators.pl:## sub numerical_compare_with_units
./answers/PGnumericevaluators.pl:## Compares a number with units
./answers/PGnumericevaluators.pl:## Deprecated; use num_cmp()
./answers/PGnumericevaluators.pl:##
./answers/PGnumericevaluators.pl:## IN: a string which includes the numerical answer and the units
./answers/PGnumericevaluators.pl:## a hash with the following keys (all optional):
./answers/PGnumericevaluators.pl:## mode -- 'std', 'frac', 'arith', or 'strict'
./answers/PGnumericevaluators.pl:## format -- the format to use when displaying the answer
./answers/PGnumericevaluators.pl:## tol -- an absolute tolerance, or
./answers/PGnumericevaluators.pl:## relTol -- a relative tolerance
./answers/PGnumericevaluators.pl:## zeroLevel -- if the correct answer is this close to zero, then zeroLevelTol applies
./answers/PGnumericevaluators.pl:## zeroLevelTol -- absolute tolerance to allow when correct answer is close to zero
./answers/PGnumericevaluators.pl:# This mode is depricated. send input through num_cmp -- it can handle units.
./answers/PGnumericevaluators.pl:#
./answers/PGnumericevaluators.pl:# The original version, for backward compatibility
./answers/PGnumericevaluators.pl:# (can be removed when the Parser-based version is more fully tested.)
./answers/PGnumericevaluators.pl:#
./answers/PGnumericevaluators.pl:###############################################################################
./answers/PGnumericevaluators.pl:###############################################################################
./answers/Generic.pl:#From parserUtils.pl:
./answers/answerCustom.pl:# Set this to include any default parameters you want
./answers/answerCustom.pl:# to include in the custom answer checkers
./answers/answerCustom.pl:# Set this to include any default parameters you want
./answers/answerCustom.pl:# to include in the custom answer checkers.
./answers/PGstringevaluators.pl:################################
./answers/PGstringevaluators.pl:## STRING ANSWER FILTERS
./answers/PGstringevaluators.pl:## IN: --the string to be filtered
./answers/PGstringevaluators.pl:## --a list of the filters to use
./answers/PGstringevaluators.pl:##
./answers/PGstringevaluators.pl:## OUT: --the modified string
./answers/PGstringevaluators.pl:##
./answers/PGstringevaluators.pl:## Use this subroutine instead of the
./answers/PGstringevaluators.pl:## individual filters below it
./answers/PGstringevaluators.pl:## LOW-LEVEL ROUTINE -- NOT NORMALLY FOR END USERS -- USE WITH CAUTION
./answers/PGstringevaluators.pl:##
./answers/PGstringevaluators.pl:## IN: a hashtable with the following entries (error-checking to be added later?):
./answers/PGstringevaluators.pl:## correctAnswer -- the correct answer, before filtering
./answers/PGstringevaluators.pl:## filters -- reference to an array containing the filters to be applied
./answers/PGstringevaluators.pl:## type -- a string containing the type of answer evaluator in use
./answers/PGstringevaluators.pl:## OUT: a reference to an answer evaluator subroutine
./answers/answerHints.pl:#
./answers/answerHints.pl:# Calls the answer checker on two values with a copy of the answer hash
./answers/answerHints.pl:# and returns true if the two values match and false otherwise.
./answers/answerHints.pl:#
./answers/weightedGrader.pl:##################################################
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:# Issue ANS() calls for the weighted checkers
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:##################################################
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:# Issue NAMED_ANS() calls for the weighted checkers
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:##################################################
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:# Issue an ANS() call for the checker, giving
./answers/weightedGrader.pl:# credit to the given answers.
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:##################################################
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:# Either add a weight to an AnswerEvaluator, or return a
./answers/weightedGrader.pl:# new checker that adds the weight to its result. Also,
./answers/weightedGrader.pl:# add the "credit" field, if supplied.
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:##################################################
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:# This is the weighted grader. It uses an extra field added to the
./answers/weightedGrader.pl:# AnswerHash (named "weight") to tell how much weight to give each
./answers/weightedGrader.pl:# problem. The grader adds up the total weights for the correct
./answers/weightedGrader.pl:# answers. For partially correct ones, it uses the score for that
./answers/weightedGrader.pl:# answer to give a portion of that weight. For example, if the
./answers/weightedGrader.pl:# weight is 40 and the score for the answer is .5, then 20 is added
./answers/weightedGrader.pl:# to the total for the problem. (Note that most answer checkers only
./answers/weightedGrader.pl:# return 1 or 0, but they are allowed to return partial credit as
./answers/weightedGrader.pl:# well.)
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:# When the student's total is computed, it is divided by the sum of
./answers/weightedGrader.pl:# all the weights in order to determine the final score.
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:# It also uses a special field called "credit" that determines
./answers/weightedGrader.pl:# what other (named) answers are given full credit if the given
./answers/weightedGrader.pl:# answer is correct. This can be used to make "optional" answers,
./answers/weightedGrader.pl:# where getting the "final" answer right gives credit for the other parts.
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:##################################################
./answers/weightedGrader.pl:#
./answers/weightedGrader.pl:# Syntactic sugar to avoid ugly ~~& construct in PG.
./answers/weightedGrader.pl:#
./answers/PGmiscevaluators.pl:# added 6/14/2000 by David Etlinger
./answers/PGmiscevaluators.pl:# because of the conversion of the answer
./answers/PGmiscevaluators.pl:# string to an array, I thought it better not
./answers/PGmiscevaluators.pl:# to force STR_CMP() to work with this
./answers/PGmiscevaluators.pl:#added 2/26/2003 by Mike Gage
./answers/PGmiscevaluators.pl:# handled the case where multiple answers are passed as an array reference
./answers/PGmiscevaluators.pl:# rather than as a \0 delimited string.
./answers/PGmiscevaluators.pl:#added 6/28/2000 by David Etlinger
./answers/PGmiscevaluators.pl:#exactly the same as strict_str_cmp,
./answers/PGmiscevaluators.pl:#but more intuitive to the user
./answers/PGmiscevaluators.pl:# check that answer is really a string and not an array
./answers/PGmiscevaluators.pl:# also use ordinary string compare
./answers/extraAnswerEvaluators.pl:# ^uses loadMacros
./answers/extraAnswerEvaluators.pl:# ^package main
./answers/extraAnswerEvaluators.pl:# ^function mode2context
./answers/extraAnswerEvaluators.pl:# ^uses Parser::Context::getCopy
./answers/extraAnswerEvaluators.pl:# ^uses %context
./answers/extraAnswerEvaluators.pl:# ^uses $numZeroLevelTolDefault
./answers/extraAnswerEvaluators.pl:# ^uses $numAbsTolDefault
./answers/extraAnswerEvaluators.pl:# ^uses $numRelPercentTolDefault
./answers/extraAnswerEvaluators.pl:# ^uses $numFormatDefault
./answers/extraAnswerEvaluators.pl:# ^function interval_cmp
./answers/extraAnswerEvaluators.pl:# ^uses Context
./answers/extraAnswerEvaluators.pl:# ^uses mode2context
./answers/extraAnswerEvaluators.pl:# ^uses List
./answers/extraAnswerEvaluators.pl:# ^uses Union
./answers/extraAnswerEvaluators.pl:# ^function number_list_cmp
./answers/extraAnswerEvaluators.pl:# ^uses Context
./answers/extraAnswerEvaluators.pl:# ^uses mode2context
./answers/extraAnswerEvaluators.pl:# ^uses List
./answers/extraAnswerEvaluators.pl:# ^function equation_cmp
./answers/extraAnswerEvaluators.pl:# ^uses Equation_eval::equation_cmp
./answers/unorderedAnswer.pl:##########################################################################
./answers/unorderedAnswer.pl:#
./answers/unorderedAnswer.pl:# Low-level routine for handling unordered collections of answer checkers
./answers/unorderedAnswer.pl:#
./answers/unorderedAnswer.pl:##################################################
./answers/unorderedAnswer.pl:#
./answers/unorderedAnswer.pl:# AnswerChecker that allows a blank answer in a collection of unordered
./answers/unorderedAnswer.pl:# answer checkers. It will return "correct" for a blank answer only if
./answers/unorderedAnswer.pl:# all the other answers are correct. (The blankOK value is set by
./answers/unorderedAnswer.pl:# unordered_answer_list when this is true.) This lets you ask a question
./answers/unorderedAnswer.pl:# where the number of answers is not known (by the student) ahead of time.
./answers/unorderedAnswer.pl:#
./answers/PGasu.pl:# ^function auto_right
./answers/PGasu.pl:# ^uses AnswerEvaluator::new
./answers/PGasu.pl:# ^uses auto_right_checker
./answers/PGasu.pl:# used in auto_right above
./answers/PGasu.pl:# ^function auto_right_checker
./answers/PGasu.pl:# ^function no_decs
./answers/PGasu.pl:# ^uses must_have_filter
./answers/PGasu.pl:# ^uses raw_student_answer_filter
./answers/PGasu.pl:# ^uses catch_errors_filter
./answers/PGasu.pl:# ^function must_include
./answers/PGasu.pl:# ^uses must_have_filter
./answers/PGasu.pl:# ^uses raw_student_answer_filter
./answers/PGasu.pl:# ^uses catch_errors_filter
./answers/PGasu.pl:# ^function no_trig_fun
./answers/PGasu.pl:# ^uses fun_cmp
./answers/PGasu.pl:# ^uses must_have_filter
./answers/PGasu.pl:# ^uses catch_errors_filter
./answers/PGasu.pl:# ^function no_trig
./answers/PGasu.pl:# ^uses num_cmp
./answers/PGasu.pl:# ^uses must_have_filter
./answers/PGasu.pl:# ^uses catch_errors_filter
./answers/PGasu.pl:# ^function exact_no_trig
./answers/PGasu.pl:# ^uses num_cmp
./answers/PGasu.pl:# ^uses no_decs
./answers/PGasu.pl:# ^uses must_have_filter
./answers/PGasu.pl:# First argument is the string to have, or not have
./answers/PGasu.pl:# Second argument is optional, and tells us whether yes or no
./answers/PGasu.pl:# Third argument is the error message to produce (if any).
./answers/PGasu.pl:# ^function must_have_filter
./answers/PGasu.pl:# ^function catch_errors_filter
./answers/PGasu.pl:# ^function raw_student_answer_filter
./answers/PGasu.pl:# ^function no_decimal_list
./answers/PGasu.pl:# ^uses number_list_cmp
./answers/PGasu.pl:# ^function no_decimals
./answers/PGasu.pl:# ^uses std_num_cmp
./answers/PGasu.pl:# ^function with_comments
./answers/PGasu.pl:# ^function pc_evaluator
./answers/PGasu.pl:# ^function weighted_partial_grader
./answers/PGasu.pl:# ^uses $ENV{grader_message}
./answers/PGasu.pl:# ^uses $ENV{partial_weights}
./PG.pl:# This loads the basic css needed by pg.
./PG.pl:# It is expected that the requestor will also load the styles for Bootstrap.
./PG.pl:# Some problems use jquery-ui still, and so the requestor should also load the css for that if those problems are used,
./PG.pl:# although those problems should also be rewritten to not use jquery-ui.
./PG.pl:# This loads the basic javascript needed by pg.
./PG.pl:# It is expected that the requestor will also load MathJax, Bootstrap, and jquery.
./PG.pl:# Some problems use jquery-ui still, and so the requestor should also load the js for that if those problems are used,
./PG.pl:# although those problems should also be rewritten to not use jquery-ui.
./PG.pl:# sageReturnedFail checks to see if the return from Sage indicates some kind of failure
./PG.pl:# undefined means old style return (a simple string) failed
./PG.pl:# $obj->{success} defined but equal to zero means that the failed return and error
./PG.pl:# messages are encoded in the $obj hash.
./PG.pl:# The store_persistent_data, update_persistent_data, and get_persistent_data methods are deprecated and are only still
./PG.pl:# here for backward compatability. Use the persistent_data method instead which can do everything these three methods
./PG.pl:# can do. Note that if you use the persistent_data method, then you will need to join the values as strings if you want
./PG.pl:# that. Even better pass the persistent_data method an array reference containing the values so you can avoid the hassle
./PG.pl:# of splitting the values when they are retrieved.
./PG.pl:# This stores form data (such as sticky answers), but does nothing more.
./PG.pl:# It's a bit of hack since we are storing these in the
./PG.pl:# KEPT_EXTRA_ANSWERS queue even if they aren't answers per se.
./PG.pl:# Creates a new array element answer name and records it.
./PG.pl:#FIXME -- examine the difference between insert_response and extend_response
./PG.pl:# For radio buttons and checkboxes.
./PG.pl:# This is a stub for deprecated problems that call this method. Some of the GeoGebra
./PG.pl:# problems that do so actually work even though this method does nothing.
./PG.pl:## Problem Grader Subroutines
./PG.pl:#####################################
./PG.pl:# This is a model for plug-in problem graders
./PG.pl:#####################################
./PG.pl:# ^function install_problem_grader
./PG.pl:# ^uses PG_restricted_eval
./PG.pl:# ^uses %PG_FLAGS{PROBLEM_GRADER_TO_USE}
./PG.pl:# FIXME? The following functions were taken from the former
./PG.pl:# dangerousMacros.pl file and might have issues when placed here.
./PG.pl:#
./PG.pl:# Some constants that can be used in perl expressions
./PG.pl:#
./PG.pl:# ^function i
./PG.pl:# ^uses $_parser_loaded
./PG.pl:# ^uses &Complex::i
./PG.pl:# ^uses &Value::Package
./PG.pl:# ^function j
./PG.pl:# ^uses $_parser_loaded
./PG.pl:# ^uses &Value::Package
./PG.pl:# ^function k
./PG.pl:# ^uses $_parser_loaded
./PG.pl:# ^uses &Value::Package
./PG.pl:# ^function pi
./PG.pl:# ^uses $_parser_loaded
./PG.pl:# ^uses &Value::Package
./PG.pl:# ^function Infinity
./PG.pl:# ^uses $_parser_loaded
./PG.pl:# ^uses &Value::Package
./PG.pl:# ^function abs
./PG.pl:# ^function sqrt
./PG.pl:# ^function exp
./PG.pl:# ^function log
./PG.pl:# ^function sin
./PG.pl:# ^function cos
./PG.pl:# ^function atan2
./PG.pl:#
./PG.pl:# Allow these functions to be overridden without complaint.
./PG.pl:# (needed for log() to implement $useBaseTenLog)
./PG.pl:#
./PG.pl:#sub log {return CORE::log($_[0])};
./PG.pl:# used to be Parser::defineLog -- but that generated redefined notices
./capa/PG_CAPAmacros.pl:# these are very commonly needed files
./capa/PG_CAPAmacros.pl:#####################
./ui/PGchoicemacros.pl:# ^function new_match_list
./ui/PGchoicemacros.pl:# ^uses Match::new
./ui/PGchoicemacros.pl:# ^uses &std_print_q
./ui/PGchoicemacros.pl:# ^uses &std_print_a
./ui/PGchoicemacros.pl:# ^function new_select_list
./ui/PGchoicemacros.pl:# ^uses Select::new
./ui/PGchoicemacros.pl:# ^uses &std_print_q
./ui/PGchoicemacros.pl:# ^uses &std_print_a
./ui/PGchoicemacros.pl:# ^function new_pop_up_select_list
./ui/PGchoicemacros.pl:# ^uses Select::new
./ui/PGchoicemacros.pl:# ^uses &pop_up_list_print_q
./ui/PGchoicemacros.pl:# ^uses &std_print_a
./ui/PGchoicemacros.pl:# ^function new_multiple_choice
./ui/PGchoicemacros.pl:# ^uses Multiple::new
./ui/PGchoicemacros.pl:# ^uses &std_print_q
./ui/PGchoicemacros.pl:# ^uses &radio_print_a
./ui/PGchoicemacros.pl:# ^function new_checkbox_multiple_choice
./ui/PGchoicemacros.pl:# ^uses Multiple::new
./ui/PGchoicemacros.pl:# ^uses &std_print_q
./ui/PGchoicemacros.pl:# ^uses &checkbox_print_a
./ui/PGchoicemacros.pl:# ^function std_print_q
./ui/PGchoicemacros.pl:# ^function pop_up_list_print_q
./ui/PGchoicemacros.pl:# To put pop-up-list at the end of a question.
./ui/PGchoicemacros.pl:# contributed by Mark Schmitt 3-6-03
./ui/PGchoicemacros.pl:# ^function quest_first_pop_up_list_print_q
./ui/PGchoicemacros.pl:# To put pop-up-list in the middle of a question.
./ui/PGchoicemacros.pl:# contributed by Mark Schmitt 3-6-03
./ui/PGchoicemacros.pl:# ^function ans_in_middle_pop_up_list_print_q
./ui/PGchoicemacros.pl:# Units for physics class
./ui/PGchoicemacros.pl:# contributed by Mark Schmitt 3-6-03
./ui/PGchoicemacros.pl:# ^function units_list_print_q
./ui/PGchoicemacros.pl:#Standard method of printing answers in a matching list
./ui/PGchoicemacros.pl:# ^function std_print_a
./ui/PGchoicemacros.pl:#Alternate method of printing answers as a list of radio buttons for multiple choice
./ui/PGchoicemacros.pl:#Method for naming radio buttons is no longer round about and hackish
./ui/PGchoicemacros.pl:# ^function radio_print_a
./ui/PGchoicemacros.pl:# ^function checkbox_print_a
./ui/PGchoicemacros.pl:# ^function qa [DEPRECATED]
./ui/PGchoicemacros.pl:# ^function invert [DEPRECATED]
./ui/PGchoicemacros.pl:# ^function NchooseK [DEPRECATED]
./ui/PGchoicemacros.pl:# ^function shuffle [DEPRECATED]
./ui/PGchoicemacros.pl:# ^function match_questions_list [DEPRECATED]
./ui/PGchoicemacros.pl:# ^function match_questions_list_varbox [DEPRECATED]
./ui/unionTables.pl:# This could have been a variable,
./ui/unionTables.pl:# but all the other table commands are subroutines, so kept it
./ui/unionTables.pl:# one to be consistent.
./ui/unionLists.pl:######################################################################
./ui/unionLists.pl:##
./ui/unionLists.pl:## Functions used to make
and lists in HTML files
./ui/unionLists.pl:## and corresponding lists in TeX mode.
./ui/unionLists.pl:##
./ui/unionLists.pl:## BeginList() starts a list
./ui/unionLists.pl:## $ITEM start a list item
./ui/unionLists.pl:## $ITEMSEP puts spacing between items
./ui/unionLists.pl:## EndList() ends a list
./ui/unionLists.pl:##
./ui/unionLists.pl:## BeginParList() starts a list of paragraphs
./ui/unionLists.pl:## EndParList() ends such a list
./ui/unionLists.pl:##
./ui/unionLists.pl:#
./ui/unionLists.pl:# Syntactic sugar for making lists of paragraphs
./ui/unionLists.pl:#
./ui/unionLists.pl:#
./ui/unionLists.pl:# Use $ITEM to introduce a new list item
./ui/unionLists.pl:#
./ui/unionLists.pl:#
./ui/unionLists.pl:# This is a hack for when you want MSIE to handle
./ui/unionLists.pl:# space between list items properly
./ui/unionLists.pl:#
./ui/choiceUtils.pl:#
./ui/choiceUtils.pl:# A replacement for std_print_q that uses tables to align the questions, so
./ui/choiceUtils.pl:# that if a question wraps, it is properly indented.
./ui/choiceUtils.pl:#
./ui/alignedChoice.pl:######################################################################
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# Prints questions with the answer rule at the right, all aligned.
./ui/alignedChoice.pl:# (for use by AlignedList object below)
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:######################################################################
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# Genarate a new AlignedList object
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# $al = new_aligned_list(options)
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# Where "options" can be taken from among:
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# valign => "placement" Sets the vertical alignment for the table
./ui/alignedChoice.pl:# (default is valign => "MIDDLE")
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# align => "placement" Sets the horizontal aligmnent for the first
./ui/alignedChoice.pl:# column of the table
./ui/alignedChoice.pl:# (default is align => "RIGHT")
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# spacing => n Sets the CELLSPACING value for the table
./ui/alignedChoice.pl:# (default is spacing => 5)
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# tex_spacing => dimen Extra spacing between rows
./ui/alignedChoice.pl:# (default is tex_spacing => "0pt")
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# numbered => 1 or 0 1 means the problems should be numbered.
./ui/alignedChoice.pl:# 0 means no numbers for the problems.
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# equals => 1 or 0 1 means include a column of equal signs between
./ui/alignedChoice.pl:# the questions and the answer blocks.
./ui/alignedChoice.pl:# 0 means no column of equals.
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:# ans_rule_len => n Sets the length of the answer rule
./ui/alignedChoice.pl:#
./ui/alignedChoice.pl:#
./ui/niceTables.pl:# Make the outer table environment
./ui/niceTables.pl:# Takes the user's nested array and returns a cleaned up version with initializations
./ui/pccTables.pl:# This is just a redirect to niceTables.pl, which was originally called pccTables.pl
./ui/quickMatrixEntry.pl:# Allow promotion of Value::Matrix objects.
./ui/quickMatrixEntry.pl:# Backwards compatibility. This is deprecated and should not be used.
./ui/problemPanic.pl:#
./ui/problemPanic.pl:# The packge to contain the routines and data for the Panic buttons
./ui/problemPanic.pl:#
./ui/problemPanic.pl:#
./ui/problemPanic.pl:# Allow resets for instructors.
./ui/problemPanic.pl:# Look up the panic level and reset it if needed.
./ui/problemPanic.pl:# Save the panic level for the next time through.
./ui/problemPanic.pl:#
./ui/problemPanic.pl:#
./ui/problemPanic.pl:# Place a panic button on the page, if it's not hardcopy mode and its not at the wrong level.
./ui/problemPanic.pl:# You can set the label, the penalty for taking this hint, and the panic level for this button.
./ui/problemPanic.pl:# Use submitAnswers if it is before the due date, and checkAnswers otherwise.
./ui/problemPanic.pl:#
./ui/problemPanic.pl:#
./ui/problemPanic.pl:# The reset button
./ui/problemPanic.pl:#
./ui/problemPanic.pl:#
./ui/problemPanic.pl:# Handle HTML in the value
./ui/problemPanic.pl:#
./ui/problemPanic.pl:#
./ui/problemPanic.pl:# Install the panic grader, saving the original one
./ui/problemPanic.pl:#
./ui/problemPanic.pl:#
./ui/problemPanic.pl:# The grader for the panic levels.
./ui/problemPanic.pl:#
./ui/text2PG.pl:######################################################################
./ui/text2PG.pl:#
./ui/text2PG.pl:# Sanitize a text string for use with TEXT and EV3, so that
./ui/text2PG.pl:# non-math text is properly displayed in HTML mode and TeX
./ui/text2PG.pl:# mode. Newlines and blank lines can be converted to $BR and
./ui/text2PG.pl:# $PAR automatically.
./ui/text2PG.pl:#
./ui/text2PG.pl:# Format: text2PG(string [,options]);
./ui/text2PG.pl:#
./ui/text2PG.pl:# where options are from among:
./ui/text2PG.pl:#
./ui/text2PG.pl:# trimWhitespace => 0 or 1 Specifies if leading and trailing whitespace
./ui/text2PG.pl:# is removed before processing.
./ui/text2PG.pl:# Default: 1
./ui/text2PG.pl:#
./ui/text2PG.pl:# convertBlanklines => 0 or 1 Specifies whether blank lines should be
./ui/text2PG.pl:# turned into paragraph breaks.
./ui/text2PG.pl:# Default: 1
./ui/text2PG.pl:#
./ui/text2PG.pl:# convertNewlines => 0 or 1 Specifies whether newlines should be
./ui/text2PG.pl:# turned into line breaks.
./ui/text2PG.pl:# Default: 1
./ui/text2PG.pl:#
./ui/text2PG.pl:# sanitizeText => 0 or 1 Specifies whether to convert HTML and TeX
./ui/text2PG.pl:# special characters to printable form
./ui/text2PG.pl:# outside of math mode and commands.
./ui/text2PG.pl:# Default: 1
./ui/text2PG.pl:#
./ui/text2PG.pl:# allowCommands => 0 or 1 Specifies if text within command blocks
./ui/text2PG.pl:# is left unchanged (1) or not (0).
./ui/text2PG.pl:# Default: 0
./ui/text2PG.pl:#
./ui/text2PG.pl:# convertDollars => 0 or 1 Specifies whether dollar signs not followed
./ui/text2PG.pl:# by a letter should be replaced by ${DOLLAR}
./ui/text2PG.pl:# (you only want to do this if not passing
./ui/text2PG.pl:# the result through EV3 with variable
./ui/text2PG.pl:# substitutions).
./ui/text2PG.pl:# Default: 0
./ui/text2PG.pl:#
./ui/text2PG.pl:# doubleSlashes => 0 or 1 Specifies whether backslashes should be
./ui/text2PG.pl:# doubled (in preparation for passing
./ui/text2PG.pl:# into EV3).
./ui/text2PG.pl:# Default: 1
./ui/text2PG.pl:#
./deprecated/hhAdditionalMacros.pl:# additional macros developed in conjunction with the problems from
./deprecated/hhAdditionalMacros.pl:# the consortium (hughes-hallett) calculus text
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# written by Gavin LaRose,
./deprecated/hhAdditionalMacros.pl:# version 1.2
./deprecated/hhAdditionalMacros.pl:# 1.2: added reduced_frac()
./deprecated/hhAdditionalMacros.pl:# 1.1: added numorfun_cmp()
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# shufflemap
./deprecated/hhAdditionalMacros.pl:# produces a reference to a hash of indices from 0 to n-1 pointing to
./deprecated/hhAdditionalMacros.pl:# a random permutation of the same, and the index that points to 0
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# string_list_cmp
./deprecated/hhAdditionalMacros.pl:# check a comma-separated list of strings as student answers and
./deprecated/hhAdditionalMacros.pl:# check them with the standard str_cmp evaluator. this is really
./deprecated/hhAdditionalMacros.pl:# John Jones' number_list_cmp rewritten to be do string comparison
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# integrand_fun_cmp
./deprecated/hhAdditionalMacros.pl:# an answer evaluator that allows checking functions with 'dt' in them;
./deprecated/hhAdditionalMacros.pl:# redundant now that the Parser allows checking with multicharacter
./deprecated/hhAdditionalMacros.pl:# variables
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# numfun_cmp
./deprecated/hhAdditionalMacros.pl:# an answer evaluator that requires that the answer be
./deprecated/hhAdditionalMacros.pl:# simplified to the number given without returning an error if
./deprecated/hhAdditionalMacros.pl:# it's a function
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# numorfun_cmp
./deprecated/hhAdditionalMacros.pl:# an answer evaluator that first checks to see if the student answer
./deprecated/hhAdditionalMacros.pl:# checks correctly as a number, and if so returns that result; if not,
./deprecated/hhAdditionalMacros.pl:# repeats the check with a function checker and returns that. options
./deprecated/hhAdditionalMacros.pl:# for the respective checkers are provided as separate hash references
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# classify_cmp
./deprecated/hhAdditionalMacros.pl:# take a correct answer of the form "val=string, val=string.."
./deprecated/hhAdditionalMacros.pl:# and check a comma-separated list of student answers against these
./deprecated/hhAdditionalMacros.pl:# if the option 'order'=>'strict' is provided, requires that the
./deprecated/hhAdditionalMacros.pl:# answers be in the same order. any other options are passed to
./deprecated/hhAdditionalMacros.pl:# num_cmp to check the val entries; strings are checked with a
./deprecated/hhAdditionalMacros.pl:# standard str_cmp
./deprecated/hhAdditionalMacros.pl:# doesn't currently allow for passing in of a reference to an array
./deprecated/hhAdditionalMacros.pl:# of solutions to generate a list of evaluators, but that would be
./deprecated/hhAdditionalMacros.pl:# easy to add
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# integrand_fun_cmp
./deprecated/hhAdditionalMacros.pl:# an answer evaluator to allow checking functions with 'dt' in them
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# numfun_cmp
./deprecated/hhAdditionalMacros.pl:# an answer evaluator that requires that the answer be
./deprecated/hhAdditionalMacros.pl:# simplified to the number given without returning an error if
./deprecated/hhAdditionalMacros.pl:# it's a function
./deprecated/hhAdditionalMacros.pl:#
./deprecated/hhAdditionalMacros.pl:# numorfun_cmp
./deprecated/hhAdditionalMacros.pl:# an answer evaluator that first checks to see if the student answer
./deprecated/hhAdditionalMacros.pl:# checks correctly as a number, and if so returns that result; if not,
./deprecated/hhAdditionalMacros.pl:# repeats the check with a function checker and returns that.
./deprecated/hhAdditionalMacros.pl:#
./deprecated/unionProblem.pl:##################################################
./deprecated/unionProblem.pl:#
./deprecated/unionProblem.pl:# No longer needed since WW can output the grey
./deprecated/unionProblem.pl:# box automatically by changes in global.conf
./deprecated/unionProblem.pl:#
./deprecated/unionMacros.pl:######################################################################
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Some macros that add to the ones like $PAR, $BR, etc.
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Shorthand for WeBWorK
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# HTML(htmlcode)
./deprecated/unionMacros.pl:# HTML(htmlcode,texcode)
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Insert $html in HTML mode. In TeX mode, insert nothing for the first form,
./deprecated/unionMacros.pl:# and $tex for the second form.
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Begin and end indented text
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Start and stop centering
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Begin and end mode
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Begin and end mode
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Remove extra space in bold
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# tth doesn't seem to understand \colon
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Alternatives to the standard WW versions of these
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Common math sets
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Superscripts and subscript (mostly for if you want answer
./deprecated/unionMacros.pl:# rules in these positions).
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Browser-only BR
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Broser-only \displaystyle
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Provides a title to the problem
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# A warning that we are using javaScript
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:#
./deprecated/unionMacros.pl:# Modify a polynomial to remove coeficients of 1, -1 and 0
./deprecated/unionMacros.pl:# The polynomial can be a multivariable one. The parameters
./deprecated/unionMacros.pl:# following the formula itself are the names of the variables
./deprecated/unionMacros.pl:# for the formula. Any number can be provided, and the default
./deprecated/unionMacros.pl:# is x, y, and z. Variable names must be one character long,
./deprecated/unionMacros.pl:# and the formula really should be a polynomial, as the algorithm
./deprecated/unionMacros.pl:# for removing coefficients of 0 relies on that in an important way.
./deprecated/unionMacros.pl:#
./deprecated/parserUtils.pl:# not sure why these are loaded. They are not used in this file. If these are loaded
./deprecated/parserUtils.pl:# there is an error during the load_macros.t test.
./deprecated/parserUtils.pl:# loadMacros("unionImage.pl", "unionTables.pl",);
./deprecated/parserUtils.pl:# HTML(htmlcode)
./deprecated/parserUtils.pl:# HTML(htmlcode,texcode)
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:# Insert $html in HTML mode. In TeX mode, insert nothing for the first form,
./deprecated/parserUtils.pl:# and $tex for the second form.
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:# Begin and end mode
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:# Begin and end mode
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:# Block quotes
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:# Smart-quotes in TeX mode, regular quotes in HTML mode
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:#
./deprecated/parserUtils.pl:# make sure all characters are displayed
./deprecated/parserUtils.pl:#
./deprecated/CanvasObject.pl:#! /usr/bin/perl -w
./deprecated/CanvasObject.pl:# sub stateAndDebugBoxes { ## inserts both header text and object text
./deprecated/CanvasObject.pl:# #my $self = shift;
./deprecated/CanvasObject.pl:# my %options = @_;
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # determine debug mode
./deprecated/CanvasObject.pl:# # debugMode can be turned on by setting it to 1 in either the applet definition or at insertAll time
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# my $debugMode = (defined($options{debug}) and $options{debug}>0) ? $options{debug} : 0;
./deprecated/CanvasObject.pl:# my $includeAnswerBox = (defined($options{includeAnswerBox}) and $options{includeAnswerBox}==1) ? 1 : 0;
./deprecated/CanvasObject.pl:# $debugMode = $debugMode || 0; # $self->debugMode;
./deprecated/CanvasObject.pl:# #$self->debugMode( $debugMode);
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# my $reset_button = $options{reinitialize_button} || 0;
./deprecated/CanvasObject.pl:# warn qq! please change "reset_button=>1" to "reinitialize_button=>1" in the applet->installAll() command \n! if defined($options{reset_button});
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # Get data to be interpolated into the HTML code defined in this subroutine
./deprecated/CanvasObject.pl:# #
./deprecated/CanvasObject.pl:# # This consists of the name of the applet and the names of the routines
./deprecated/CanvasObject.pl:# # to get and set State of the applet (which is done every time the question page is refreshed
./deprecated/CanvasObject.pl:# # and to get and set Config which is the initial configuration the applet is placed in
./deprecated/CanvasObject.pl:# # when the question is first viewed. It is also the state which is returned to when the
./deprecated/CanvasObject.pl:# # reset button is pressed.
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# # prepare html code for storing state
./deprecated/CanvasObject.pl:# my $appletName = 'cv'; # $self->appletName;
./deprecated/CanvasObject.pl:# my $appletStateName = "${appletName}_state"; # the name of the hidden "answer" blank storing state FIXME -- use persistent data instead
./deprecated/CanvasObject.pl:# my $getState = 'getPoints()'; # $self->getStateAlias; # names of routines for this applet
./deprecated/CanvasObject.pl:# my $setState = 'setPoints()'; # $self->setStateAlias;
./deprecated/CanvasObject.pl:# my $getConfig = ''; # $self->getConfigAlias;
./deprecated/CanvasObject.pl:# my $setConfig = ''; # $self->setConfigAlias;
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# my $base64_initialState = ''; # encode_base64($self->initialState);
./deprecated/CanvasObject.pl:# main::RECORD_FORM_LABEL($appletStateName); #this insures that the state will be saved from one invocation to the next
./deprecated/CanvasObject.pl:# # FIXME -- with PGcore the persistant data mechanism can be used instead
./deprecated/CanvasObject.pl:# my $answer_value = '';
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # implement the sticky answer mechanism for maintaining the applet state when the question page is refreshed
./deprecated/CanvasObject.pl:# # This is important for guest users for whom no permanent record of answers is recorded.
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# if ( defined( ${$inputs_ref}{$appletStateName} ) and ${$main::inputs_ref}{$appletStateName} =~ /\S/ ) {
./deprecated/CanvasObject.pl:# $answer_value = ${$main::inputs_ref}{$appletStateName};
./deprecated/CanvasObject.pl:# } elsif ( defined( $main::rh_sticky_answers->{$appletStateName} ) ) {
./deprecated/CanvasObject.pl:# warn "type of sticky answers is ", ref( $main::rh_sticky_answers->{$appletStateName} );
./deprecated/CanvasObject.pl:# $answer_value = shift( @{ $main::rh_sticky_answers->{$appletStateName} });
./deprecated/CanvasObject.pl:# }
./deprecated/CanvasObject.pl:# $answer_value =~ tr/\\$@`//d; #`## make sure student answers cannot be interpolated by e.g. EV3
./deprecated/CanvasObject.pl:# $answer_value =~ s/\s+/ /g; ## remove excessive whitespace from student answer
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # insert a hidden answer blank to hold the applet's state
./deprecated/CanvasObject.pl:# # (debug =>1 makes it visible for debugging and provides debugging buttons)
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # Regularize the applet's state -- which could be in either XML format or in XML format encoded by base64
./deprecated/CanvasObject.pl:# # In rare cases it might be simple string -- protect against that by putting xml tags around the state
./deprecated/CanvasObject.pl:# # The result:
./deprecated/CanvasObject.pl:# # $base_64_encoded_answer_value -- a base64 encoded xml string
./deprecated/CanvasObject.pl:# # $decoded_answer_value -- and xml string
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# my $base_64_encoded_answer_value;
./deprecated/CanvasObject.pl:# my $decoded_answer_value;
./deprecated/CanvasObject.pl:# $answer_value = ''; #(defined( $answer_value) and $answer_value =~/\S/)? $answer_value : '';
./deprecated/CanvasObject.pl:# if ( $answer_value =~/$answer_value";
./deprecated/CanvasObject.pl:# $base_64_encoded_answer_value = $answer_value; # encode_base64($answer_value);
./deprecated/CanvasObject.pl:# $decoded_answer_value = $answer_value;
./deprecated/CanvasObject.pl:# }
./deprecated/CanvasObject.pl:# }
./deprecated/CanvasObject.pl:# $base_64_encoded_answer_value =~ s/\r|\n//g; # get rid of line returns
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # Construct answer blank for storing state -- in both regular (answer blank hidden)
./deprecated/CanvasObject.pl:# # and debug (answer blank displayed) modes.
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # debug version of the applet state answerBox and controls (all displayed)
./deprecated/CanvasObject.pl:# # stored in
./deprecated/CanvasObject.pl:# # $debug_input_element
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# my $debug_input_element = qq!\n !;
./deprecated/CanvasObject.pl:# if ($getState=~/\S/) { # if getStateAlias is not an empty string
./deprecated/CanvasObject.pl:# $debug_input_element .= qq!
./deprecated/CanvasObject.pl:# !;
./deprecated/CanvasObject.pl:# }
./deprecated/CanvasObject.pl:# if ($setState=~/\S/) { # if setStateAlias is not an empty string
./deprecated/CanvasObject.pl:# $debug_input_element .= qq!
./deprecated/CanvasObject.pl:# !;
./deprecated/CanvasObject.pl:# }
./deprecated/CanvasObject.pl:# if ($getConfig=~/\S/) { # if getConfigAlias is not an empty string
./deprecated/CanvasObject.pl:# $debug_input_element .= qq!
./deprecated/CanvasObject.pl:# !;
./deprecated/CanvasObject.pl:# }
./deprecated/CanvasObject.pl:# if ($setConfig=~/\S/) { # if setConfigAlias is not an empty string
./deprecated/CanvasObject.pl:# $debug_input_element .= qq!
./deprecated/CanvasObject.pl:# !;
./deprecated/CanvasObject.pl:# }
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # Construct answerblank for storing state
./deprecated/CanvasObject.pl:# # using either the debug version (defined above) or the non-debug version
./deprecated/CanvasObject.pl:# # where the state variable is hidden and the definition is very simple
./deprecated/CanvasObject.pl:# # stored in
./deprecated/CanvasObject.pl:# # $state_input_element
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# my $state_input_element = ($debugMode) ? $debug_input_element :
./deprecated/CanvasObject.pl:# qq!\n!;
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # Construct the reset button string (this is blank if the button is not to be displayed
./deprecated/CanvasObject.pl:# # $reset_button_str
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# my $reset_button_str = ($reset_button) ?
./deprecated/CanvasObject.pl:# qq! !
./deprecated/CanvasObject.pl:# : '' ;
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # Combine the state_input_button and the reset button into one string
./deprecated/CanvasObject.pl:# # $state_storage_html_code
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# $state_storage_html_code = qq!!
./deprecated/CanvasObject.pl:# . $state_input_element. $reset_button_str
./deprecated/CanvasObject.pl:# ;
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # Construct the answerBox (if it is requested). This is a default input box for interacting
./deprecated/CanvasObject.pl:# # with the applet. It is separate from maintaining state but it often contains similar data.
./deprecated/CanvasObject.pl:# # Additional answer boxes or buttons can be defined but they must be explicitly connected to
./deprecated/CanvasObject.pl:# # the applet with additional javaScript commands.
./deprecated/CanvasObject.pl:# # Result: $answerBox_code
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# my $answerBox_code ='';
./deprecated/CanvasObject.pl:# if ($includeAnswerBox) {
./deprecated/CanvasObject.pl:# if ($debugMode) {
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# $answerBox_code = $main::BR . main::NAMED_ANS_RULE('answerBox', 50 );
./deprecated/CanvasObject.pl:# $answerBox_code .= qq!
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# !;
./deprecated/CanvasObject.pl:# } else {
./deprecated/CanvasObject.pl:# $answerBox_code = main::NAMED_HIDDEN_ANS_RULE('answerBox', 50 );
./deprecated/CanvasObject.pl:# }
./deprecated/CanvasObject.pl:# }
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # insert header material
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# #main::HEADER_TEXT($self->insertHeader());
./deprecated/CanvasObject.pl:# # update the debug mode for this applet.
./deprecated/CanvasObject.pl:# main::HEADER_TEXT(qq!!);
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:# # Return HTML or TeX strings to be included in the body of the page
./deprecated/CanvasObject.pl:# ##########################
./deprecated/CanvasObject.pl:#
./deprecated/CanvasObject.pl:# return main::MODES(TeX=>' {\bf applet } ',
./deprecated/CanvasObject.pl:# #HTML=>$self->insertObject.$main::BR.$state_storage_html_code.$answerBox_code);
./deprecated/CanvasObject.pl:# HTML=>$main::BR.$state_storage_html_code.$answerBox_code
./deprecated/CanvasObject.pl:# );
./deprecated/CanvasObject.pl:# }
./deprecated/regrfnsPG.pl:# functions for simple linear regression in perl
./deprecated/regrfnsPG.pl:#/* "a","b" are the two endpoints of the range of
./deprecated/regrfnsPG.pl:# random integers to be produced. */
./deprecated/regrfnsPG.pl:# inputs $a,$b are integers
./deprecated/regrfnsPG.pl:#sub rndgen
./deprecated/regrfnsPG.pl:#{ local($a,$b,$r);
./deprecated/regrfnsPG.pl:# $a=$_[0]; $b=$_[1];
./deprecated/regrfnsPG.pl:# $r=rand($b-$a+1); # in (0,b-a+1)
./deprecated/regrfnsPG.pl:# #print $a," ",$b," ",$r,"\n";
./deprecated/regrfnsPG.pl:# $r=int($r)+$a; # between a,b inclusive
./deprecated/regrfnsPG.pl:# $r;
./deprecated/regrfnsPG.pl:#}
./deprecated/regrfnsPG.pl:# N (size of population) and ssize (sample size) are inputs
./deprecated/regrfnsPG.pl:# simple linear regression
./deprecated/regrfnsPG.pl:# input xvec, yvec : assumed as one vector here
./deprecated/regrfnsPG.pl:# output ($n,$xbar,$ybar,$sx2,$sy2,$sxy,$b0,$b1,$sse,$mse,$x0);
./deprecated/regrfnsPG.pl:# subpopulation mean at x0
./deprecated/regrfnsPG.pl:#sqrt(mse*(1/n+(x0-xbar)^2/((n-1)*sx2)))
./deprecated/regrfnsPG.pl:# input : output of lsreg, plus x0
./deprecated/regrfnsPG.pl:# or ($n,$xbar,$ybar,$sx2,$sy2,$sxy,$b0,$b1,$sse,$mse,$x0);
./deprecated/regrfnsPG.pl:# output: point estimate and SE
./deprecated/regrfnsPG.pl:#prediction interval at x=x0
./deprecated/regrfnsPG.pl:#sqrt(mse*(1+1/n+(x0-xbar)^2/((n-1)*sx2)))
./deprecated/regrfnsPG.pl:# input : output of lsreg, plus x0
./deprecated/regrfnsPG.pl:# ($n,$xbar,$ybar,$sx2,$sy2,$sxy,$b0,$b1,$sse,$mse,$x0);
./deprecated/regrfnsPG.pl:# output: point estimate and SE
./deprecated/PGunion.pl:#
./deprecated/PGunion.pl:# Load most of the interesting code developed at Union.
./deprecated/PGunion.pl:#
./deprecated/freemanMacros.pl:#sam# copied from bkellMacros.pl -- no reason to maintain two macro files.
./deprecated/freemanMacros.pl:#sam# FIXME -- these should probably lose their "bkell_" prefixes.
./deprecated/freemanMacros.pl:# bkellMacros.pl
./deprecated/freemanMacros.pl:# Brian Kell
./deprecated/freemanMacros.pl:# Last updated 3:24 CDT, 24 Jun 2007
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_linear_simplify($a, $b)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns a string representing $a*x+$b in simplified form, where "simplified"
./deprecated/freemanMacros.pl:# means something along the lines of the following:
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# a b output
./deprecated/freemanMacros.pl:# --- --- ------
./deprecated/freemanMacros.pl:# 0 0 0
./deprecated/freemanMacros.pl:# 1 1 x+1
./deprecated/freemanMacros.pl:# -1 -1 -x-1
./deprecated/freemanMacros.pl:# -1 5 5-x
./deprecated/freemanMacros.pl:# 2 0 2x
./deprecated/freemanMacros.pl:# -4 3 3-4x
./deprecated/freemanMacros.pl:# -4 -3 -4x-3
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_simplify_fraction($num, $denom)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Simplifies the fraction $num/$denom; returns the list ($num, $denom).
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_simplify_fraction_string($num, $denom [, $flags])
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns a string like "$num/$denom" in simplified form. If the string $flags
./deprecated/freemanMacros.pl:# contains "+", then a leading "+" is included if the fraction is non-negative.
./deprecated/freemanMacros.pl:# If $flags contains "0", then a fraction with a value of 0 will cause the
./deprecated/freemanMacros.pl:# empty string to be returned. If $flags contains "1", then a fraction with a
./deprecated/freemanMacros.pl:# value of 1 or -1 will cause only the sign to be returned (or the empty
./deprecated/freemanMacros.pl:# string, if the fraction is non-negative and $flags does not contain "+"). If
./deprecated/freemanMacros.pl:# $flags contains "(", then parentheses will be placed around "$num/$denom"
./deprecated/freemanMacros.pl:# (the sign, if it exists, will be outside the parentheses); if $flags contains
./deprecated/freemanMacros.pl:# "[", then parentheses will be used only if a sign is used and the denominator
./deprecated/freemanMacros.pl:# is other than 1. A flag of "(" overrides "]". If $flags contains "f", then
./deprecated/freemanMacros.pl:# the string returned will be in the form "{$num \over $denom}" instead of the
./deprecated/freemanMacros.pl:# normal slashed version.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_poly_term($coeff_num, $coeff_denom, $var [, "+"])
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Produces and simplifies a term of a polynomial of the general form
./deprecated/freemanMacros.pl:# "($coeff_num/$coeff_denom)$var". Handles special cases (such as $num==0,
./deprecated/freemanMacros.pl:# $denom==1, etc.). If the fourth argument is "+", then a leading "+" is
./deprecated/freemanMacros.pl:# included if the term is positive.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_gcd($x, $y)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns the greatest common divisor of $x and $y.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_poly_eval($x, $a_n, ..., $a_0)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Evaluates the polynomial a_n*x^n + ... + a_1*x + a_0 at the given value of x.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_real_zeros_finder($a_n, ..., $a_0)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns a list of numerical approximations of the zeros of the polynomial
./deprecated/freemanMacros.pl:# a_n*x^n + ... + a_1*x + a_0, in order from least to greatest.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# The possibility of overflow or underflow is ignored. Overflow is likely to be
./deprecated/freemanMacros.pl:# a bigger problem than underflow.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Do not use this code to guide missiles or control nuclear power plants.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_floor($x)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns the floor of $x. Normally this would be done with POSIX::floor, but
./deprecated/freemanMacros.pl:# WeBWorK doesn't allow you to use standard modules like POSIX.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_ceil($x)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns the ceiling of $x.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_sigfigs($x, $n)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns a string containing $x rounded to $n significant figures.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_125($x)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns the value logarithmically nearest $x in the sequence
./deprecated/freemanMacros.pl:# ..., -1000, -500, -200, -100, -50, -20, -10, -5, -2, -1, -0.5, -0.2,
./deprecated/freemanMacros.pl:# -0.1, -0.05, -0.02, -0.01, ..., 0, ..., 0.01, 0.02, 0.05, 0.1,
./deprecated/freemanMacros.pl:# 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, ... .
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_list_random_selection($n, @list)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns a selection of $n distinct elements of @list. This is like
./deprecated/freemanMacros.pl:# list_random_multi_uniq in freemanMacros.pl, except that this function will
./deprecated/freemanMacros.pl:# always return the elements in the same order as they appear in @list.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:###############################################################################
./deprecated/freemanMacros.pl:# bkell_graph_axis($a, $b)
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:# Returns a list ($min, $max, $step), where $min <= $a, $max >= $b, $step is a
./deprecated/freemanMacros.pl:# power of 10, $min and $max are multiples of $step, abs($min) <= 9*$step, and
./deprecated/freemanMacros.pl:# abs($max) <= 9*$step. Useful for deciding bounds for the axis of a graph. For
./deprecated/freemanMacros.pl:# example, to make a graph axis that can handle values between $a and $b, call
./deprecated/freemanMacros.pl:# bkell_graph_axis, and then set the minimum value of the axis to $min and the
./deprecated/freemanMacros.pl:# maximum to $max, and put tick marks every $step units.
./deprecated/freemanMacros.pl:#
./deprecated/freemanMacros.pl:####################################################################### EOF ###
./deprecated/PeriodicRerandomization.pl:###########################
./deprecated/unionMessages.pl:######################################################################
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:# How to say "infinity"
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:######################################################################
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:# A message that can be included (within BEGIN_TEXT and END_TEXT)
./deprecated/unionMessages.pl:# to tell the student how to enter infinity and minus infinity.
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:######################################################################
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:# A message to tell students how to enter "Does not exist".
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:######################################################################
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:# A message to tell students how to enter unions and infinities
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:######################################################################
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:# A message to tell students how to enter lists of intervals
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:######################################################################
./deprecated/unionMessages.pl:#
./deprecated/unionMessages.pl:# A message for lists of unions
./deprecated/unionMessages.pl:#
./deprecated/unionUtils.pl:######################################################################
./deprecated/unionUtils.pl:##
./deprecated/unionUtils.pl:## These are some miscellaneous routines that may be useful.
./deprecated/unionUtils.pl:##
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:# Remove leading and trailing spaces
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:# Check if a string is a number
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:# names for numbers
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:# A debugging routine that allows the "warn" function to print a variable that
./deprecated/unionUtils.pl:# contains HTML code properly
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:# Make a named subroutine that returns the value of a function. If
./deprecated/unionUtils.pl:# no parameters are passed to the function, the function's string
./deprecated/unionUtils.pl:# is returned. (This will be obsolete when I finish the
./deprecated/unionUtils.pl:# new expression parser -- DPVC.)
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:#
./deprecated/unionUtils.pl:# A hack to pick display mode in HTML modes, but plain math mode
./deprecated/unionUtils.pl:# in TeX modes. This makes fractions appear better in HTML mode,
./deprecated/unionUtils.pl:# without making it worse in TeX modes. This is for use with
./deprecated/unionUtils.pl:# AlignedList objects.
./deprecated/unionUtils.pl:#
./deprecated/problemPreserveAnswers.pl:######################################################################
./deprecated/Dartmouthmacros.pl:#!/usr/bin/perl
./deprecated/Dartmouthmacros.pl:# this is equivalent to use strict, but can be used within the Safe compartment.
./deprecated/Dartmouthmacros.pl:## Some local macros
./deprecated/Dartmouthmacros.pl:## Want mod(a,b) but perl and int are flawed
./deprecated/Dartmouthmacros.pl:## Fudge for roundoff error
./deprecated/Dartmouthmacros.pl:## Compute the product of a scalar and a vector (scalar first)
./deprecated/Dartmouthmacros.pl:## Compute the sum of two vectors
./deprecated/Dartmouthmacros.pl:## Perl doesn't seem to have builtin array arithmetic
./deprecated/Dartmouthmacros.pl:## Compute the difference of two vectors
./deprecated/Dartmouthmacros.pl:## Compute the length of a vector
./deprecated/Dartmouthmacros.pl:## Computes the dot product of two vectors (assumed of the same dimension)
./deprecated/Dartmouthmacros.pl:## Compute the maximum value in a list
./deprecated/Dartmouthmacros.pl:#sub max {
./deprecated/Dartmouthmacros.pl:# ## Put the paramters passed into an array of values
./deprecated/Dartmouthmacros.pl:# my @values = @_;
./deprecated/Dartmouthmacros.pl:#
./deprecated/Dartmouthmacros.pl:# ## Initialize maximum value to first element
./deprecated/Dartmouthmacros.pl:# my $max = $values[0];
./deprecated/Dartmouthmacros.pl:#
./deprecated/Dartmouthmacros.pl:# my $i;
./deprecated/Dartmouthmacros.pl:# for ($i=1; $i <= $#values; $i++)
./deprecated/Dartmouthmacros.pl:# {
./deprecated/Dartmouthmacros.pl:# if ($values[$i] > $max) {
./deprecated/Dartmouthmacros.pl:# $max = $values[$i];
./deprecated/Dartmouthmacros.pl:# }
./deprecated/Dartmouthmacros.pl:# }
./deprecated/Dartmouthmacros.pl:# return $max;
./deprecated/Dartmouthmacros.pl:#}
./deprecated/Dartmouthmacros.pl:## Compute the minimum value in a list
./deprecated/Dartmouthmacros.pl:#sub min {
./deprecated/Dartmouthmacros.pl:# ## Put the paramters passed into an array of values
./deprecated/Dartmouthmacros.pl:# my @values = @_;
./deprecated/Dartmouthmacros.pl:#
./deprecated/Dartmouthmacros.pl:# ## Initialize minimum value to first element
./deprecated/Dartmouthmacros.pl:# my $min = $values[0];
./deprecated/Dartmouthmacros.pl:#
./deprecated/Dartmouthmacros.pl:# my $i;
./deprecated/Dartmouthmacros.pl:# for ($i=1; $i <= $#values; $i++)
./deprecated/Dartmouthmacros.pl:# {
./deprecated/Dartmouthmacros.pl:# if ($values[$i] < $min) {
./deprecated/Dartmouthmacros.pl:# $min = $values[$i];
./deprecated/Dartmouthmacros.pl:# }
./deprecated/Dartmouthmacros.pl:# }
./deprecated/Dartmouthmacros.pl:# return $min
./deprecated/Dartmouthmacros.pl:#}
./deprecated/Dartmouthmacros.pl:## clean_scalar_string is invoked to make expressions like "$a x" look
./deprecated/Dartmouthmacros.pl:## better when $a = 0, -1, 1
./deprecated/Dartmouthmacros.pl:## Usage: clean_scalar_string(scalar, "quoted string");
./deprecated/Dartmouthmacros.pl:## Example: clean_scalar_string(-1,"\pi") returns "-\pi"
./deprecated/Dartmouthmacros.pl:## Computes the greatest common divisor of two integers
./deprecated/Dartmouthmacros.pl:## Example: gcd(-300, 125) returns 25
./deprecated/Dartmouthmacros.pl:## reduced_fraction takes a pair of integers $numerator, $denominator
./deprecated/Dartmouthmacros.pl:## ($denominator != 0) and returns an array of two elements @fraction
./deprecated/Dartmouthmacros.pl:## $fraction[0] is the reduced numerator; $fraction[1] the reduced
./deprecated/Dartmouthmacros.pl:## denominator
./deprecated/Dartmouthmacros.pl:## Puts the sign of the fraction, if negative, in the numerator
./deprecated/Dartmouthmacros.pl:##
./deprecated/Dartmouthmacros.pl:## Usage: @fraction = reduced_fraction($numerator, $denominator)
./deprecated/Dartmouthmacros.pl:##
./deprecated/Dartmouthmacros.pl:## reduced numerator
./deprecated/Dartmouthmacros.pl:## reduced denominator
./deprecated/Dartmouthmacros.pl:## Given Cartesian coordinates x and y returns an
./deprecated/Dartmouthmacros.pl:## array the zeroth element which is the radius
./deprecated/Dartmouthmacros.pl:## and the first element which is the argument
./deprecated/Dartmouthmacros.pl:## 0 <= theta < 2*pi
./deprecated/Dartmouthmacros.pl:##
./deprecated/Dartmouthmacros.pl:## Returns r=0 theta=0 for the origin
./deprecated/Dartmouthmacros.pl:##
./deprecated/Dartmouthmacros.pl:## Cylindarical coordinates from polar routine
./deprecated/Dartmouthmacros.pl:## Spherical Coordinates from polar routine
./deprecated/Dartmouthmacros.pl:##
./deprecated/BrockPhysicsMacros.pl:# this file defines all Brock-Physics-specific macros.
./deprecated/compoundProblem.pl:######################################################################
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# This package implements a method of handling multi-part problems
./deprecated/compoundProblem.pl:# that show only a single part at any one time. The students can
./deprecated/compoundProblem.pl:# work on one part at a time, and then when they get it right (or
./deprecated/compoundProblem.pl:# under other circumstances deterimed by the professor), they can
./deprecated/compoundProblem.pl:# move on to the next part. Students cannot return to earlier parts
./deprecated/compoundProblem.pl:# once they have been completed. The score for problem as a whole is
./deprecated/compoundProblem.pl:# made up from the scores on the individual parts, and the relative
./deprecated/compoundProblem.pl:# weighting of the various parts can be specified by the problem
./deprecated/compoundProblem.pl:# author.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# To use the compoundProblem library, use
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# loadMacros("compoundProblem.pl");
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# at the top of your file, and then create a compoundProblem object
./deprecated/compoundProblem.pl:# via the command
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp = new compoundProblem(options)
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# where '$cp' is the name of a variable that you will use to
./deprecated/compoundProblem.pl:# refer to the compound problem, and 'options' can include:
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# parts => n The number of parts in the problem.
./deprecated/compoundProblem.pl:# Default: 1
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# weights => [n1,...,nm] The relative weights to give to each
./deprecated/compoundProblem.pl:# part in the problem. For example,
./deprecated/compoundProblem.pl:# weights => [2,1,1]
./deprecated/compoundProblem.pl:# would cause the first part to be worth 50%
./deprecated/compoundProblem.pl:# of the points (twice the amount for each of
./deprecated/compoundProblem.pl:# the other two), while the second and third
./deprecated/compoundProblem.pl:# part would be worth 25% each. If weights
./deprecated/compoundProblem.pl:# are not supplied, the parts are weighted
./deprecated/compoundProblem.pl:# by the number of answer blanks in each part
./deprecated/compoundProblem.pl:# (and you must provide the total number of
./deprecated/compoundProblem.pl:# blanks in all the parts by supplying the
./deprecated/compoundProblem.pl:# totalAnswers option).
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# totalAnswers => n The total number of answer blanks in all
./deprecated/compoundProblem.pl:# the parts put together (this is used when
./deprecated/compoundProblem.pl:# computing the per-part scores, if part
./deprecated/compoundProblem.pl:# weights are not provided).
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# saveAllAnswers => 0 or 1 Usually, the contents of named answer blanks
./deprecated/compoundProblem.pl:# from previous parts are made available to
./deprecated/compoundProblem.pl:# later parts using variables with the
./deprecated/compoundProblem.pl:# same name as the answer blank. Setting
./deprecated/compoundProblem.pl:# saveAllAnswers to 1 will cause ALL answer
./deprecated/compoundProblem.pl:# blanks to be available (via variables
./deprecated/compoundProblem.pl:# like $AnSwEr1, and so on).
./deprecated/compoundProblem.pl:# Default: 0
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# parserValues => 0 or 1 Determines whether the answers from previous
./deprecated/compoundProblem.pl:# parts are returned as MathObjects (like
./deprecated/compoundProblem.pl:# those returned from Real(), Vector(), etc)
./deprecated/compoundProblem.pl:# or as strings (the unparsed contents of the
./deprecated/compoundProblem.pl:# student answer). If you intend to use the
./deprecated/compoundProblem.pl:# previous answers as numbers, for example,
./deprecated/compoundProblem.pl:# you would want to set this to 1 so that you
./deprecated/compoundProblem.pl:# would get the final result of any formula
./deprecated/compoundProblem.pl:# the student typed, rather than the formula
./deprecated/compoundProblem.pl:# itself as a character string.
./deprecated/compoundProblem.pl:# Default: 0
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# nextVisible => type Tells when the "go on to the next part" option
./deprecated/compoundProblem.pl:# is available to the student. The possible
./deprecated/compoundProblem.pl:# types include:
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# 'ifCorrect' next is available only when
./deprecated/compoundProblem.pl:# all the answers are correct.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# 'Always' next is always available
./deprecated/compoundProblem.pl:# (but remember that students
./deprecated/compoundProblem.pl:# can't go back once they go
./deprecated/compoundProblem.pl:# on.)
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# 'Never' next is never allowed (the
./deprecated/compoundProblem.pl:# problem will control going
./deprecated/compoundProblem.pl:# on to the next part itself).
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Default: 'ifCorrect'
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# nextStyle => type Determines the style of "next" indicator to display
./deprecated/compoundProblem.pl:# (when it is available). The type can be one of:
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# 'CheckBox' a checkbox that allows the students
./deprecated/compoundProblem.pl:# to go on to the next part when they
./deprecated/compoundProblem.pl:# submit their answers.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# 'Button' a button that submits their answers
./deprecated/compoundProblem.pl:# and goes on to the next part.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# 'Forced' forces the student to go on to the
./deprecated/compoundProblem.pl:# next part the next time they submit
./deprecated/compoundProblem.pl:# answers.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# 'HTML' allows you to provide an arbitrary
./deprecated/compoundProblem.pl:# HTML string of your own.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Default: 'Checkbox'
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# nextLabel => string Specifies the string to use as the label for the checkbox,
./deprecated/compoundProblem.pl:# the name of the button, the text of the message indicating
./deprecated/compoundProblem.pl:# that the next submit will move to the next part, or the
./deprecated/compoundProblem.pl:# HTML string, depending on the setting of nextStyle above.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# nextNoChange => 0 or 1 Since the students must submit their answers again to go on
./deprecated/compoundProblem.pl:# to the next part, it is possible for them to change their
./deprecated/compoundProblem.pl:# answers before they submit, and if nextVisible is 'ifCorrect'
./deprecated/compoundProblem.pl:# they might go on to the next without having correct answers
./deprecated/compoundProblem.pl:# stored. This option lets you control whether the answers
./deprecated/compoundProblem.pl:# are checked against the previous ones before going on to the
./deprecated/compoundProblem.pl:# next part. If the answers don't match, a warning is issued
./deprecated/compoundProblem.pl:# and they are not allowed to move on.
./deprecated/compoundProblem.pl:# Default: 1
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# allowReset => 0 or 1 Determines whether a "Go back to the first part" checkbox
./deprecated/compoundProblem.pl:# is provided on parts 2 and later. This is intended for
./deprecated/compoundProblem.pl:# the professor during testing of the problem (otherwise
./deprecated/compoundProblem.pl:# it would be impossible to go back to earlier parts).
./deprecated/compoundProblem.pl:# Default: 0
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# resetLabel => string The string used to label the reset checkbox.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Once you have created a compoundProblem object, you can use $cp->part to
./deprecated/compoundProblem.pl:# determine the part that the student is working on, and use 'if' statements
./deprecated/compoundProblem.pl:# to display the proper information for the given part. The compoundProblem
./deprecated/compoundProblem.pl:# object takes care of maintaining the data as the parts change. (See the
./deprecated/compoundProblem.pl:# compoundProblem.pg file for an example of a compound problem.)
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# In order to handle the scoring of the problem as a whole when only part is
./deprecated/compoundProblem.pl:# showing, the compoundProblem object uses its own problem grader to manage
./deprecated/compoundProblem.pl:# the scores, and calls your own grader from there. The default is to use
./deprecated/compoundProblem.pl:# the one that was installed before the compoundProblem object was created,
./deprecated/compoundProblem.pl:# or avg_problem_grader if none was installed. You can specify a different
./deprecated/compoundProblem.pl:# one using the $cp->useGrader() method (see below). It is important that
./deprecated/compoundProblem.pl:# you NOT call install_problem_grader() yourself once you have created the
./deprecated/compoundProblem.pl:# compoundProblem object, as that would disable the special grader, causing
./deprecated/compoundProblem.pl:# the compound problem to fail to work properly.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# You may call the following methods once you have a compoundProblem:
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->part Returns the part the student is working on.
./deprecated/compoundProblem.pl:# $cp->part(n) Sets the part to be part n, as long as the
./deprecated/compoundProblem.pl:# student has finished the preceeding parts.
./deprecated/compoundProblem.pl:# If not, the part is set to the highest
./deprecated/compoundProblem.pl:# one the student hasn't completed, and he
./deprecated/compoundProblem.pl:# can work up to the given part. (The
./deprecated/compoundProblem.pl:# nextVisible option is set to 'ifCorrect' if
./deprecated/compoundProblem.pl:# it was 'Never' so that students can go on
./deprecated/compoundProblem.pl:# once they finish the earlier parts.)
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->useGrader(code_ref) Supplies your own grader to use in
./deprecated/compoundProblem.pl:# place of the default one. For example:
./deprecated/compoundProblem.pl:# $cp->useGrader(~~&std_problem_grader);
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->score Returns the (weighted) score for this part.
./deprecated/compoundProblem.pl:# Note that this is the score shown at the bottom
./deprecated/compoundProblem.pl:# of the page on which the student pressed submit
./deprecated/compoundProblem.pl:# (not the score for the answers the student is
./deprecated/compoundProblem.pl:# submitting -- that is not available until
./deprecated/compoundProblem.pl:# after the body of the problem has been created).
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->scoreRaw Returns the unweighted score for this part.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->scoreOverall Returns the overall score for the problem
./deprecated/compoundProblem.pl:# so far.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->addAnswers(list) Make additional answer blanks be available
./deprecated/compoundProblem.pl:# from one part to another. E.g.,
./deprecated/compoundProblem.pl:# $cp->addAnswers('AnSwEr1');
./deprecated/compoundProblem.pl:# would make the first unnamed blank be available
./deprecated/compoundProblem.pl:# in later parts as well. (This command should
./deprecated/compoundProblem.pl:# be issued only when the part containing the
./deprecated/compoundProblem.pl:# given answer blank is displayed.)
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->nextCheckbox(label) Returns the HTML string for the "go on to next
./deprecated/compoundProblem.pl:# part" checkbox so you can use it in the body of
./deprecated/compoundProblem.pl:# the problem if you wish. This should not be
./deprecated/compoundProblem.pl:# inserted when the $displayMode is 'TeX'. If the
./deprecated/compoundProblem.pl:# label is not given or is blank, the default label
./deprecated/compoundProblem.pl:# is used.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->nextButton(label) Returns the HTML string for the "go on to next
./deprecated/compoundProblem.pl:# part" button so you can use it in the body of
./deprecated/compoundProblem.pl:# the problem if you wish. This should not be
./deprecated/compoundProblem.pl:# inserted when the $displayMode is 'TeX'. If the
./deprecated/compoundProblem.pl:# label is not given or is blank, the default label
./deprecated/compoundProblem.pl:# is used.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->nextForces(label) Returns the HTML string for the forced "go on to
./deprecated/compoundProblem.pl:# next part" so you can use it in the body of
./deprecated/compoundProblem.pl:# the problem if you wish. This should not be
./deprecated/compoundProblem.pl:# inserted when the $displayMode is 'TeX'. If the
./deprecated/compoundProblem.pl:# label is not given or is blank, the default label
./deprecated/compoundProblem.pl:# is used.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->reset Go back to part 1, clearing the answers
./deprecated/compoundProblem.pl:# and score. (Best used when debugging problems.)
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# $cp->resetCheckbox(label) Returns the HTML string for the reset checkbox
./deprecated/compoundProblem.pl:# so that you can provide one within the body
./deprecated/compoundProblem.pl:# of the problem if you wish. This should not be
./deprecated/compoundProblem.pl:# inserted when the $displayMode is 'TeX'. If the
./deprecated/compoundProblem.pl:# label is not given or is blank, the default label
./deprecated/compoundProblem.pl:# will be used.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:######################################################################
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# The state data that is stored between invocations of
./deprecated/compoundProblem.pl:# the problem.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Create a new instance of the compound Problem and initialize
./deprecated/compoundProblem.pl:# it. This includes reading the status from the previous
./deprecated/compoundProblem.pl:# parts, defining the variables from the answers to previous parts,
./deprecated/compoundProblem.pl:# and setting up the grader so that the current data can be saved.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Compute the total of the weights so that the parts can
./deprecated/compoundProblem.pl:# be properly scaled.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Look up the status from the previous invocation
./deprecated/compoundProblem.pl:# and see if we need to go on to the next part.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Initialize the current part by setting the ans_rule
./deprecated/compoundProblem.pl:# count (so that later parts will get unique answer names),
./deprecated/compoundProblem.pl:# installing the grader (to save the data), and setting
./deprecated/compoundProblem.pl:# the variables for previous answers.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Look through the list of answer labels and set
./deprecated/compoundProblem.pl:# the variables for them to be the associated student
./deprecated/compoundProblem.pl:# answer. Make it a Parser value if requested.
./deprecated/compoundProblem.pl:# Record the value so that is will be available
./deprecated/compoundProblem.pl:# again on the next invocation.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Look to see is any answers have changed on this
./deprecated/compoundProblem.pl:# invocation of the problem.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Go on to the next part, updating the status
./deprecated/compoundProblem.pl:# to include the data from the old part so that
./deprecated/compoundProblem.pl:# it will be properly preserved when the next
./deprecated/compoundProblem.pl:# part is showing.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:######################################################################
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Encode all the status information so that it can be
./deprecated/compoundProblem.pl:# maintained as the student submits answers. Since this
./deprecated/compoundProblem.pl:# state information includes things like the score from
./deprecated/compoundProblem.pl:# the previous parts, it is "encrypted" using a dumb
./deprecated/compoundProblem.pl:# hex encoding (making it harder for a student to recognize
./deprecated/compoundProblem.pl:# it as valuable data if they view the page source).
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Decode the data and break it into the status hash.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Hex encoding is shifted by 10 to obfuscate it further.
./deprecated/compoundProblem.pl:# (shouldn't be a problem since the status will be made of
./deprecated/compoundProblem.pl:# printable characters, so they are all above ASCII 32)
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Make sure the data can be properly preserved within
./deprecated/compoundProblem.pl:# an HTML tag.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:######################################################################
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Set the grader for this part to the specified one.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Make additional answer blanks from the current part
./deprecated/compoundProblem.pl:# be preserved for use in future parts.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Go back to part 1 and clear the answers and scores.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Return the HTML for the "Go back to part 1" checkbox.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Return the HTML for the "next part" checkbox.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Return the HTML for the "next part" button.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Return the HTML for when going to the next part is forced.
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Return the raw HTML provided
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:######################################################################
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Return the current part, or try to set the part to the given
./deprecated/compoundProblem.pl:# part (returns the part actually set, which may be earlier if
./deprecated/compoundProblem.pl:# the student didn't complete an earlier part).
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# Return the various scores
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:######################################################################
./deprecated/compoundProblem.pl:#
./deprecated/compoundProblem.pl:# The custom grader that does the work of computing the scores
./deprecated/compoundProblem.pl:# and saving the data.
./deprecated/compoundProblem.pl:#
./deprecated/PGcomplexmacros.pl:# export functions from Complex1.
./deprecated/PGcomplexmacros.pl:# You need to add
./deprecated/PGcomplexmacros.pl:#
./deprecated/PGcomplexmacros.pl:# sub i();
./deprecated/PGcomplexmacros.pl:#
./deprecated/PGcomplexmacros.pl:# to your problem in order to use expressions such as 1 +3*i;
./deprecated/PGcomplexmacros.pl:# Without this prototype you would have to write 1+3*i();
./deprecated/PGcomplexmacros.pl:# The prototype has to be defined at compile time.
./deprecated/PGcomplexmacros.pl:# Complex1::display_format('cartesian');
./deprecated/PGcomplexmacros.pl:# number format used frequently in strict prefilters
./deprecated/PGcomplexmacros.pl:#########################################################################
./deprecated/PGcomplexmacros.pl:########################################################################
./deprecated/PGcomplexmacros.pl:# Output is text displaying the complex numver in "e to the i theta" form. The
./deprecated/PGcomplexmacros.pl:# formats for the argument theta is determined by the option C and the
./deprecated/PGcomplexmacros.pl:# format for the modulus is determined by the C option.
./deprecated/PGcomplexmacros.pl:#this basically just checks for "e^" which unfortunately will show something like (e^4)*i as a polar, this should be changed
./deprecated/PGcomplexmacros.pl:## allows only for numbers of the form a+bi and ae^(bi), where a and b are strict numbers
./deprecated/PGcomplexmacros.pl:## allows only for the form a + bi, where a and b are strict numbers
./deprecated/PGcomplexmacros.pl:## allows only for the form ae^(bi), where a and b are strict numbers
./deprecated/PGcomplexmacros.pl:#this subroutine mearly captures what is before and after the "e**" it does not verify that the "i" is there, or in the
./deprecated/PGcomplexmacros.pl:#exponent this must eventually be addresed
./deprecated/PGcomplexmacros.pl:# changes default to display as a polar
./deprecated/PGcomplexmacros.pl:# this does not seem to be in use, so I'm commenting it out. Mike Gage 6/27/05
./deprecated/PGcomplexmacros.pl:# sub cplx_cmp2 {
./deprecated/PGcomplexmacros.pl:####.............###########
./deprecated/PGcomplexmacros.pl:# }
./deprecated/PGcomplexmacros.pl:# this does not seem to be in use, so I'm commenting it out. Mike Gage 6/27/05
./deprecated/PGcomplexmacros.pl:# sub cplx_cmp_mult {
./deprecated/PGcomplexmacros.pl:####.............###########
./deprecated/PGcomplexmacros.pl:# }
./deprecated/PGcomplexmacros.pl:# this does not seem to be in use, so I'm commenting it out. Mike Gage 6/27/05
./deprecated/PGcomplexmacros.pl:# sub answer_mult{
./deprecated/PGcomplexmacros.pl:####.............###########
./deprecated/PGcomplexmacros.pl:# }
./deprecated/PGcomplexmacros.pl:#
./deprecated/PGcomplexmacros.pl:# sub multi_cmp_old{
./deprecated/PGcomplexmacros.pl:####.............###########
./deprecated/PGcomplexmacros.pl:# }
./deprecated/PGcomplexmacros.pl:# this does not seem to be in use, so I'm commenting it out. Mike Gage 6/27/05
./deprecated/PGcomplexmacros.pl:# sub mult_cmp{
./deprecated/PGcomplexmacros.pl:####.............###########
./deprecated/PGcomplexmacros.pl:# }
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 1) Formats an expression without negative exponents
./deprecated/CofIdaho_macros.pl:# Thanks to John Jones at ASU for this macro.
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 2) Checks for units
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 3) Checks for rounded percents
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 4) Checks both sides of an equation model the word problem.
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 5) Checks both sides of an equation for the slope-intercept form of a line.
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 6) Checks for function notation in an equality.
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 7) Checks factors of polynomials.
./deprecated/CofIdaho_macros.pl:# Note: Student's answers must be of the form: monomial(poly)...(poly) with
./deprecated/CofIdaho_macros.pl:# or without parentheses about the monomial. The polynomial factors must
./deprecated/CofIdaho_macros.pl:# not contain any other grouping symbols and, in any case, only parenthesis
./deprecated/CofIdaho_macros.pl:# may be used. This needs to be in the instructions for any set that uses
./deprecated/CofIdaho_macros.pl:# this macro (in the screenHeader.pg file).
./deprecated/CofIdaho_macros.pl:# Note: "StrictFactoringEvaluator" requires leading negatives to be factored out.
./deprecated/CofIdaho_macros.pl:# This not may not work with all situations. BE SURE TO CHANGE THIS FILE IF THE
./deprecated/CofIdaho_macros.pl:# FactoringEvaluator IS CHANGED!!
./deprecated/CofIdaho_macros.pl:#---------For diagnosing problems--------------------------------------
./deprecated/CofIdaho_macros.pl:# $ans_hash->setKeys( 'ans_message' =>"FYI: Not checking correctly.
./deprecated/CofIdaho_macros.pl:# AnswerHashScore: $ans_hash->{score} :
./deprecated/CofIdaho_macros.pl:# Student: $#student_factors, $student_ans,
./deprecated/CofIdaho_macros.pl:# Formatted: $format_student_ans,
./deprecated/CofIdaho_macros.pl:# Student Factors: $student_factors[0], $student_factors[1],
./deprecated/CofIdaho_macros.pl:# : Correct: $#factors, $factors[0], $factors[1],
./deprecated/CofIdaho_macros.pl:# Number matched: $CorrectFactors");
./deprecated/CofIdaho_macros.pl:#----------------------------------------------------------------------
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 8) Checks for simplified rational expressions.
./deprecated/CofIdaho_macros.pl:# Note: Student's answers must be of the form: (poly)/(poly)
./deprecated/CofIdaho_macros.pl:#
./deprecated/CofIdaho_macros.pl:#---------For diagnosing problems--------------------------------------
./deprecated/CofIdaho_macros.pl:# $ans_hash->setKeys( 'ans_message' =>"FYI: Not checking correctly.
./deprecated/CofIdaho_macros.pl:# Student: $student_num, $student_den,$student_ans;
./deprecated/CofIdaho_macros.pl:# Answer: $num,$den,$ans");
./deprecated/CofIdaho_macros.pl:#----------------------------------------------------------------------
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 9) Writes a fraction in reduced form.
./deprecated/CofIdaho_macros.pl:#
./deprecated/CofIdaho_macros.pl:###################################################################
./deprecated/CofIdaho_macros.pl:# 10) Checks a list of equations.
./deprecated/CofIdaho_macros.pl:# Designed for checking a list of asymptotes
./deprecated/unionInclude.pl:######################################################################
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:# Routines to make it easier to include additional PG files within
./deprecated/unionInclude.pl:# a given one. These files don't have to be in the courseScripts
./deprecated/unionInclude.pl:# directory; rather, they are assumed to be relative to the directory
./deprecated/unionInclude.pl:# containing the calling PG file.
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:######################################################################
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:# Usage: includePGfile(name)
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:# where name is the name of a PG file (relative to the directory
./deprecated/unionInclude.pl:# of the file containing this call).
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:######################################################################
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:# Usage: includeRandomProblem(file1,file2,...,fileN);
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:# where the fileNs are the names of the files from which
./deprecated/unionInclude.pl:# to choose (relative to the directory of the file containing
./deprecated/unionInclude.pl:# this call).
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:# To use this, make one PG file that include the call to this
./deprecated/unionInclude.pl:# random routine, and then include it the set definition file
./deprecated/unionInclude.pl:# as many times as you want (up to N times). A different problem
./deprecated/unionInclude.pl:# will be included for each instance in the set definition file.
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:# Legacy code no longer needed. The included file can contain
./deprecated/unionInclude.pl:# BEGIN_INCLUSION(); and END_INCLUSION(); in place of DOCUMENT()
./deprecated/unionInclude.pl:# and ENDDOCUMENT(); calls.
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:######################################################################
./deprecated/unionInclude.pl:#
./deprecated/unionInclude.pl:# This is a service routine for includeRandomProblem() above.
./deprecated/unionInclude.pl:# It an array of k numbers chosen from 0 to n-1, but preserves the
./deprecated/unionInclude.pl:# random seed so that the included problem won't be affected by
./deprecated/unionInclude.pl:# this function, and replaces it by the psvn, so that the list
./deprecated/unionInclude.pl:# produced will be the same each time it is called.
./deprecated/unionInclude.pl:#
./deprecated/problemRandomize.pl:######################################################################
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# The state data that is stored between invocations of
./deprecated/problemRandomize.pl:# the problem.
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Cache original grader installer (so we can override it).
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Create new problemRandomize object from user's data
./deprecated/problemRandomize.pl:# and initialize it.
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Look up the status from the previous invocation
./deprecated/problemRandomize.pl:# and check to see if a rerandomization is requested
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Initialize the current problem
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Clear the answers and re-randomize the seed
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:##################################################
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Return the HTML for the "re-randomize" checkbox.
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Return the HTML for the "next part" button.
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Return the HTML for the "problem seed" input box
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Return the raw HTML provided
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:##################################################
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Encode all the status information so that it can be
./deprecated/problemRandomize.pl:# maintained as the student submits answers. Since this
./deprecated/problemRandomize.pl:# state information includes things like the score from
./deprecated/problemRandomize.pl:# the previous parts, it is "encrypted" using a dumb
./deprecated/problemRandomize.pl:# hex encoding (making it harder for a student to recognize
./deprecated/problemRandomize.pl:# it as valuable data if they view the page source).
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Decode the data and break it into the status hash.
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Hex encoding is shifted by 10 to obfuscate it further.
./deprecated/problemRandomize.pl:# (shouldn't be a problem since the status will be made of
./deprecated/problemRandomize.pl:# printable characters, so they are all above ASCII 32)
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Make sure the data can be properly preserved within
./deprecated/problemRandomize.pl:# an HTML tag.
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:##################################################
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Set the grader for this part to the specified one.
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# The custom grader that does the work of computing the scores
./deprecated/problemRandomize.pl:# and saving the data.
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:#
./deprecated/problemRandomize.pl:# Fake grader for when the problem is reset
./deprecated/problemRandomize.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Set up some styles and the jQuery calls for opening and closing the scaffolds.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# The Scaffoling package
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Create a new Scaffold object
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Access scores (grades). These are set using
./deprecated/compoundProblem5.pl:# the PROCESS_ANSWERS method below.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Add answer evaluators to a section
./deprecated/compoundProblem5.pl:# If the section is already displayed ($section->{section_answers} exists),
./deprecated/compoundProblem5.pl:# Get the answer labels and add them to the scaffold and section
./deprecated/compoundProblem5.pl:# Otherwise we pick them up in the new_answers() call.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:###########################################
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Create a displayed section.
./deprecated/compoundProblem5.pl:# Pass it the name of the section and the contents,
./deprecated/compoundProblem5.pl:# or use [$name,options] or {name => ..., options}
./deprecated/compoundProblem5.pl:# as the first argument.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# The "section" option defaults to the next section number.
./deprecated/compoundProblem5.pl:# The "iscorrect" option defaults to checking the answers
./deprecated/compoundProblem5.pl:# given in this section.
./deprecated/compoundProblem5.pl:# The "canshow" option defaults to checking if the user
./deprecated/compoundProblem5.pl:# is an instructor or if the answers in all
./deprecated/compoundProblem5.pl:# previous sections are correct.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# The data for a section includes the section number and options,
./deprecated/compoundProblem5.pl:# plus the names of the answer checkers from the previous sections,
./deprecated/compoundProblem5.pl:# the names of the checkers for this section, and answer checker
./deprecated/compoundProblem5.pl:# count from before and after this section (used for highlighting
./deprecated/compoundProblem5.pl:# the results table), and the rendered text for the section.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Display a section using PGML rather than BEGIN_TEXT/END_TEXT notation
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Return a boolean array where a 1 means that answer blank has
./deprecated/compoundProblem5.pl:# an answer evaluator assigned to it and 0 means not.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Get the names of any of the original answer blanks that now have
./deprecated/compoundProblem5.pl:# evaluators attached.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# When all the sections have been created and the answers checked,
./deprecated/compoundProblem5.pl:# the sections are processed to tell if they should be opened or not
./deprecated/compoundProblem5.pl:# and what color they should be.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Process an answer check.
./deprecated/compoundProblem5.pl:# If the check is code, call it on the given section,
./deprecated/compoundProblem5.pl:# Otherwise (a string), evaluate it and die if there are errors.
./deprecated/compoundProblem5.pl:# return the result.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Call the answer evaluator on all answers, and record the scores
./deprecated/compoundProblem5.pl:# so that we can use them in iscorrect and canshow checks.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Run through the output looking for sections, processing each as it
./deprecated/compoundProblem5.pl:# is found, replacing the temporary identification line with the
./deprecated/compoundProblem5.pl:# final result of processing the section. Keep track of the first
./deprecated/compoundProblem5.pl:# incorrect section so that it can be opened when the page is displayed.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Standard way of processing answers and sections,
./deprecated/compoundProblem5.pl:# leaving the usual one open.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Add CSS to dim the rows of the table that are not
./deprecated/compoundProblem5.pl:# in the open section. (When a section is marked correct,
./deprecated/compoundProblem5.pl:# the next section will be opened, so the correct answers
./deprecated/compoundProblem5.pl:# will be dimmed, and the new section's blank rows will be
./deprecated/compoundProblem5.pl:# active. That may be a downside to the dimming.)
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Add a solution to a section. The default section is the previously
./deprecated/compoundProblem5.pl:# defined one, but you can also specify a section to add to in the
./deprecated/compoundProblem5.pl:# options.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Add answers in the current section.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Service routine to check for whether all the answers in a section
./deprecated/compoundProblem5.pl:# are correct. (Used as the default for the iscorrect option of a
./deprecated/compoundProblem5.pl:# section.)
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Service routine to check for whether all the previous answers in a
./deprecated/compoundProblem5.pl:# section are correct, or whether the user is an instructor. (Used
./deprecated/compoundProblem5.pl:# as the default for the canshow option of a section.)
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Checks the scores to see if they are all correct (returns 1),
./deprecated/compoundProblem5.pl:# all are answered but at least one is wrong (returns 0), or
./deprecated/compoundProblem5.pl:# some are blank (returns undef).
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Checks whether all the given answers are correct or not.
./deprecated/compoundProblem5.pl:# The arguments are either names of named answers blanks, or
./deprecated/compoundProblem5.pl:# numbers indicating the n-th unnamed answer blank.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# This can be used in the iscorrect or canshow options for a
./deprecated/compoundProblem5.pl:# section in order to customize when it will be considered
./deprecated/compoundProblem5.pl:# correct or can be opened.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Opens the given sections so they are open when the page loads.
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:#
./deprecated/compoundProblem5.pl:# Syntactic sugar to make it easier to call these routines. Note
./deprecated/compoundProblem5.pl:# that you can't use these if you want to have nested scaffolds, as
./deprecated/compoundProblem5.pl:# they rely on a global variable to store the active scaffold.
./deprecated/compoundProblem5.pl:#
./deprecated/answerUtils.pl:##########################################################################
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:# Utility routines for answer checkers
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:#########################################################################
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:# Evaluate an answer checker with a given student answer.
./deprecated/answerUtils.pl:# (works with old- and new-style answer checkers)
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:# Call an answer evaluator (works for new- and old-style checkers)
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:# Clear the error condition for an answer evaluator
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:# Get the answer hash for a given evaluator
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:# Make error messages returned by answer checkers prettier
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:# Return the string or a blank string (if it was not defined)
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:#
./deprecated/answerUtils.pl:# Check for preview mode
./deprecated/answerUtils.pl:#
./deprecated/Alfredmacros.pl:# A group of macros used in the Alfred problem library.
./deprecated/Alfredmacros.pl:# Given a point (x,y) this macro computes the angle with respect to x-axis. The angle will be between 0 and 2pi.
./deprecated/Alfredmacros.pl:## Compute the max and min of an array of numbers
./deprecated/Alfredmacros.pl:#This macro prevents students from double clicking in an answer box. This macro #is necessary for multiple integral problems where the answer box is typeset
./deprecated/Alfredmacros.pl:#into the integration symbols.
./deprecated/Alfredmacros.pl:#The problems that have the answer box in the limits must be displayed in JS
./deprecated/Alfredmacros.pl:#math mode. This macro warns the user to use JS math mode if they are not.
./deprecated/Alfredmacros.pl:#This subroutine includes the Strang's textbook into a problem, you have to
./deprecated/Alfredmacros.pl:#feed it the chapter and section. It is assumed that the book is in the course
./deprecated/Alfredmacros.pl:#directory and is labeled strangtextbook. The parameters are
./deprecated/Alfredmacros.pl:#strang(chapter,section,(optional) section title.
./deprecated/Alfredmacros.pl:#example \{&strang(16,5,"surface integrals")\}.
./deprecated/Alfredmacros.pl:#Inserts a link to a trig table in the problem.
./deprecated/Alfredmacros.pl:#example \{&trig_table()\}
./deprecated/Alfredmacros.pl:#we will associate each student answer with a prime number, noting which student answer is in which blank. This allows us to make use of the fundamental theorem of arithmetic.
./deprecated/Alfredmacros.pl:#at this point they don't have a matched set of blanks correct. look for a single function in each pair that is right. You have to make sure you only get one for each pair of answer blanks.
./deprecated/Alfredmacros.pl:### To use the macros your problem must include unionTables.pl, and of course Alfredmacros.pl
./deprecated/Alfredmacros.pl:### Table integral returns a string that can be included in a Table to output an integral whose upper and lower limits
./deprecated/Alfredmacros.pl:### of integration can be answer blanks. There are several optional parameters:
./deprecated/Alfredmacros.pl:### width - change the width of the answer blanks. defaults to 3.
./deprecated/Alfredmacros.pl:### lowerwidth - change the width of the lower answer blank. defaults to width
./deprecated/Alfredmacros.pl:### upperwidth - change the width of the upper answer blank. defaults to width.
./deprecated/Alfredmacros.pl:### upper - the uppper limit of integration, does not have to be an answer blank, defaults to answer blank with width "width"
./deprecated/Alfredmacros.pl:### lower - the lower limit of integration, does not have to be an answer blank, defaults to answer blank with width "width"
./deprecated/Alfredmacros.pl:### limits - boolean, if 1 puts the limits of integration above and below the integral symbol, if 0 puts them after the integral symbol.
./deprecated/Alfredmacros.pl:### default is 1.
./deprecated/Alfredmacros.pl:### Your code must include unionTables.pl, and of course Alfredmacros.pl
./deprecated/Alfredmacros.pl:### An example:
./deprecated/Alfredmacros.pl:### \{BeginTable(center=>0).
./deprecated/Alfredmacros.pl:### Row([tableintegral(),
./deprecated/Alfredmacros.pl:### ],separation=>2).
./deprecated/Alfredmacros.pl:### EndTable();
./deprecated/Alfredmacros.pl:### \}
./deprecated/Alfredmacros.pl:### which will print an integral with answer blank on the upper and lower limits with the default length of 3
./deprecated/Alfredmacros.pl:###
./deprecated/Alfredmacros.pl:### This example prints out a double integral, the first integral with answer blanks with width 10, the second integral
./deprecated/Alfredmacros.pl:### has 0 for the lower limit of integration and an answer blank with width 5 for the upper limit of integration.
./deprecated/Alfredmacros.pl:### The default limits of integratin are answer blanks with width 3, in this case the default width was overridden to 5
./deprecated/Alfredmacros.pl:### and the default lower limit was changed to a zero.
./deprecated/Alfredmacros.pl:### \{BeginTable(center=>0).
./deprecated/Alfredmacros.pl:### Row([tableintegral(width=>10,limits=>'\(0\)'),tableintegral(width=>5,lower=>'\(0\)',limits=>0),
./deprecated/Alfredmacros.pl:### ],separation=>2).
./deprecated/Alfredmacros.pl:### EndTable();
./deprecated/Alfredmacros.pl:### \}
./deprecated/Alfredmacros.pl:### An example where the width of the upper and lower answer blanks have different widths.
./deprecated/Alfredmacros.pl:### \{BeginTable(center=>0).
./deprecated/Alfredmacros.pl:### Row([tableintegral(lowerwidth=>10,upperwidth=>1)
./deprecated/Alfredmacros.pl:### ],separation=>2).
./deprecated/Alfredmacros.pl:### EndTable();
./deprecated/Alfredmacros.pl:### \}
./deprecated/Alfredmacros.pl:# a sum with answer blanks for the summation variable, lower limit, and upper limit
./deprecated/Alfredmacros.pl:#\{ BeginTable(center=>0).
./deprecated/Alfredmacros.pl:# Row([tablesum(width=>10),
./deprecated/Alfredmacros.pl:# ],separation=>2).
./deprecated/Alfredmacros.pl:# EndTable();
./deprecated/Alfredmacros.pl:#\}
./deprecated/Alfredmacros.pl:# a sum with answer blanks for the upper and lower limits, and the summation variable is i
./deprecated/Alfredmacros.pl:#\{ BeginTable(center=>0).
./deprecated/Alfredmacros.pl:# Row([tablesum(width=>10,sumvariable=>'i'),
./deprecated/Alfredmacros.pl:# ],separation=>2).
./deprecated/Alfredmacros.pl:# EndTable();
./deprecated/Alfredmacros.pl:#\}
./deprecated/Alfredmacros.pl:# a sum with answer blanks for the upper and lower limits, and summation variable is not used.
./deprecated/Alfredmacros.pl:#\{ BeginTable(center=>0).
./deprecated/Alfredmacros.pl:# Row([tablesum(width=>10,usesumvariable=>0),
./deprecated/Alfredmacros.pl:# ],separation=>2).
./deprecated/Alfredmacros.pl:# EndTable();
./deprecated/Alfredmacros.pl:#\}
./deprecated/Alfredmacros.pl:# sum from n = 1 to infinity
./deprecated/Alfredmacros.pl:#\{ BeginTable(center=>0).
./deprecated/Alfredmacros.pl:# Row([tablesum(sumvariable=>'\(n\)',lower=>'\(1\)', upper=>'\(\hskip 3pt\infty\)') ],separation=>2).
./deprecated/Alfredmacros.pl:# EndTable();
./deprecated/Alfredmacros.pl:#\}
./deprecated/Alfredmacros.pl:### Create a vertical bar with an upper and lower limit.
./deprecated/Alfredmacros.pl:### Create a subscripted character
./deprecated/Alfredmacros.pl:### Create a superscripted character
./deprecated/Alfredmacros.pl:### A fraction
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# This file implements discussion-based questions, where the student
./deprecated/answerDiscussion.pl:# can provide essay-style answers, and the professor can make comments
./deprecated/answerDiscussion.pl:# on those. The student and professor can continue to respond to
./deprecated/answerDiscussion.pl:# either other, and so carry on a mathematical discussion. The
./deprecated/answerDiscussion.pl:# discussion is private between the professor and student, with
./deprecated/answerDiscussion.pl:# each student carrying on a separate discussion with the professor.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# The professor can view a list of the students in the class with links
./deprecated/answerDiscussion.pl:# to their discussions, and indications of how many new messages there
./deprecated/answerDiscussion.pl:# are in each.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# The messages can contain mathematics by enclosing it with \(...\)
./deprecated/answerDiscussion.pl:# for in-line mathematics and \[...\] for display-mode math. The
./deprecated/answerDiscussion.pl:# mathematics is entered in TeX format. It is also possible to use
./deprecated/answerDiscussion.pl:# Parser strings that are like the ones students give in normal formula
./deprecated/answerDiscussion.pl:# answer blanks. These are enclosed in `...` or ``...`` for in-line
./deprecated/answerDiscussion.pl:# and display modes. For example `sin(x/(x+1))` would have the same
./deprecated/answerDiscussion.pl:# effect as \(\sin\!\left(\frac{x}{x+1}\right)\), but is somewhat easier
./deprecated/answerDiscussion.pl:# to read. [FIXME: a more complete Context() needs to be provided
./deprecated/answerDiscussion.pl:# for this.]
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# To make discussions work properly, the professor must set up two files:
./deprecated/answerDiscussion.pl:# one called courseStudentList.pg and one called courseProfessorList.pg,
./deprecated/answerDiscussion.pl:# with the first containing a list of the userID's of the students in the
./deprecated/answerDiscussion.pl:# course and the second containing a list of the professor ID's. Sample
./deprecated/answerDiscussion.pl:# files are provided that you can place in your course templates/macros
./deprecated/answerDiscussion.pl:# directory and edit to suit your needs. Without these files, the
./deprecated/answerDiscussion.pl:# professor functions will not operate properly, though the students
./deprecated/answerDiscussion.pl:# could still create entries on their own.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# To start a duscussion, simply assign answerDiscussion.pg to any homework
./deprecated/answerDiscussion.pl:# set. That's it. The professors can write messages that are visible
./deprecated/answerDiscussion.pl:# to all the students, so such a message could be used to provide the
./deprecated/answerDiscussion.pl:# starting question for a discussion, for example. Or the problem could
./deprecated/answerDiscussion.pl:# be used by the student to keep a "math journal" for the course (you would
./deprecated/answerDiscussion.pl:# want to be sure to keep the homework set open for the whole course in
./deprecated/answerDiscussion.pl:# this case).
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# This code is currently considered experimental, and there are still features
./deprecated/answerDiscussion.pl:# the need to be added, but it gives a sense of what is possible.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# The defaults for the discussion
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Create a new discussion object
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# make it easier to access the TEXT command in main::
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# True if the user is a professor
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Get the list of professors from the courseProfessorList.pg file.
./deprecated/answerDiscussion.pl:# (At some point this could be obtained from the database.) We
./deprecated/answerDiscussion.pl:# fail silently if the file can't be read.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Get the list of students from the courseStudentList.pg file.
./deprecated/answerDiscussion.pl:# (At some point this could be taken from the database.)
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Create a partial URL used for links that maintain the current data on the page.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Look up the styles from the answerDiscussion.css file.
./deprecated/answerDiscussion.pl:# This can be overridden by putting a modified copy in
./deprecated/answerDiscussion.pl:# your course templates/macros directory.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Build the list of entries based on the private
./deprecated/answerDiscussion.pl:# list in the student's directory, and the public
./deprecated/answerDiscussion.pl:# ones in the professors' directories.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Determine which are new entries by comparing to the list
./deprecated/answerDiscussion.pl:# of entries that have been read.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Get the number of new messages from a give student
./deprecated/answerDiscussion.pl:# (used in building the array of student messages
./deprecated/answerDiscussion.pl:# for the professor).
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Get the number of new messages from a give student
./deprecated/answerDiscussion.pl:# (used in building the array of student messages
./deprecated/answerDiscussion.pl:# for the professor).
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# True if the given entry hasn't been read yet
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# True if the user is the author of the given entry
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Get the formatted name and user from the entry
./deprecated/answerDiscussion.pl:# file name
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Find the currently selected entry based on the
./deprecated/answerDiscussion.pl:# current action and the state contained in the
./deprecated/answerDiscussion.pl:# form.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Find the first (oldest) unread message
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Initialize a discussion problem
./deprecated/answerDiscussion.pl:# (get the initial data and start the table that
./deprecated/answerDiscussion.pl:# holds the various windows)
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# End the left column and start the right
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# End the problem (and its associated table).
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Draw the Composition text entry area. Use the
./deprecated/answerDiscussion.pl:# correct wording for creating a new message
./deprecated/answerDiscussion.pl:# versus editing an old one. Show the preview
./deprecated/answerDiscussion.pl:# box, if requested.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Draw the list of entries an dassociated buttons.
./deprecated/answerDiscussion.pl:# Mark the new ones as new, and highlight the
./deprecated/answerDiscussion.pl:# selected one. Make sure the proper buttons
./deprecated/answerDiscussion.pl:# are active.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Display an entry in its window, adding the
./deprecated/answerDiscussion.pl:# proper buttons, and showing the source code
./deprecated/answerDiscussion.pl:# if requested. Record the fact that this
./deprecated/answerDiscussion.pl:# entry has been read.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Save the entry that is being composed or edited.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Delete an entry (if it is allowed). First put
./deprecated/answerDiscussion.pl:# up a confirmation box, however.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Start editing the selected entry.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Display the options panel
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:##################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Show the student array, with links to each student and
./deprecated/answerDiscussion.pl:# the number of new messages for each.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Show ALL the entries.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Hardcopy includes ALL the messages, nicely formatted.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Create the HTML for a panel, given the title, text and so on.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# A custom grader that uses the message aread to hide the normal
./deprecated/answerDiscussion.pl:# preview/check/submit buttons (if these were marked via an ID in the
./deprecated/answerDiscussion.pl:# HTML code, we could use CSS to do this instead).
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Look up a file and return its contents or an error message.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Perform the actual writing of the file, using a hack that
./deprecated/answerDiscussion.pl:# takes advantage of the fact that insertGraph() can write files
./deprecated/answerDiscussion.pl:# in the html/tmp/images directory.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# The answerDiscussion object mimics the WWPlot object by defining draw(),
./deprecated/answerDiscussion.pl:# imageName(), and ext() methods. These are used by insertGraph() to write
./deprecated/answerDiscussion.pl:# image files, and we can use that to write the data files that we need.
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Append data to a file (here implemented as reading followed by
./deprecated/answerDiscussion.pl:# writing).
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:# Get the (sanitized) file name for the temporary file
./deprecated/answerDiscussion.pl:#
./deprecated/answerDiscussion.pl:######################################################################
./deprecated/compoundProblem2.pl:#! /usr/bin/perl -w
./deprecated/compoundProblem2.pl:#options {width:${width}px; margin:20px auto; text-align:right; color:#6600}
./deprecated/compoundProblem2.pl:#options a {text-decoration:none; color:#9ac1c9}
./deprecated/compoundProblem2.pl:#options a:hover {color:#033}
./deprecated/compoundProblem2.pl:#acc {width:${width}px; list-style:none; color:#033; margin:0 auto 40px}
./deprecated/compoundProblem2.pl:#acc h3 {width:${width-14}px; border:1px solid #9ac1c9; padding:6px 6px 8px; font-weight:bold; margin-top:5px; cursor:pointer; background:url(images/header.gif)}
./deprecated/compoundProblem2.pl:#acc h3:hover {background-color:#ff0}
./deprecated/compoundProblem2.pl:#acc .acc-section {overflow:hidden; background:#fff}
./deprecated/compoundProblem2.pl:#acc .acc-content {width:${width-32}px; padding:15px; border:1px solid #9ac1c9; border-top:none; background:#fff}
./deprecated/compoundProblem2.pl:#nested {width:425px; list-style:none; color:#033; margin-bottom:15px}
./deprecated/compoundProblem2.pl:#nested h3 {width:411px; border:1px solid #9ac1c9; padding:6px 6px 8px; font-weight:bold; margin-top:5px; cursor:pointer; background:url(images/header.gif)}
./deprecated/compoundProblem2.pl:#nested h3:hover {background:url(images/header_over.gif)}
./deprecated/compoundProblem2.pl:#nested .acc-section {overflow:hidden; background:#fff}
./deprecated/compoundProblem2.pl:#nested .acc-content {width:393px; padding:15px; border:1px solid #9ac1c9; border-top:none; background:#fff}
./deprecated/compoundProblem2.pl:#nested .acc-selected {background:url(images/header_over.gif)}
./deprecated/compoundProblem2.pl:###########################################
./deprecated/compoundProblem2.pl:# FIXME we will make a $cp object that keeps track of the part
./deprecated/PGtextevaluators.pl:# Until we get the PG cacheing business sorted out, we need to use
./deprecated/PGtextevaluators.pl:# PG_restricted_eval to get the correct values for some(?) PG environment
./deprecated/PGtextevaluators.pl:# variables. We do this once here and place the values in lexicals for later
./deprecated/PGtextevaluators.pl:# access.
./deprecated/PGtextevaluators.pl:# these next three subroutines show how to modify the "store_ans_at()" answer
./deprecated/PGtextevaluators.pl:# evaluator to add extra information before storing the info
./deprecated/PGtextevaluators.pl:# They provide a good model for how to tweak answer evaluators in special cases.
./deprecated/PGtextevaluators.pl:# This is another example of how to modify an answer evaluator to obtain
./deprecated/PGtextevaluators.pl:# the desired behavior in a special case. Here the object is to have
./deprecated/PGtextevaluators.pl:# have the last answer trigger the send_mail_to subroutine which mails
./deprecated/PGtextevaluators.pl:# all of the answers to the designated address.
./deprecated/PGtextevaluators.pl:# (This address must be listed in PG_environment{'ALLOW_MAIL_TO'} or an error occurs.)
./deprecated/PGtextevaluators.pl:# Fix me?? why is the body hard wired to the string QUESTIONNAIRE_ANSWERS?
./deprecated/PGtextevaluators.pl:#### subroutines used in producing a questionnaire
./deprecated/PGtextevaluators.pl:#### these are at least good models for other answers of this type
./deprecated/PGtextevaluators.pl:# my $QUESTIONNAIRE_ANSWERS=''; # stores the answers until it is time to send them
./deprecated/PGtextevaluators.pl:# this must be initialized before the answer evaluators are run
./deprecated/PGtextevaluators.pl:# but that happens long after all of the text in the problem is
./deprecated/PGtextevaluators.pl:# evaluated.
./deprecated/PGtextevaluators.pl:# this is a utility script for cleaning up the answer output for display in
./deprecated/PGtextevaluators.pl:#the answers.
./deprecated/littleneck.pl:#*****************************
./deprecated/littleneck.pl:# Question mode variables
./deprecated/littleneck.pl:#*****************************
./deprecated/littleneck.pl:#********************************************
./deprecated/littleneck.pl:# Set up a "generate new problem" button
./deprecated/littleneck.pl:#********************************************
./deprecated/littleneck.pl:#**********************************************************
./deprecated/littleneck.pl:# Subroutine to reduce fractions
./deprecated/littleneck.pl:# Input : Num, Denom
./deprecated/littleneck.pl:# Output: Num, Denom, Wholenum (if != 0, = $num/$denom)
./deprecated/littleneck.pl:#
./deprecated/littleneck.pl:# 22Jul09 - Returned Wholenum < 0 if num or denom < 0
./deprecated/littleneck.pl:#**********************************************************
./deprecated/littleneck.pl:#
./deprecated/littleneck.pl:#**********************************************************
./deprecated/littleneck.pl:# Subroutine to produce reduced display fraction
./deprecated/littleneck.pl:# Input : Num($n), Denom($d)
./deprecated/littleneck.pl:# Output: Num($n), Denom($d), Wholenum($w),Display($display)
./deprecated/littleneck.pl:# calls reduce_fraction to get,
./deprecated/littleneck.pl:# Output: Num($n), Denom($d), Wholenum($w),
./deprecated/littleneck.pl:#(if Wholenum > 0,$display = $w
./deprecated/littleneck.pl:# else $Display=\(\frac{$n}{$d}\)
./deprecated/littleneck.pl:#**********************************************************
./deprecated/littleneck.pl:#
./deprecated/littleneck.pl:#
./deprecated/littleneck.pl:#
./deprecated/littleneck.pl:#
./deprecated/littleneck.pl:#**********************************************************
./deprecated/littleneck.pl:# Subroutine to produce reduced display fraction
./deprecated/littleneck.pl:# Input : Num($n), Denom($d)
./deprecated/littleneck.pl:# Output: Display($display)
./deprecated/littleneck.pl:# calls reduce_fraction to get,
./deprecated/littleneck.pl:# Output: Num($n), Denom($d), Wholenum($w),
./deprecated/littleneck.pl:#(if Wholenum > 0,$display = $w
./deprecated/littleneck.pl:# else $Display=\(\frac{$n}{$d}\)
./deprecated/littleneck.pl:#**********************************************************
./deprecated/littleneck.pl:#*******************************************************************************
./deprecated/littleneck.pl:# sqrt_simplify(Num,Natnum,Radnum,Texstr,Error)
./deprecated/littleneck.pl:#
./deprecated/littleneck.pl:# Description: Given a natural number, will find the greatest perfect square
./deprecated/littleneck.pl:# that is a factor and use this to simplify the expression:
./deprecated/littleneck.pl:# sqrt(number).
./deprecated/littleneck.pl:# Input :
./deprecated/littleneck.pl:# Num = Number whose sqrt is being taken
./deprecated/littleneck.pl:#
./deprecated/littleneck.pl:# Output:
./deprecated/littleneck.pl:# Natnum => Natural number portion of solution (= 1 if no perfect square
./deprecated/littleneck.pl:# divides evenly)
./deprecated/littleneck.pl:# Radnum => The value still inside the radical
./deprecated/littleneck.pl:# Texstr => A LaTex string of the form "Natnum \sqrt{$Radnum}" to be used
./deprecated/littleneck.pl:# for displaying the solution.
./deprecated/littleneck.pl:# Error => If == 1, then the number entered was bad (ie, negative, nonint)
./deprecated/littleneck.pl:# (If necessary, this code can be made specific for the error)
./deprecated/littleneck.pl:#*******************************************************************************
./deprecated/PGcomplexmacros2.pl:# This file is PGcomplexmacros2.pl
./deprecated/PGcomplexmacros2.pl:# This includes the subroutines for the ANS macros, that
./deprecated/PGcomplexmacros2.pl:# is, macros allowing a more flexible answer checking
./deprecated/PGcomplexmacros2.pl:### for handling multivalued functions of a complex variable
./deprecated/PGcomplexmacros2.pl:###### subroutines ###########
./deprecated/PGcomplexmacros2.pl:# compares (z1 to z2 mod 4pi/3)
./deprecated/PGcomplexmacros2.pl:##### end subroutines ##################
./deprecated/MUHelp.pl:## Append .helpLink("exponents","Click here for further help.") to a string to add a help link.
./misc/PCCmacros.pl:###############################
./misc/PCCmacros.pl:#Name: perlround
./misc/PCCmacros.pl:#Input: a number to round, then a place to round to. e.g. 2=>hundredths, 0=>whole, -1=>tens
./misc/PCCmacros.pl:#Output: $x rounded to the $n place. This attempts to overcome quirks with rounding when the cut part is like 0.005
./misc/PCCmacros.pl:################################
./misc/PCCmacros.pl:###############################
./misc/PCCmacros.pl:#Name: RandomName
./misc/PCCmacros.pl:#Input: None required
./misc/PCCmacros.pl:#Optional Input: 'sex' => male or female
./misc/PCCmacros.pl:#Output: A name that is randomly chosen from the list maintained here.
./misc/PCCmacros.pl:# If 'sex' is specified, the name is from the list of that sex.
./misc/PCCmacros.pl:################################
./misc/PCCmacros.pl:###############################
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Name: RandomVariableName
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Input: None required
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Optional Input: 'type' => variable, constant, integer, or function
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Output: A variable name like x, y, t, c, etc. that is randomly chosen from the list maintained here.
./misc/PCCmacros.pl:# If 'type' is specified, the name is from the list of that type.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Sample use:
./misc/PCCmacros.pl:################################
./misc/PCCmacros.pl:###############################
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Name: xPower
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# This is just an auxiliary subroutine for the polynomial macros that follow
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:################################
./misc/PCCmacros.pl:###############################
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Name: PolyString
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Input: an arrays
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyString(~~@poly1)
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Arrays elements should be numerical or Math Objects. The idea is that
./misc/PCCmacros.pl:# these are coefficients of a polynomial, either starting from the
./misc/PCCmacros.pl:# constant term or from the leading term.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Optional Input: order=>ascending or descending, defaults to descending
./misc/PCCmacros.pl:# order is ignored if output=>array
./misc/PCCmacros.pl:# Optional Input: var=> some string, defaulting to "x"
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Output: an polynomial string using var and ready to be fed to Compute
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# For example, given
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# @poly1 = (1,2); # represents x+2
./misc/PCCmacros.pl:# @poly2 = (3,-1,0,4);
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyString(~~@poly1);
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# 'x^1+2x^0'
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyString(~~@poly2,order=>ascending,var=>'z');
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# '3x^0+-1x^1+0x^2+4x^3'
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Note that instance of +-, x^0, x^1, 0x^n, may be present,
./misc/PCCmacros.pl:# but Math Objectification will handle that.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Note: If you intend to feed the output string to Compute() or Formula(),
./misc/PCCmacros.pl:# you should set the context reductions appropriately and apply ->reduce
./misc/PCCmacros.pl:# *twice* to remove excess parentheses from negative coefficients.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:################################
./misc/PCCmacros.pl:###############################
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Name: PolyMult
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Input: two arrays, for example
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyMult(~~@poly1, ~~@poly2)
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Arrays elements should be numerical or Math Objects
./misc/PCCmacros.pl:# where multiplication and addition are allowed. The idea is that
./misc/PCCmacros.pl:# these are coefficients of a polynomial, either starting from the
./misc/PCCmacros.pl:# constant term or from the leading term.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Optional Input: order=>ascending or descending, defaults to descending
./misc/PCCmacros.pl:# order is ignored if output=>array
./misc/PCCmacros.pl:# Optional Input: var=> some string, defaulting to "x"
./misc/PCCmacros.pl:# Optional Input: output=>array, simplified, unsimplified
./misc/PCCmacros.pl:# which is either an array of coefficients, an expanded and simplified
./misc/PCCmacros.pl:# polynomial string using var and ready to be fed to Compute, or the same
./misc/PCCmacros.pl:# but unsimplified. Default is array.
./misc/PCCmacros.pl:# cmh, 6/18/13
./misc/PCCmacros.pl:# Optional Input: exponentVar=> some string, defaulting to ''
./misc/PCCmacros.pl:# to be used if the polynomial looks like, for example
./misc/PCCmacros.pl:# x^{3n}+x^{2n}+x^{n}
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Output: described in Optional Input
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# For example, given
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# @poly1 = (1,2); # represents x+2
./misc/PCCmacros.pl:# @poly2 = (3,-1,4); # represents 3x^2-x+4
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyMult(~~@poly1, ~~@poly2,
./misc/PCCmacros.pl:# order=>ascending, var=>'z', output=>unsimplified)
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# '3z^3+-1z^2+4z+6z^2+-2z^1+8z^0'
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Note that instance of +- may be present, but Math Objectification
./misc/PCCmacros.pl:# will handle that.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Given
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# @poly1 = (Fraction(1,3),2); # represents 1/3x+2
./misc/PCCmacros.pl:# @poly2 = (Fraction(1,2),Fraction(-1,3)); # represents 1/2x-1/3
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyMult(~~@poly1, ~~@poly2)
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# (Frac(1,6),Frac(8,9),Frac(-1,9))
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Note: If you intend to feed the output string to Compute() or Formula(),
./misc/PCCmacros.pl:# you should set the context reductions appropriately and apply ->reduce
./misc/PCCmacros.pl:# *twice* to remove excess parentheses from negative coefficients.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:################################
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Accepts an array of the form that PolyTerms outputs
./misc/PCCmacros.pl:# Inserts '&' between array entries for use in array environments
./misc/PCCmacros.pl:# Converts Math Object entries to their TeX form
./misc/PCCmacros.pl:# Inserts a spacing command after nonempty entries - the command
./misc/PCCmacros.pl:# \setlength\arraycolsep{0em} should precede the \begin{array}
./misc/PCCmacros.pl:# $Spacing should be something like "\hspace{0.4em}"
./misc/PCCmacros.pl:# Also creates an alignment string for the \begin{array} command
./misc/PCCmacros.pl:# $align should be "r", "c", or "l"
./misc/PCCmacros.pl:# Not part of PGpolynomialMacros.pl
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyTerms(~~@coefficientArray,x,order)
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Accepts an array containing the coefficients of a polynomial
./misc/PCCmacros.pl:# in descending order
./misc/PCCmacros.pl:# Assumes coefficients have numerical values, but may be Math Objects
./misc/PCCmacros.pl:# Returns an array of size 2n-1 of the form
./misc/PCCmacros.pl:# (a_nx^n, +/-, |a_{n-1}| x^{n-1}, +/-, ...)
./misc/PCCmacros.pl:# where the variable is x is the second argument, the terms are Math Objects
./misc/PCCmacros.pl:# Formulas, and the +/- are Perl strings.
./misc/PCCmacros.pl:# The third argument can be "ascending" to reverse the order
./misc/PCCmacros.pl:# If a_j is 0, then the corresponding term and preceding sign are empty
./misc/PCCmacros.pl:# strings.
./misc/PCCmacros.pl:# Trims beginning and ending, so that first and last terms are nonzero
./misc/PCCmacros.pl:# Not part of PGpolynomialMacros.pl
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:#=cut
./misc/PCCmacros.pl:###############################
./misc/PCCmacros.pl:# Name: PolySub
./misc/PCCmacros.pl:###############################
./misc/PCCmacros.pl:# Name: PolyAdd
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Input: two arrays, for example
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyAdd(~~@poly1, ~~@poly2)
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Arrays elements should be numerical or Math Objects
./misc/PCCmacros.pl:# where addition are allowed. The idea is that
./misc/PCCmacros.pl:# these are coefficients of a polynomial, either starting from the
./misc/PCCmacros.pl:# constant term or from the leading term.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Optional Input: order=>ascending or descending, defaults to descending
./misc/PCCmacros.pl:# order is ignored if output=>array
./misc/PCCmacros.pl:# Optional Input: var=> some string, defaulting to "x"
./misc/PCCmacros.pl:# Optional Input: subtract=> 1 will subtract; default 0
./misc/PCCmacros.pl:# Optional Input: output=>array, simplified, unsimplified
./misc/PCCmacros.pl:# which is either an array of coefficients, a simplified
./misc/PCCmacros.pl:# polynomial string using var and ready to be fed to Compute, or the same
./misc/PCCmacros.pl:# but unsimplified with like terms near each other. Default is array.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Output: described in Optional Input
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# For example, given
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# @poly1 = (1,2); # represents x+2 (assuming descending)
./misc/PCCmacros.pl:# @poly2 = (3,-1,4); # represents 3x^2-x+4
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyAdd(~~@poly1, ~~@poly2,var=>'z', output=>unsimplified)
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# '3z^2+1z+-1z+2+4'
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Note that instance of +- may be present, but Math Objectification
./misc/PCCmacros.pl:# will handle that.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Given
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# @poly1 = (Fraction(1,3),2); # represents 1/3+2x (assuming ascending)
./misc/PCCmacros.pl:# @poly2 = (Fraction(1,2),0,Fraction(-1,3));
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# PolyAdd(~~@poly1, ~~@poly2,order=>ascending)
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# (Frac(5,6),2,Frac(-1,3))
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Note: If you intend to feed the output string to Compute() or Formula(),
./misc/PCCmacros.pl:# you should set the context reductions appropriately and apply ->reduce
./misc/PCCmacros.pl:# *twice* to remove excess parentheses from negative coefficients.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:################################
./misc/PCCmacros.pl:###############################
./misc/PCCmacros.pl:# Name: numberWord
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Input: either a whole number <100 or a fraction with numerator and denominator less than 100. If fraction, set denominator parameter.
./misc/PCCmacros.pl:# Optional Input: capital => 1 (default is 0)
./misc/PCCmacros.pl:# Optional Input: denominator=> 4 (default is 1)
./misc/PCCmacros.pl:# numberWord($n)
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Output: a string spelling that number
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:################################
./misc/PCCmacros.pl:# radicalListCheck
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Used when multiple answers are needed (e.g for quadratic) equations
./misc/PCCmacros.pl:# that may or may *not* contain radicals.
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# Sample use:
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:# ANS($ans->cmp(limits => [1,2],list_checker => ~~&radicalListCheck));
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:#
./misc/PCCmacros.pl:#in line below, correct_ans seems the right thing to do. In some problems, this is blank, so I'm just going with correct_value
./misc/PCCmacros.pl:# for those problems. But changing to correct_value broke other problems... so the conditional hack
./misc/PCCmacros.pl:# Keyboard instructions should only be displayed in HTML output
./core/Parser.pl:###########################################################################
./core/Parser.pl:##
./core/Parser.pl:## Set up the functions needed by the Parser.
./core/Parser.pl:##
./core/Parser.pl:# ^uses $Parser::installed
./core/Parser.pl:# ^uses $Value::installed
./core/Parser.pl:# ^uses loadMacros
./core/Parser.pl:# ^function Formula
./core/Parser.pl:# ^uses Value::Package
./core/Parser.pl:# ^function Compute
./core/Parser.pl:# ^uses Formula
./core/Parser.pl:# ^uses Value::contextSet
./core/Parser.pl:# ^function Context
./core/Parser.pl:# ^uses Parser::Context::current
./core/Parser.pl:# ^uses %context
./core/Parser.pl:# # ^variable our %context
./core/Parser.pl:# ^uses Context
./core/Parser.pl:###########################################################################
./core/Parser.pl:#
./core/Parser.pl:# stubs for trigonometric functions
./core/Parser.pl:#
./core/Parser.pl:# ^package Ignore
./core/Parser.pl:# ^#function sin
./core/Parser.pl:# ^#uses Parser::Function::call
./core/Parser.pl:#sub sin {Parser::Function->call('sin',@_)} # Let overload handle it
./core/Parser.pl:# ^#function cos
./core/Parser.pl:# ^#uses Parser::Function::call
./core/Parser.pl:#sub cos {Parser::Function->call('cos',@_)} # Let overload handle it
./core/Parser.pl:# ^function tan
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function sec
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function csc
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function cot
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function asin
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function acos
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function atan
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function asec
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function acsc
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function acot
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arcsin
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arccos
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arctan
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arcsec
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arccsc
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arccot
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:###########################################################################
./core/Parser.pl:#
./core/Parser.pl:# stubs for hyperbolic functions
./core/Parser.pl:#
./core/Parser.pl:# ^function sinh
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function cosh
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function tanh
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function sech
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function csch
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function coth
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function asinh
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function acosh
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function atanh
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function asech
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function acsch
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function acoth
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arcsinh
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arccosh
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arctanh
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arcsech
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arccsch
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function arccoth
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:###########################################################################
./core/Parser.pl:#
./core/Parser.pl:# stubs for numeric functions
./core/Parser.pl:#
./core/Parser.pl:# ^#function log
./core/Parser.pl:# ^#uses Parser::Function::call
./core/Parser.pl:#sub log {Parser::Function->call('log',@_)} # Let overload handle it
./core/Parser.pl:# ^function log10
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^#function exp
./core/Parser.pl:# ^#uses Parser::Function::call
./core/Parser.pl:#sub exp {Parser::Function->call('exp',@_)} # Let overload handle it
./core/Parser.pl:# ^#function sqrt
./core/Parser.pl:# ^#uses Parser::Function::call
./core/Parser.pl:#sub sqrt {Parser::Function->call('sqrt',@_)} # Let overload handle it
./core/Parser.pl:# ^#function abs
./core/Parser.pl:# ^#uses Parser::Function::call
./core/Parser.pl:#sub abs {Parser::Function->call('abs',@_)} # Let overload handle it
./core/Parser.pl:# ^function int
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function sgn
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function ln
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function logten
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^package main
./core/Parser.pl:# ^function log10
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function Factorial
./core/Parser.pl:# ^uses Parser::UOP::factorial::call
./core/Parser.pl:###########################################################################
./core/Parser.pl:#
./core/Parser.pl:# stubs for special functions
./core/Parser.pl:#
./core/Parser.pl:# ^#function atan2
./core/Parser.pl:# ^#usesParser::Function::call
./core/Parser.pl:#sub atan2 {Parser::Function->call('atan2',@_)} # Let overload handle it
./core/Parser.pl:###########################################################################
./core/Parser.pl:#
./core/Parser.pl:# stubs for numeric functions
./core/Parser.pl:#
./core/Parser.pl:# ^function arg
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function mod
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function Re
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function Im
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function conj
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:###########################################################################
./core/Parser.pl:#
./core/Parser.pl:# stubs for vector functions
./core/Parser.pl:#
./core/Parser.pl:# ^function norm
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:# ^function unit
./core/Parser.pl:# ^uses Parser::Function::call
./core/Parser.pl:#
./core/Parser.pl:# These are defined in PG.pl (since they call eval())
./core/Parser.pl:#
./core/Parser.pl:# sub i () {Compute('i')}
./core/Parser.pl:# sub j () {Compute('j')}
./core/Parser.pl:# sub k () {Compute('k')}
./core/Parser.pl:###########################################################################
./core/Parser.pl:# ^variable our $_parser_loaded
./core/Parser.pl:# ^function _Parser_init
./core/Parser.pl:# ^uses loadMacros
./core/Parser.pl:###########################################################################
./core/PGessaymacros.pl:# Makes an essay box and calls essay_cmp()
./core/PGessaymacros.pl:# Can be turned off using $pg{specialPGEnvironmentVars}{waiveExplanations}
./core/PGessaymacros.pl:# Takes options:
./core/PGessaymacros.pl:# row (or height): height of essay box; defaults to 8
./core/PGessaymacros.pl:# col (or width): width of essay box; defaults to 75
./core/PGessaymacros.pl:# message: a message preceding the essay box; default is 'Explain.'
./core/PGessaymacros.pl:# help: boolean for whether to display the essay help message; default is true
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:# No indentation for PTX
./core/PGML.pl:# No align for PTX
./core/PGML.pl:# PreTeXt can't use headings.
./core/PGML.pl:# No rule for PTX
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/PGML.pl:######################################################################
./core/Value.pl:# sub Formula {Value->Package("Formula()")->new(@_)} # in Parser.pl
./core/scaffold.pl:# Scaffold::Begin() is used to start a new scaffold section, passing
./core/scaffold.pl:# it any options that need to be overridden (e.g. is_open, can_open,
./core/scaffold.pl:# open_first_section, etc).
./core/scaffold.pl:#
./core/scaffold.pl:# Problems can include more than one scaffold, if desired,
./core/scaffold.pl:# and they can be nested.
./core/scaffold.pl:#
./core/scaffold.pl:# We save the current PG_OUTPUT, which will be put back during
./core/scaffold.pl:# the Scaffold::End() call. The sections use PG_OUTPUT to create
./core/scaffold.pl:# their own text, which is added to the $scaffold->{output}
./core/scaffold.pl:# during the Section::End() call.
./core/scaffold.pl:# Scaffold::End() is used to end the scaffold.
./core/scaffold.pl:#
./core/scaffold.pl:# This puts the scaffold into the page output and opens the sections that should be open.
./core/scaffold.pl:# Then the next nested scaffold (if any) is popped off the stack and returned.
./core/scaffold.pl:# Report an error and die
./core/scaffold.pl:# Create a new Scaffold object.
./core/scaffold.pl:#
./core/scaffold.pl:# Set the defaults for can_open, is_open, etc., but allow
./core/scaffold.pl:# the author to override them.
./core/scaffold.pl:# Add a section to the scaffold and give it a unique number (within
./core/scaffold.pl:# the scaffold). Determine its label and save it as current_section
./core/scaffold.pl:# so that we know which section is active.
./core/scaffold.pl:# Add the content from the current section into the scaffold's output
./core/scaffold.pl:# and remove the current_section (so we can tell that no section is open).
./core/scaffold.pl:# Record the answers for a section.
./core/scaffold.pl:# Scores are obtained when post processing is done.
./core/scaffold.pl:# Add the given sections to the list of sections to be opened for this scaffold.
./core/scaffold.pl:# Shortcuts for Scaffold data
./core/scaffold.pl:# Section::Begin() is used to start a section in the scaffolding,
./core/scaffold.pl:# passing it the name of the section and any options (e.g., can_open,
./core/scaffold.pl:# is_open, etc.).
./core/scaffold.pl:#
./core/scaffold.pl:# The section is added to the scaffold, and the names of the answer
./core/scaffold.pl:# blanks for previous sections are recorded, along with information
./core/scaffold.pl:# about the answer blanks that have evaluators assigned (so we can
./core/scaffold.pl:# see which answers belong to this section when it closes).
./core/scaffold.pl:# Section::End() is used to end the active section.
./core/scaffold.pl:#
./core/scaffold.pl:# We get the names of the answer blanks that are in this section,
./core/scaffold.pl:# then add the HTML around the section that is used by JavaScript
./core/scaffold.pl:# for showing/hiding the section, and finally tell the scaffold
./core/scaffold.pl:# that the section is complete (it adds the content to its output).
./core/scaffold.pl:# Create a new Section object.
./core/scaffold.pl:#
./core/scaffold.pl:# It takes default values for can_open, is_open, etc.
./core/scaffold.pl:# from the active scaffold. These can be overridden
./core/scaffold.pl:# by the author.
./core/scaffold.pl:# Adds the necessary HTML around the content of the section. Initially a temporary "scaffold-section" tag is added that
./core/scaffold.pl:# wraps the content, and that is replaced with the correct HTML in post processing. The content is also removed in post
./core/scaffold.pl:# processing if the scaffold cannot be opened and is not correct. The $PG_OUTPUT variable holds just the contents of
./core/scaffold.pl:# this section, so unshift the opening tags onto the front, and push the closing tags onto the back. (This is added to
./core/scaffold.pl:# the scaffold output when $scaffold->end_section() is called.)
./core/scaffold.pl:# Check if all the answers for this section are correct
./core/scaffold.pl:# Perform the can_open check for this section:
./core/scaffold.pl:# If the author supplied code, use it, otherwise use the routine from Section::can_open.
./core/scaffold.pl:# Perform the is_open check for this section:
./core/scaffold.pl:# If the author supplied code, use it, otherwise use the routine from Section::is_open.
./core/scaffold.pl:# Return a boolean array where a 1 means that answer blank has
./core/scaffold.pl:# an answer evaluator assigned to it and 0 means not.
./core/scaffold.pl:# Get the names of any of the original answer blanks that now have evaluators attached.
./core/scaffold.pl:########################################################################
./core/scaffold.pl:# Implements the possible values for the can_open option for scaffolds
./core/scaffold.pl:# and sections
./core/scaffold.pl:# Always can be opened
./core/scaffold.pl:# Can be opened when all the answers from previous sections are correct
./core/scaffold.pl:# Can open when previous are correct but this one is not
./core/scaffold.pl:# Can open when incorrect
./core/scaffold.pl:# Never can be opened
./core/scaffold.pl:########################################################################
./core/scaffold.pl:# Implements the possible values for the is_open option for scaffolds
./core/scaffold.pl:# and sections
./core/scaffold.pl:# Every section is open that can be
./core/scaffold.pl:# Every incorrect section is open that can be
./core/scaffold.pl:# (unless it is the first one, and everything is blank, and
./core/scaffold.pl:# the scaffold doesn't have open_first_section set)
./core/scaffold.pl:# The first incorrect section is open that can be
./core/scaffold.pl:# All correct sections and the first incorrect section
./core/scaffold.pl:# are open (that are allowed to be open)
./core/scaffold.pl:# No sections are open
./core/RserveClient.pl:# This used to take a second $local parameter that specified the name of the file that would be saved in the temp
./core/RserveClient.pl:# directory. That parameter is deprecated and is ignored if given. The problem author should have never been given that
./core/RserveClient.pl:# choice. Furthermore, if the $local parameter was not specified the remote file name was used which changes every time
./core/RserveClient.pl:# the problem is rendered. That is a problem because it results in a different file being saved into the temporary
./core/RserveClient.pl:# directory every time the problem is rendered. Instead a unique filename is used that is created via PGresource and
./core/RserveClient.pl:# PGalias (and so is dependent on the problem seed, psvn, problem UUID, etc.).
./core/RserveClient.pl:# Returns an REXP's Perl representation, dereferencing it if it's an array reference. `REXP::to_perl` returns a string
./core/RserveClient.pl:# scalar for Symbol, undef for Null, and an array reference to contents for all vector types. This function is a utility
./core/RserveClient.pl:# wrapper to make it easy to assign a Vector's representation to an array variable, while still working sensibly for
./core/RserveClient.pl:# non-arrays.
./core/PGanswermacros.pl:# FIXME TODO:
./core/PGanswermacros.pl:# Document and maybe split out: filters, graders, utilities
./core/PGanswermacros.pl:# Until we get the PG cacheing business sorted out, we need to use
./core/PGanswermacros.pl:# PG_restricted_eval to get the correct values for some(?) PG environment
./core/PGanswermacros.pl:# variables. We do this once here and place the values in lexicals for later
./core/PGanswermacros.pl:# access.
./core/PGanswermacros.pl:# ^variable my $BR
./core/PGanswermacros.pl:# ^variable my $functLLimitDefault
./core/PGanswermacros.pl:# ^variable my $functULimitDefault
./core/PGanswermacros.pl:# ^variable my $functVarDefault
./core/PGanswermacros.pl:# ^variable my $useBaseTenLog
./core/PGanswermacros.pl:# ^function _PGanswermacros_init
./core/PGanswermacros.pl:# ^uses loadMacros
./core/PGanswermacros.pl:# ^uses PG_restricted_eval
./core/PGanswermacros.pl:# ^uses $BR
./core/PGanswermacros.pl:# ^uses $envir{functLLimitDefault}
./core/PGanswermacros.pl:# ^uses $envir{functULimitDefault}
./core/PGanswermacros.pl:# ^uses $envir{functVarDefault}
./core/PGanswermacros.pl:# ^uses $envir{useBaseTenLog}
./core/PGanswermacros.pl:###########################################################################
./core/PGanswermacros.pl:### THE FOLLOWING ARE LOCAL SUBROUTINES THAT ARE MEANT TO BE CALLED ONLY FROM THIS SCRIPT.
./core/PGanswermacros.pl:## Internal routine that converts variables into the standard array format
./core/PGanswermacros.pl:##
./core/PGanswermacros.pl:## IN: one of the following:
./core/PGanswermacros.pl:## an undefined value (i.e., no variable was specified)
./core/PGanswermacros.pl:## a reference to an array of variable names -- [var1, var2]
./core/PGanswermacros.pl:## a number (the number of variables desired) -- 3
./core/PGanswermacros.pl:## one or more variable names -- (var1, var2)
./core/PGanswermacros.pl:## OUT: an array of variable names
./core/PGanswermacros.pl:# ^function get_var_array
./core/PGanswermacros.pl:# ^uses $functVarDefault
./core/PGanswermacros.pl:## Internal routine that converts limits into the standard array of arrays format
./core/PGanswermacros.pl:## Some of the cases are probably unneccessary, but better safe than sorry
./core/PGanswermacros.pl:##
./core/PGanswermacros.pl:## IN: one of the following:
./core/PGanswermacros.pl:## an undefined value (i.e., no limits were specified)
./core/PGanswermacros.pl:## a reference to an array of arrays of limits -- [[llim,ulim], [llim,ulim]]
./core/PGanswermacros.pl:## a reference to an array of limits -- [llim, ulim]
./core/PGanswermacros.pl:## an array of array references -- ([llim,ulim], [llim,ulim])
./core/PGanswermacros.pl:## an array of limits -- (llim,ulim)
./core/PGanswermacros.pl:## OUT: an array of array references -- ([llim,ulim], [llim,ulim]) or ([llim,ulim])
./core/PGanswermacros.pl:# ^function get_limits_array
./core/PGanswermacros.pl:# ^uses $functLLimitDefault
./core/PGanswermacros.pl:# ^uses $functULimitDefault
./core/PGanswermacros.pl:#sub check_option_list {
./core/PGanswermacros.pl:# my $size = scalar(@_);
./core/PGanswermacros.pl:# if( ( $size % 2 ) != 0 ) {
./core/PGanswermacros.pl:# warn "ERROR in answer evaluator generator:\n" .
./core/PGanswermacros.pl:# "Usage: str_cmp([\$ans1, \$ans2],%options)
./core/PGanswermacros.pl:# or num_cmp([\$num1, \$num2], %options)
./core/PGanswermacros.pl:# A list of inputs must be inclosed in square brackets [\$ans1, \$ans2]";
./core/PGanswermacros.pl:# }
./core/PGanswermacros.pl:#}
./core/PGanswermacros.pl:# simple subroutine to display an error message when
./core/PGanswermacros.pl:# function compares are called with invalid parameters
./core/PGanswermacros.pl:# ^function function_invalid_params
./core/PGanswermacros.pl:# ^function clean_up_error_msg
./core/PGanswermacros.pl:#formats the student and correct answer as specified
./core/PGanswermacros.pl:#format must be of a form suitable for sprintf (e.g. '%0.5g'),
./core/PGanswermacros.pl:#with the exception that a '#' at the end of the string
./core/PGanswermacros.pl:#will cause trailing zeros in the decimal part to be removed
./core/PGanswermacros.pl:# ^function prfmt
./core/PGanswermacros.pl:# ^uses is_a_number
./core/PGanswermacros.pl:#########################################################################
./core/PGanswermacros.pl:# Filters for answer evaluators
./core/PGanswermacros.pl:#########################################################################
./core/PGanswermacros.pl:# ^function compare_numbers
./core/PGanswermacros.pl:# ^uses PG_answer_eval
./core/PGanswermacros.pl:# ^uses clean_up_error_msg
./core/PGanswermacros.pl:# ^uses prfmt
./core/PGanswermacros.pl:# ^uses is_a_number
./core/PGanswermacros.pl:# ^function std_num_filter
./core/PGanswermacros.pl:# ^uses math_constants
./core/PGanswermacros.pl:# ^uses PG_answer_eval
./core/PGanswermacros.pl:# ^uses clean_up_error_msg
./core/PGanswermacros.pl:# ^function std_num_array_filter
./core/PGanswermacros.pl:# ^uses set_default_options
./core/PGanswermacros.pl:# ^uses AnswerHash::new
./core/PGanswermacros.pl:# ^uses check_syntax
./core/PGanswermacros.pl:# ^uses std_num_filter
./core/PGanswermacros.pl:# ^function function_from_string2
./core/PGanswermacros.pl:# ^uses assign_option_aliases
./core/PGanswermacros.pl:# ^uses set_default_options
./core/PGanswermacros.pl:# ^uses math_constants
./core/PGanswermacros.pl:# ^uses PG_restricted_eval
./core/PGanswermacros.pl:# ^uses PG_answer_eval
./core/PGanswermacros.pl:# ^uses clean_up_error_msg
./core/PGanswermacros.pl:# ^function is_zero_array
./core/PGanswermacros.pl:# ^uses is_a_number
./core/PGanswermacros.pl:# Used internally:
./core/PGanswermacros.pl:#
./core/PGanswermacros.pl:# &$determine_param_coeff( $rf_comparison_function # a reference to the correct answer function
./core/PGanswermacros.pl:# $ra_variables # an array of the active input variables to the functions
./core/PGanswermacros.pl:# $dim_of_params_space # indicates the number of parameters upon which the
./core/PGanswermacros.pl:# # the comparison function depends linearly. These are assumed to
./core/PGanswermacros.pl:# # be the last group of inputs to the comparison function.
./core/PGanswermacros.pl:#
./core/PGanswermacros.pl:# %options # $options{debug} gives more error messages
./core/PGanswermacros.pl:#
./core/PGanswermacros.pl:# # A typical function might look like
./core/PGanswermacros.pl:# # f(x,y,z,a,b) = x^2+a*cos(xz) + b*sin(x) with a parameter
./core/PGanswermacros.pl:# # space of dimension 2 and a variable space of dimension 3.
./core/PGanswermacros.pl:# )
./core/PGanswermacros.pl:# # returns a list of coefficients
./core/PGanswermacros.pl:# ^function best_approx_parameters
./core/PGanswermacros.pl:# ^uses set_default_options
./core/PGanswermacros.pl:# ^uses pretty_print
./core/PGanswermacros.pl:# ^uses Matrix::new
./core/PGanswermacros.pl:# ^uses is_a_number
./core/PGanswermacros.pl:# ^function calculate_difference_vector
./core/PGanswermacros.pl:# ^uses assign_option_aliases
./core/PGanswermacros.pl:# ^uses set_default_options
./core/PGanswermacros.pl:## $diff *= $options{tolerance}/$options{zeroLevelTol} unless abs($instructorVal) > $options{zeroLevel};
./core/PGanswermacros.pl:# /DPVC
./core/PGanswermacros.pl:#$diff = ( $inVal - ($correctVal-$instructorVal- $instructorVal ) )/abs($instructorVal) if abs($instructorVal) > $options{zeroLevel};
./core/PGanswermacros.pl:#warn "diff = $diff, ", abs( &$rf_correct_fun(@inputs) ) , "-- $correctVal";
./core/PGanswermacros.pl:# ^function fix_answers_for_display
./core/PGanswermacros.pl:# ^uses evaluatesToNumber
./core/PGanswermacros.pl:# ^uses AnswerHash::new
./core/PGanswermacros.pl:# ^uses check_syntax
./core/PGanswermacros.pl:# ^function evaluatesToNumber
./core/PGanswermacros.pl:# ^uses is_a_numeric_expression
./core/PGanswermacros.pl:# ^uses PG_answer_eval
./core/PGanswermacros.pl:# ^uses prfmt
./core/PGanswermacros.pl:# ^function is_a_numeric_expression
./core/PGanswermacros.pl:# ^uses PG_answer_eval
./core/PGanswermacros.pl:# ^function is_a_number
./core/PGanswermacros.pl:# ^function is_a_fraction
./core/PGanswermacros.pl:# ^function phase_pi
./core/PGanswermacros.pl:# ^function is_an_arithmetic_expression
./core/PGanswermacros.pl:#
./core/PGanswermacros.pl:# ^function math_constants
./core/PGanswermacros.pl:# ^function is_array
./core/PGanswermacros.pl:# ^function check_syntax
./core/PGanswermacros.pl:# ^uses assign_option_aliases
./core/PGanswermacros.pl:# ^uses set_default_options
./core/PGanswermacros.pl:# ^uses AlgParserWithImplicitExpand::new
./core/PGanswermacros.pl:# ^function check_strings
./core/PGanswermacros.pl:# ^uses str_filters
./core/PGanswermacros.pl:# ^uses str_cmp
./core/PGanswermacros.pl:# OVERVIEW of reminder of function:
./core/PGanswermacros.pl:# if answer is correct, return correct. (adjust score to 1)
./core/PGanswermacros.pl:# if answer is incorect:
./core/PGanswermacros.pl:# 1) determine if the answer is sensible. if it is, return incorrect.
./core/PGanswermacros.pl:# 2) if the answer is not sensible (and incorrect), then return an error message indicating so.
./core/PGanswermacros.pl:# no matter what: throw a 'STRING' error to skip numerical evaluations. (error flag skips remainder of pre_filters and evaluators)
./core/PGanswermacros.pl:# last: 'STRING' post_filter will clear the error (avoiding pink screen.)
./core/PGanswermacros.pl:# ^function check_units
./core/PGanswermacros.pl:# ^uses str_filters
./core/PGanswermacros.pl:# ^uses Units::evaluate_units
./core/PGanswermacros.pl:# ^uses clean_up_error_msg
./core/PGanswermacros.pl:# ^uses prfmt
./core/PGanswermacros.pl:# ^function pretty_print
./core/PGanswermacros.pl:# ^uses lex_sort
./core/PGanswermacros.pl:# ^uses pretty_print
./core/PGanswermacros.pl:# sub pretty_print {
./core/PGanswermacros.pl:# my $r_input = shift;
./core/PGanswermacros.pl:# my $out = '';
./core/PGanswermacros.pl:# if ( not ref($r_input) ) {
./core/PGanswermacros.pl:# $out = $r_input if defined $r_input; # not a reference
./core/PGanswermacros.pl:# $out =~ s/</g ; # protect for HTML output
./core/PGanswermacros.pl:# } elsif ("$r_input" =~/hash/i) { # this will pick up objects whose '$self' is hash and so works better than ref($r_iput).
./core/PGanswermacros.pl:# local($^W) = 0;
./core/PGanswermacros.pl:#
./core/PGanswermacros.pl:# $out .= "$r_input " ."
";
./core/PGanswermacros.pl:# } elsif (ref($r_input) eq 'ARRAY' ) {
./core/PGanswermacros.pl:# my @array = @$r_input;
./core/PGanswermacros.pl:# $out .= "( " ;
./core/PGanswermacros.pl:# while (@array) {
./core/PGanswermacros.pl:# $out .= pretty_print(shift @array) . " , ";
./core/PGanswermacros.pl:# }
./core/PGanswermacros.pl:# $out .= " )";
./core/PGanswermacros.pl:# } elsif (ref($r_input) eq 'CODE') {
./core/PGanswermacros.pl:# $out = "$r_input";
./core/PGanswermacros.pl:# } else {
./core/PGanswermacros.pl:# $out = $r_input;
./core/PGanswermacros.pl:# $out =~ s/</g ; # protect for HTML output
./core/PGanswermacros.pl:# }
./core/PGanswermacros.pl:# $out;
./core/PGanswermacros.pl:# }
./core/PGbasicmacros.pl:#####sub _PGbasicmacros_init { }
./core/PGbasicmacros.pl:### In this file the _init subroutine is defined further down
./core/PGbasicmacros.pl:### It actually initializes something!
./core/PGbasicmacros.pl:# this is equivalent to use strict, but can be used within the Safe compartment
./core/PGbasicmacros.pl:# Alias for NAMED_ANS_RULE
./core/PGbasicmacros.pl:# Deprecated
./core/PGbasicmacros.pl:##############################################
./core/PGbasicmacros.pl:# generate_aria_label( $name )
./core/PGbasicmacros.pl:# takes the name of an ANS_RULE and generates an appropriate
./core/PGbasicmacros.pl:# aria label for screen readers
./core/PGbasicmacros.pl:##############################################
./core/PGbasicmacros.pl:##############################################
./core/PGbasicmacros.pl:# contained_in( $elem, $array_reference or null separated string);
./core/PGbasicmacros.pl:# determine whether element is equal
./core/PGbasicmacros.pl:# ( in the sense of eq, not ==, ) to an element in the array.
./core/PGbasicmacros.pl:##############################################
./core/PGbasicmacros.pl:# this is legacy code; use ans_checkbox instead
./core/PGbasicmacros.pl:# end answer blank macros
./core/PGbasicmacros.pl:# $main::solutionExists is passed to processProblem which displays a "show Solution" button
./core/PGbasicmacros.pl:# when a solution is available for viewing
./core/PGbasicmacros.pl:# End hints and solutions and statement macros
./core/PGbasicmacros.pl:#################################
./core/PGbasicmacros.pl:# Add a comment which will display in the Library browser
./core/PGbasicmacros.pl:# Currently, the only output is html
./core/PGbasicmacros.pl:#################################
./core/PGbasicmacros.pl:# Produces a random number between $begin and $end with increment 1.
./core/PGbasicmacros.pl:# You do not have to worry about integer or floating point types.
./core/PGbasicmacros.pl:# display macros
./core/PGbasicmacros.pl:# MODES() is now table driven
./core/PGbasicmacros.pl:# This replaces M3. You can add new modes at will to this one.
./core/PGbasicmacros.pl:# end display macros
./core/PGbasicmacros.pl:# A utility variable. Notice that "B" = $ALPHABET[1] and
./core/PGbasicmacros.pl:# "ABCD" = @ALPHABET[0..3].
./core/PGbasicmacros.pl:###############################################################
./core/PGbasicmacros.pl:# Some constants which are different in tex and in HTML
./core/PGbasicmacros.pl:# The order of arguments is TeX, HTML
./core/PGbasicmacros.pl:# Adopted Davide Cervone's improvements to PAR, LTS, GTS, LTE, GTE, LBRACE, RBRACE, LB, RB. 7-14-03 AKP
./core/PGbasicmacros.pl:#sub BR { MODES( TeX => '\\par\\noindent ', HTML => ' '); };
./core/PGbasicmacros.pl:# Alternate definition of BR which is slightly more flexible and gives more white space in printed output
./core/PGbasicmacros.pl:# which looks better but kills more trees.
./core/PGbasicmacros.pl:# force a space in latex, doesn't force extra space in html
./core/PGbasicmacros.pl:###############################################################
./core/PGbasicmacros.pl:###############################################################
./core/PGbasicmacros.pl:## Evaluation macros
./core/PGbasicmacros.pl:#
./core/PGbasicmacros.pl:# Look through a string for ``...`` or `...` and use
./core/PGbasicmacros.pl:# the parser to produce TeX code for the specified mathematics.
./core/PGbasicmacros.pl:# ``...`` does display math, `...` does in-line math. They
./core/PGbasicmacros.pl:# can also be used within math mode already, in which case they
./core/PGbasicmacros.pl:# use whatever mode is already in effect.
./core/PGbasicmacros.pl:#
./core/PGbasicmacros.pl:# kludge to clean up path names
./core/PGbasicmacros.pl:## allow underscore character in set and section names and also allows line breaks at /
./core/PGbasicmacros.pl:# An example of a macro which prints out a list (with letters)
./core/PGbasicmacros.pl:# This method is deprecated. There is no hope for the problems that use it. Java and flash are dead.
./core/PGbasicmacros.pl:# uniq gives unique elements of a list:
./core/PGbasicmacros.pl:# More advanced macros
./core/PGbasicmacros.pl:#This is bare bones code for embedding svg
./core/PGbasicmacros.pl:# This is bare bones code for embedding png files -- what else should be added? (there are .js scripts for example)
./core/PGbasicmacros.pl:# This is legacy code.
./core/PGbasicmacros.pl:# Self closing tags.
./core/PGbasicmacros.pl:###########
./core/PGbasicmacros.pl:# Auxiliary macros
./core/PGcommonFunctions.pl:# Make these interact nicely with Parser.pm
./core/PGcommonFunctions.pl:# Back to main package
./core/PGcommonFunctions.pl:# Make main versions call the checker to see
./core/PGcommonFunctions.pl:# which package-specific version to call
./core/PGauxiliaryFunctions.pl:# ^uses loadMacros
./core/PGauxiliaryFunctions.pl:# round added 6/12/2000 by David Etlinger. Edited by AKP 3-6-03
./core/PGauxiliaryFunctions.pl:# ^uses Round
./core/PGauxiliaryFunctions.pl:# Round contributed bt Mark Schmitt 3-6-03
./core/PGauxiliaryFunctions.pl:# ^uses gcd
./core/PGauxiliaryFunctions.pl:# ^ function random_pairwise_coprime
./core/PGauxiliaryFunctions.pl:# ^uses gcd
./core/PGauxiliaryFunctions.pl:# VS 6/30/2000
./core/PGauxiliaryFunctions.pl:# VS 7/10/2000
./core/PGauxiliaryFunctions.pl:# VS 8/1/2000 - slight adaption of code from T. Shemanske of Dartmouth College
./core/PGauxiliaryFunctions.pl:# factorial
./core/PGauxiliaryFunctions.pl:# ^function fact
./core/PGauxiliaryFunctions.pl:# ^uses P
./core/PGauxiliaryFunctions.pl:# return 1 so that this file can be included with require
./core/sage.pl:# Sage() is defined as an alias for creating a new sage object.
./core/sage.pl:## debug code -- uncomment next line -- note that string contains html and must be protected.
./core/sage.pl:# main::TEXT( "recordAnswerString is ", main::encode_pg_and_html($sage::recordAnswerString), $BR, main::encode_pg_and_html("recordAnswerBlank is |$recordAnswerBlank|"), $BR );
./core/sage.pl:# Notice that python is white space sensitive so the code
./core/sage.pl:# needs to be left justified when inserted to
./core/sage.pl:# avoid indentation errors.
./core/sage.pl:#
./core/MathObjects.pl:# ^uses loadMacros
./graph/PGtikz.pl:# Not much needs to be done here except flag this as needing the tikz environment wrapper.
./graph/PGtikz.pl:# The real work is done in LaTeXImage.pm.
./graph/PGlateximage.pl:# Not much needs to be done here.
./graph/PGlateximage.pl:# The real work is done in LaTeXImage.pm.
./graph/LiveGraphics3D.pl:# Syntactic sugar to make it easier to pass files and data to LiveGraphics3D.
./graph/LiveGraphics3D.pl:# Syntactic sugar to make it easier to pass raw Graohics3D data to LiveGraphics3D.
./graph/LiveGraphics3D.pl:# A message you can use for a caption under a graph.
./graph/PGnauGraphics.pl:# loadMacros('PGunion.pl');
./graph/PGnauGraphics.pl:######################################
./graph/PGnauGraphics.pl:#Name: Plot
./graph/PGnauGraphics.pl:#Input: Graphical object
./graph/PGnauGraphics.pl:#Optional Input: tex_size => n: control size of tex output. n = 10*percentage of page (i.e. 200 = 20% of page)
./graph/PGnauGraphics.pl:# note that in single column, the images are twice as big, so 200 = 40% of page
./graph/PGnauGraphics.pl:# single => 0,1: turn on or off single column display which makes pictures fit (default = 0)
./graph/PGnauGraphics.pl:#Output: An image with appropriate width and height of the graphical object
./graph/PGnauGraphics.pl:######################################
./graph/PGnauGraphics.pl:######################################
./graph/PGnauGraphics.pl:#Name: checkbox_table
./graph/PGnauGraphics.pl:#Input: [values list], [answer list i.e. 1,0,1,0]
./graph/PGnauGraphics.pl:#Optional Input: border => n - width of border in table (default = 0)
./graph/PGnauGraphics.pl:# tex_size => n - control size of tex output for pictures (defualt = 10 * 95 / # of columns)
./graph/PGnauGraphics.pl:# geometry =>[r,c] - the number of rows and columns desired in the table (default = 2,2)
./graph/PGnauGraphics.pl:# labels => [@list] - a list of labels that appear beside the checkboxes. (default is blank)
./graph/PGnauGraphics.pl:# [..] - other answer lists, included as many as desired. Note the lists must use the same
./graph/PGnauGraphics.pl:# values as the others and answer lists must be in the same basic order.
./graph/PGnauGraphics.pl:#Output: A table to be displayed and the answer evaluator.
./graph/PGnauGraphics.pl:# The table should be placed between BEGIN_TEXT and END_TEXT.
./graph/PGnauGraphics.pl:# The evaluator should be placed after END_TEXT by itself.
./graph/PGnauGraphics.pl:######################################
./graph/PGnauGraphics.pl:######################################
./graph/PGnauGraphics.pl:#Name: radio_table
./graph/PGnauGraphics.pl:#Input: [values list], [answer list i.e. 1,0,1,0]
./graph/PGnauGraphics.pl:#Optional Input: border => n - width of border in table (default = 0)
./graph/PGnauGraphics.pl:# tex_size => n - control size of tex output for pictures (defualt = 10 * 95 / # of columns)
./graph/PGnauGraphics.pl:# geometry =>[r,c] - the number of rows and columns desired in the table (default = 2,2)
./graph/PGnauGraphics.pl:# labels => [@list] - a list of labels that appear beside the radio buttons. (default is blank)
./graph/PGnauGraphics.pl:# [..] - other answer lists, included as many as desired. Note the lists must use the same
./graph/PGnauGraphics.pl:# values as the others and answer lists must be in the same basic order.
./graph/PGnauGraphics.pl:#Output: A table to be displayed and the answer evaluator.
./graph/PGnauGraphics.pl:# The table should be placed between BEGIN_TEXT and END_TEXT.
./graph/PGnauGraphics.pl:# The evaluator should be placed after END_TEXT by itself.
./graph/PGnauGraphics.pl:######################################
./graph/parserGraphTool.pl:# Convert the GraphTool object's options into JSON that can be passed to the JavaScript
./graph/parserGraphTool.pl:# graphTool method.
./graph/parserGraphTool.pl:# Produce a hidden answer rule to contain the JavaScript result and insert the graphbox div and
./graph/parserGraphTool.pl:# JavaScript to display the graph tool. If a hard copy is being generated, then PGtikz.pl is used
./graph/parserGraphTool.pl:# to generate a printable graph instead. An attempt is made to make the printable graph look
./graph/parserGraphTool.pl:# as much as possible like the JavaScript graph.
./graph/parserGraphTool.pl:# Modify the student's list answer returned by the graphTool JavaScript to reproduce the
./graph/parserGraphTool.pl:# JavaScript graph of the student's answer in the "Answer Preview" box of the results table.
./graph/parserGraphTool.pl:# The raw list form of the answer is displayed in the "Entered" box.
./graph/parserGraphTool.pl:# Create an answer checker to be passed to ANS(). Any parameters are passed to the checker, as
./graph/parserGraphTool.pl:# well as any parameters passed in via cmpOptions when the GraphTool object is created.
./graph/parserGraphTool.pl:# The correct answer is modified to reproduce the JavaScript graph of the correct answer
./graph/parserGraphTool.pl:# displayed in the "Correct Answer" box of the results table.
./graph/parserGraphTool.pl:# It is important that the parser::GraphTool object saved in the context flags is not accessed directly in the new
./graph/parserGraphTool.pl:# method for any package that derives from the GraphTool::GraphObject package. The objects for correct answers are
./graph/parserGraphTool.pl:# constructed when the parser::GraphTool "create" method is called, and at that time only the default GraphTool options
./graph/parserGraphTool.pl:# are available. If the constructor uses one of those options (for example many of the objects use the bBox option) and
./graph/parserGraphTool.pl:# that option is later changed when calling the "with" method, then the computations in the constructor will be
./graph/parserGraphTool.pl:# incorrect and not updated.
./graph/parserGraphTool.pl:# This should return 0 if the $point is satisfies the defining equation of the object or is on an edge of the object.
./graph/parserGraphTool.pl:# Otherwise it should return a nonzero number indicating a side or region of the object that the point is in.
./graph/parserGraphTool.pl:# If $fuzzy is false, then this should return true (or 1) if the $other object is visually the same as this object, and
./graph/parserGraphTool.pl:# false (or 0) otherwise. If $fuzzy is true, then this should return true if the $other object is visually the same as
./graph/parserGraphTool.pl:# the object ignoring if one object is solid and the other is dashed, and zero otherwise.
./graph/parserGraphTool.pl:# This makes the == operator work for GraphTool::GraphObjects. It should usually not be overridden. Instead override
./graph/parserGraphTool.pl:# the cmp method above.
./graph/parserGraphTool.pl:# The TikZ code to draw the object.
./graph/parserGraphTool.pl:# The TikZ clipping path for the object (used by the inequality fill method) with out the \clip command and its options.
./graph/parserGraphTool.pl:# The TikZ clipping path for the object (used by the inequality fill method) with the \clip command and options. Most
./graph/parserGraphTool.pl:# objects only override the clipCode method and let this method add in the default \clip command and inverse clip option
./graph/parserGraphTool.pl:# based on the fillCmp return value.
./graph/parserGraphTool.pl:# This method should return discrete values that represent which region the point ($x, $y) is in of the regions the
./graph/parserGraphTool.pl:# object breaks the plane into. The same value must be returned for all points in the same region. This method should
./graph/parserGraphTool.pl:# return 0 for all points on a border of the object.
./graph/parserGraphTool.pl:# This is only used by the flood fill algorithm, and should return 1 if $point is on the border of an object, and 0
./graph/parserGraphTool.pl:# otherwise. This only needs to be overridden if the flood fill algorithm could potentially bleed across a boundary from
./graph/parserGraphTool.pl:# one region to another (as determined by the return value of the fillCmp method) or the flood fill algorithm could
./graph/parserGraphTool.pl:# potentially go around an end of the object.
./graph/parserGraphTool.pl:# This method provides backward compatibility for objects defined the old way not deriving from the
./graph/parserGraphTool.pl:# GraphTool::GraphObject package. The old methods must be called after construction because they may perform
./graph/parserGraphTool.pl:# computations using options that are not set to their final values at that time. This is only called once and the
./graph/parserGraphTool.pl:# results cached for later use.
./graph/AppletObjects.pl:# Add basic functionality to the header of the question
./graph/AppletObjects.pl:# Deprecated applets (these are just stubs to show a warning if used)
./graph/AppletObjects.pl:# Inserts both header text and object text.
./graph/AppletObjects.pl:# GeogebraWeb APPLET PACKAGE
./graph/PGstatisticsGraphMacros.pl:#my $User = $main::studentLogin;
./graph/PGstatisticsGraphMacros.pl:#my $psvn = $main::psvn; #$main::in{'probSetKey'}; #in{'probSetNumber'}; #$main::probSetNumber;
./graph/PGstatisticsGraphMacros.pl:#my $setNumber = $main::setNumber;
./graph/PGstatisticsGraphMacros.pl:#my $probNum = $main::probNum;
./graph/PGstatisticsGraphMacros.pl:##############################################################################################
./graph/PGstatisticsGraphMacros.pl:# this accomplishes the following:
./graph/PGstatisticsGraphMacros.pl:# a) clears the accumulated statistical data,
./graph/PGstatisticsGraphMacros.pl:# b) Create three random, normally distributed, and one exponentially dist. data sets.
./graph/PGstatisticsGraphMacros.pl:# c) Add the data set to the collection of data
./graph/PGstatisticsGraphMacros.pl:# d) initializes a statistical graph object
./graph/PGstatisticsGraphMacros.pl:# e) adds the relevant box plots.
./graph/PGstatisticsGraphMacros.pl:##############################################################################################
./graph/PGstatisticsGraphMacros.pl:# clear_stat_graph_data(); # (a)
./graph/PGstatisticsGraphMacros.pl:#
./graph/PGstatisticsGraphMacros.pl:# @data1 = urand(10.0,2.0,10,2); # (b) - mean=10, sd=2.0, N=10, 2 dec places
./graph/PGstatisticsGraphMacros.pl:# @data2 = urand(12.0,2.0,10,2); # (b) - mean=12, sd=2.0
./graph/PGstatisticsGraphMacros.pl:# @data3 = urand(14.0,4.0,10,2); # (b) - mean=14, sd=4.0
./graph/PGstatisticsGraphMacros.pl:# @data4 = exprand(0.1,10,2); # (b) - lambda=0.1, N=10, and 2 dec places (exp)
./graph/PGstatisticsGraphMacros.pl:#
./graph/PGstatisticsGraphMacros.pl:# push_stat_data_set(~~@data1); # (c)
./graph/PGstatisticsGraphMacros.pl:# push_stat_data_set(~~@data2); # (c)
./graph/PGstatisticsGraphMacros.pl:# push_stat_data_set(~~@data3); # (c)
./graph/PGstatisticsGraphMacros.pl:# push_stat_data_set(~~@data4); # (c)
./graph/PGstatisticsGraphMacros.pl:#
./graph/PGstatisticsGraphMacros.pl:# # Now initialize the graph (d) and add the box plots (e)
./graph/PGstatisticsGraphMacros.pl:# $graph = init_statistics_graph(axes=>[0,0.0],ticks=>[10]);
./graph/PGstatisticsGraphMacros.pl:# $bounds = add_boxplot($graph,{"outliers"=>1});
./graph/PGstatisticsGraphMacros.pl:# # or #
./graph/PGstatisticsGraphMacros.pl:# $bounds = add_histogram($graph,10,1); # add a histogram with 10 bins and a multipler of 1.
./graph/PGstatisticsGraphMacros.pl:# # The multiplier is for the height of the frequencies.
./graph/PGstatisticsGraphMacros.pl:# # ex: if the multiplier is 2 the graph is twice as tall
./graph/PGstatisticsGraphMacros.pl:#
./graph/PGstatisticsGraphMacros.pl:###############################################################################################
./graph/plotly3D.pl:# Base plot class
./graph/plotly3D.pl:# Takes a pseudo function string and replaces with JavaScript functions.
./graph/plotly3D.pl:# JavaScript Functions Output
./graph/plotly3D.pl:# plotly3D surface plots
./graph/plotly3D.pl:# plotly3D curve plots
./graph/imageChoice.pl:# Create a match list where the answers are images
./graph/imageChoice.pl:# Usage: $ml = new_image_match_list(options);
./graph/imageChoice.pl:# where options are those that can be supplied to image_print_a below.
./graph/imageChoice.pl:# The answers should be an image name or reference to a plot object
./graph/imageChoice.pl:# (or a reference to a pair of either of these), and they are passed
./graph/imageChoice.pl:# to the Image function for processing. See unionUtils.pl for more
./graph/imageChoice.pl:# information on how these are handled.
./graph/imageChoice.pl:# A print routine for image matching. This is designed to display
./graph/imageChoice.pl:# four graphs per row. More can be included by setting the ImageOptions
./graph/imageChoice.pl:# variable in the match list. For example:
./graph/imageChoice.pl:# $ml->{ImageOptions} = [size => [100,100]]
./graph/imageChoice.pl:# You can include the following options:
./graph/imageChoice.pl:# size => [w,h] the width and height of the images
./graph/imageChoice.pl:# width => n the width of the images (obsolete)
./graph/imageChoice.pl:# height => n the height of the images (obsolete)
./graph/imageChoice.pl:# tex_size => n the size for the TeX version of the image
./graph/imageChoice.pl:# separation => n the spacing between the images in a row
./graph/imageChoice.pl:# vseparation => n the spacing between the images and captions
./graph/imageChoice.pl:# link => 0 or 1 1 to make a link to the original image
./graph/imageChoice.pl:# columns => n the number of images in each row (defaults to 4)
./graph/imageChoice.pl:# border => n the width of the image border
./graph/PCCgraphMacros.pl:###############################
./graph/PCCgraphMacros.pl:#Some standard values
./graph/PCCgraphMacros.pl:################################
./graph/PCCgraphMacros.pl:###############################
./graph/PCCgraphMacros.pl:#Name: NiceGraphParameters
./graph/PCCgraphMacros.pl:#Input: References to two arrays: one with all the x "action" in a graph, the other with the y "action"
./graph/PCCgraphMacros.pl:#Optional Input: centerOrigin, centerXaxis, centerYaxis, buffer, roughTickNum, roughTickNumX, roughTickNumY
./graph/PCCgraphMacros.pl:#Output: A reference to an array (xmin, xmax, ymin, ymax, xticknumber, yticknumber). These parameters will make a nice looking scale for a graph that captures all of the x and y data.
./graph/PCCgraphMacros.pl:################################
./graph/unionImage.pl:######################################################################
./graph/unionImage.pl:#
./graph/unionImage.pl:# A routine to make including images easier to control
./graph/unionImage.pl:#
./graph/unionImage.pl:# Usage: Image(name,options)
./graph/unionImage.pl:#
./graph/unionImage.pl:# where name is the name of an image file or a reference to a
./graph/unionImage.pl:# graphics object (or a reference to a pair of one of these),
./graph/unionImage.pl:# and options are taken from among the following:
./graph/unionImage.pl:#
./graph/unionImage.pl:# size => [w,h] the size of the image in the HTML page
./graph/unionImage.pl:# (default is [150,150])
./graph/unionImage.pl:#
./graph/unionImage.pl:# tex_size => r the size to use in TeX mode (as a percentage
./graph/unionImage.pl:# of the line width times 10). E.g., 500 is
./graph/unionImage.pl:# half the width, etc. (default is 200.)
./graph/unionImage.pl:#
./graph/unionImage.pl:# link => 0 or 1 whether to include a link to the original
./graph/unionImage.pl:# image (default is 0, unless there are
./graph/unionImage.pl:# two images given)
./graph/unionImage.pl:#
./graph/unionImage.pl:# border => 0 or 1 size of image border in HTML mode
./graph/unionImage.pl:# (defaults to 2 or 1 depending on whether
./graph/unionImage.pl:# there is a link or not)
./graph/unionImage.pl:#
./graph/unionImage.pl:# align => placement vertical alignment for image in HTML mode
./graph/unionImage.pl:# (default is "BOTTOM")
./graph/unionImage.pl:#
./graph/unionImage.pl:# tex_center => 0 or 1 whether to center the image horizontally
./graph/unionImage.pl:# in TeX mode (default is 0)
./graph/unionImage.pl:#
./graph/unionImage.pl:# The image name can be one of a number of different things. It can be
./graph/unionImage.pl:# the name of an image file, or an alias to one produce by the alias()
./graph/unionImage.pl:# command. It can be a graphics object reference created by init_graph().
./graph/unionImage.pl:# Or it can be a pair of these (in square brackets). The first is the
./graph/unionImage.pl:# image for the HTML file, and the second is the image that it will be
./graph/unionImage.pl:# linked to.
./graph/unionImage.pl:#
./graph/unionImage.pl:# Examples: Image("graph.gif", size => [200,200]);
./graph/unionImage.pl:# Image(["graph.gif","graph-large.gif"]);
./graph/unionImage.pl:#
./graph/unionImage.pl:# The alias() and insertGraph() functions will be called automatically
./graph/unionImage.pl:# when needed.
./graph/unionImage.pl:#
./math/algebraMacros.pl:# by Dick Lane http://webwork.maa.org/moodle/mod/forum/discuss.php?d=2286
./math/algebraMacros.pl:# you can call these when checking answers like this:
./math/algebraMacros.pl:#
./math/algebraMacros.pl:# ANS( $f->cmp( checker => ~~&modChecker ) );
./math/algebraMacros.pl:# make sure the external variables are available; for instance, in order to use
./math/algebraMacros.pl:# the modChecker subroutine, you must have the variable $modulus defined in
./math/algebraMacros.pl:# your problem
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:# modChecker
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:# Type: checker
./math/algebraMacros.pl:# Used in: RingsDefinition3.pg
./math/algebraMacros.pl:# RingsDefinition4.pg
./math/algebraMacros.pl:# RingsDefinition5.pg
./math/algebraMacros.pl:# RingsDefinition7.pg
./math/algebraMacros.pl:# RingsQuotientPolynomial3.pg
./math/algebraMacros.pl:# RingsQuotientPolynomial4.pg
./math/algebraMacros.pl:# RingsIdealsHomomorphisms2.pg
./math/algebraMacros.pl:# Purpose: Compare the student's answer (a number) to the correct
./math/algebraMacros.pl:# answer (a number), modulo $modulus
./math/algebraMacros.pl:# External variables:
./math/algebraMacros.pl:# $modulus
./math/algebraMacros.pl:# Comment: This checker is defined in algebraMacros.pl because it's used
./math/algebraMacros.pl:# in so many problems
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:# checkCycles
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:# Type: checker
./math/algebraMacros.pl:# Used in: Permutations1.pg
./math/algebraMacros.pl:# Permutations2.pg
./math/algebraMacros.pl:# Permutations5.pg
./math/algebraMacros.pl:# Permutations6.pg
./math/algebraMacros.pl:# Purpose: Compare a student's cycle to a correct cycle, see if they
./math/algebraMacros.pl:# represent the same permutation (i.e. ( 1 2 3 ) = ( 2 3 1 ) )
./math/algebraMacros.pl:# External variables:
./math/algebraMacros.pl:# Comment: This checker is defined in algebraMacros.pl because it's used
./math/algebraMacros.pl:# in so many problems
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:# checkListOfTranspositions
./math/algebraMacros.pl:###############################################################################
./math/algebraMacros.pl:# Type: checker
./math/algebraMacros.pl:# Used in: Permutations4.pg
./math/algebraMacros.pl:# Permutations8.pg
./math/algebraMacros.pl:# Purpose: Compare a student's sequence of transpositions to a correct
./math/algebraMacros.pl:# sequence of transpositions, see if they represent the same
./math/algebraMacros.pl:# permutation
./math/algebraMacros.pl:# External variables:
./math/algebraMacros.pl:# @x - list of elements in the set on which permutations are
./math/algebraMacros.pl:# defined
./math/algebraMacros.pl:# Comment: This checker is defined in algebraMacros.pl because it's used
./math/algebraMacros.pl:# in so many problems
./math/algebraMacros.pl:###############################################################################
./math/MatrixReduce.pl:# Observation: a randomly generated 3 x 4 matrix has a very high probability
./math/MatrixReduce.pl:# of having rank 3. So, trying to generate random 3 x 4 matrices until a
./math/MatrixReduce.pl:# matrix of rank < 3 appears would be a bad idea. Also, there is no
./math/MatrixReduce.pl:# guarantee that a randomly generated matrix will represent a consistent
./math/MatrixReduce.pl:# system; however, empirical evidence suggests that the majority of the
./math/MatrixReduce.pl:# time a random 3 x 4 matrix is produced, it is rank 3 and represents
./math/MatrixReduce.pl:# a consistent system. Also, with randomly chosen matrices, it is
./math/MatrixReduce.pl:# possible to get rows or columns of zeros, so watch out!
./math/MatrixReduce.pl:# rref: input and output are MathObject matrices.
./math/MatrixReduce.pl:# Should be run in Fraction context for best results.
./math/MatrixReduce.pl:# This was written by Davide Cervone.
./math/MatrixReduce.pl:# http://webwork.maa.org/moodle/mod/forum/discuss.php?d=2970
./math/SI_property_tables.pl:# SI_property_tables.pl
./math/SI_property_tables.pl:# Rename this file (with .pl extension) and place it in your course macros directory,
./math/SI_property_tables.pl:#######################################################
./math/SI_property_tables.pl:#######################################################
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:### below are the lists of the tabulated values ###
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:#######################################################
./math/SI_property_tables.pl:#######################################################
./math/SI_property_tables.pl:###########################
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:### saturated water ###
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:###########################
./math/SI_property_tables.pl:###############
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:### air ###
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:###############
./math/SI_property_tables.pl:#############################
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:### superheated water ###
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:#############################
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 0.1 MPa ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 1.2 MPa ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 1.4 MPa ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 1.6 MPa ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 1.8 MPa ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 10 MPa ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:############################
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:### saturated R-134a ###
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:############################
./math/SI_property_tables.pl:##############################
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:### superheated R-134a ###
./math/SI_property_tables.pl:### ###
./math/SI_property_tables.pl:##############################
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 0.7 MPa ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 0.8 MPa ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 0.9 MPa ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### ####
./math/SI_property_tables.pl:#### 1.2 MPa ####
./math/SI_property_tables.pl:#### ####
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Takes two arrays of polynomial coefficients representing
./math/PGpolynomialmacros.pl:# two polynomials and returns their sum.
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Takes two arrays of polynomial coefficients representing
./math/PGpolynomialmacros.pl:# two polynomials and returns their difference.
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Accepts two arrays containing coefficients in descending order
./math/PGpolynomialmacros.pl:# returns an array with the coefficients of the product
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Performs synthetic division on two polynomials returning
./math/PGpolynomialmacros.pl:# the quotient and remainder in an array.
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Performs long division on two polynomials
./math/PGpolynomialmacros.pl:# returning the quotient and remainder
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Accepts a reference to an array containing the coefficients, in descending
./math/PGpolynomialmacros.pl:# order, of a polynomial.
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Returns the lowest positive integral upper bound to the roots of the
./math/PGpolynomialmacros.pl:# polynomial.
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Accepts a reference to an array containing the coefficients, in descending
./math/PGpolynomialmacros.pl:# order, of a polynomial.
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Returns the greatest negative integral lower bound to the roots of the
./math/PGpolynomialmacros.pl:# polynomial
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Accepts an array containing the coefficients of a polynomial
./math/PGpolynomialmacros.pl:# in descending order
./math/PGpolynomialmacros.pl:# Returns a sting containing the polynomial with variable x
./math/PGpolynomialmacros.pl:# Default variable is x
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# Accepts an array containing the coefficients, in descending order, of a
./math/PGpolynomialmacros.pl:# polynomial
./math/PGpolynomialmacros.pl:# Returns the maximum number of positive and negative roots according to
./math/PGpolynomialmacros.pl:# Descartes Rule of Signs
./math/PGpolynomialmacros.pl:#
./math/PGpolynomialmacros.pl:# IMPORTANT NOTE: this function currently does not accept coefficients of
./math/PGpolynomialmacros.pl:# zero.
./math/PGpolynomialmacros.pl:#
./math/tableau.pl:##### From gage_matrix_ops
./math/tableau.pl:# 2014_HKUST_demo/templates/setSequentialWordProblem/bill_and_steve.pg:"gage_matrix_ops.pl",
./math/tableau.pl:# loadMacros("tableau_main_subroutines.pl");
./math/tableau.pl:# $foochecker = $constraints->cmp()->withPostFilter(
./math/tableau.pl:# linebreak_at_commas()
./math/tableau.pl:# );
./math/tableau.pl:# lop_display($tableau, align=>'cccc|cc|c|c', toplevel=>[qw(x1,x2,x3,x4,s1,s2,P,b)])
./math/tableau.pl:# Pretty prints the output of a matrix as a LOP with separating labels and
./math/tableau.pl:# variable labels.
./math/tableau.pl:# for main section of tableau.pl
./math/tableau.pl:# make one phase2 pivot on a tableau (works in place)
./math/tableau.pl:# returns flag with '', 'optimum' or 'unbounded'
./math/tableau.pl:#iteratively phase2 pivots a feasible tableau until the
./math/tableau.pl:# flag returns 'optimum' or 'unbounded'
./math/tableau.pl:# tableau is returned in a "stopped" state.
./math/tableau.pl:# make one phase 1 pivot on a tableau (works in place)
./math/tableau.pl:# returns flag with '', 'infeasible_lop' or 'feasible_point'
./math/tableau.pl:# perhaps 'feasible_point' should be 'feasible_lop'
./math/tableau.pl:########################
./math/tableau.pl:##############
./math/tableau.pl:# get_tableau_variable_values is
./math/tableau.pl:# deprecated for tableaus - use $tableau->statevars instead
./math/tableau.pl:#
./math/tableau.pl:# It calculates the values of the basis variables of the tableau,
./math/tableau.pl:# assuming the parameter variables are 0.
./math/tableau.pl:#
./math/tableau.pl:# Usage: get_tableau_variable_values($MathObjectMatrix_tableau, $MathObjectSet_basis)
./math/tableau.pl:#
./math/tableau.pl:# feature request -- for tableau object -- allow specification of non-zero parameter variables
./math/tableau.pl:#### Test -- assume matrix is this
./math/tableau.pl:# 1 2 1 0 0 | 0 | 3
./math/tableau.pl:# 4 5 0 1 0 | 0 | 6
./math/tableau.pl:# 7 8 0 0 1 | 0 | 9
./math/tableau.pl:# -1 -2 0 0 0 | 1 | 10 # objective row
./math/tableau.pl:# and basis is {3,4,5} (start columns with 1)
./math/tableau.pl:# $n= 4; $m = 7
./math/tableau.pl:# $x1=0; $x2=0; $x3=s1=3; $x4=s2=6; $x5=s3=9; w=10=objective value
./math/tableau.pl:#
./math/tableau.pl:#
./math/tableau.pl:##################################################
./math/tableau.pl:# We're going to have several types
./math/tableau.pl:# MathObject Matrices Value::Matrix
./math/tableau.pl:# tableaus form John Jones macros
./math/tableau.pl:# MathObject tableaus
./math/tableau.pl:# Containing an matrix $A coefficients for constraint
./math/tableau.pl:# A vertical vector $b for constants for constraints
./math/tableau.pl:# A horizontal vector $c for coefficients for objective function
./math/tableau.pl:# A vertical vector $P for the value of the objective function
./math/tableau.pl:# dimensions $n problem vectors, $m constraints = $m slack variables
./math/tableau.pl:# A basis Value::Set -- positions for columns which are independent and
./math/tableau.pl:# whose associated variables can be determined
./math/tableau.pl:# uniquely from the parameter variables.
./math/tableau.pl:# The non-basis (parameter) variables are set to zero.
./math/tableau.pl:#
./math/tableau.pl:# state variables (assuming parameter variables are zero or when given parameter variables)
./math/tableau.pl:# create the methods for updating the various containers
./math/tableau.pl:# create the method for printing the tableau with all its decorations
./math/tableau.pl:# possibly with switches to turn the decorations on and off.
./math/tableau.pl:# consider entries zero if they are less than $tableauZeroLevel times the current_basis_coeff.
./math/tableau.pl:# tableau constructor Tableau->new(A=>Matrix, b=>Vector or Matrix, c=>Vector or Matrix)
./math/tableau.pl:# main::DEBUG_MESSAGE(" coldim: $obj_col_dim , row: $obj_row_index obj_matrix: $obj_row_matrix ".ref($obj_row_matrix) );
./math/tableau.pl:# main::DEBUG_MESSAGE(" \@obj_row ", join(' ', @obj_row ) );
./math/tableau.pl:# eventually these routines should be included in the Value::Matrix
./math/tableau.pl:# module?
./math/tableau.pl:# This was written by Davide Cervone.
./math/tableau.pl:# http://webwork.maa.org/moodle/mod/forum/discuss.php?d=2970
./math/tableau.pl:# taken from MatrixReduce.pl from Paul Pearson
./math/bizarroArithmetic.pl:###########################
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:# functions used in defining bizarro arithmetic
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:#This f just stretches complex numbers by a positve real that
./math/bizarroArithmetic.pl:#depends in a nontrivial away on the magnitude of z
./math/bizarroArithmetic.pl:#The inverse of f.
./math/bizarroArithmetic.pl:###########################
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:# Subclass the addition
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:###########################
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:# Subclass the subtraction
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:###########################
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:# Subclass the multiplication
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:###########################
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:# Subclass the division
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:###########################
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:# Subclass the power
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:###########################
./math/bizarroArithmetic.pl:#
./math/bizarroArithmetic.pl:# Subclass the negation
./math/bizarroArithmetic.pl:#
./math/PGnauSet.pl:#######################################################################################################
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# Name : DrawVenn2
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# Input :
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# $input_word = 'region1_info, region2_info, ...'
./math/PGnauSet.pl:# The information to use, arranged in order by region.
./math/PGnauSet.pl:# Use "_fill_" to shade the corresponding region, otherwise
./math/PGnauSet.pl:# the input is treated as label.
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# @options = 'Arrow indicated options' in any order.
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# labels=>'Set1 label, Set2 label, U'. Set1 is on the
./math/PGnauSet.pl:# left. Leaving any or all entries blank will
./math/PGnauSet.pl:# produce no label for that item. Default is
./math/PGnauSet.pl:# 'A,B,U'
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# Output : $diagram = a graphics object, the diagram to plot. Use 'Plot' in the
./math/PGnauSet.pl:# .pg file.
./math/PGnauSet.pl:#
./math/PGnauSet.pl:########################################################################################################
./math/PGnauSet.pl:#######################################################################################################
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# Name : DrawVenn3
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# Input :
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# $input_word = 'region1_info, region2_info, ...'
./math/PGnauSet.pl:# The information to use, arranged in order by region.
./math/PGnauSet.pl:# Use "_fill_" to shade the corresponding region, otherwise
./math/PGnauSet.pl:# the input is treated as label.
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# @options = 'Arrow indicated options' in any order.
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# labels=>'Set1 label, Set2 label, Set 3 label, U'. Set1 is on the
./math/PGnauSet.pl:# left. Leaving any or all entries blank will
./math/PGnauSet.pl:# produce no label for that item. Default is
./math/PGnauSet.pl:# 'A,B,C,U'
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# Output : $diagram = a graphics object, the diagram to plot. Use 'Plot' in the
./math/PGnauSet.pl:# .pg file.
./math/PGnauSet.pl:#
./math/PGnauSet.pl:########################################################################################################
./math/PGnauSet.pl:#####################################
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# Name : Venn2answers
./math/PGnauSet.pl:#
./math/PGnauSet.pl:#
./math/PGnauSet.pl:#####################################
./math/PGnauSet.pl:#####################################
./math/PGnauSet.pl:#
./math/PGnauSet.pl:# Name : Venn3answers
./math/PGnauSet.pl:#
./math/PGnauSet.pl:#
./math/PGnauSet.pl:#####################################
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:#Name: MeanDev
./math/PGnauStats.pl:#Input: List of data values
./math/PGnauStats.pl:#Output: List containing mean and standard deviation
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:#Name: Median
./math/PGnauStats.pl:#Input: List of data values
./math/PGnauStats.pl:#Output: Value of the median
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:#Name: FiveNum
./math/PGnauStats.pl:#Input: List of data values
./math/PGnauStats.pl:#Output: List containing the five number summary in order from Low to High
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:#Name: Mode
./math/PGnauStats.pl:#Input: List of data values
./math/PGnauStats.pl:#Optional Input: 'Max_Modes'=> num limits the maximum number of modes to num
./math/PGnauStats.pl:#Output: List containing the mode or the list ("None") if the number of modes
./math/PGnauStats.pl:# is more than num,
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:######################################
./math/PGnauStats.pl:#Name: isstring
./math/PGnauStats.pl:#Input: A variable
./math/PGnauStats.pl:#Output: A 1 if the variable is a string, 0 otherwise
./math/PGnauStats.pl:######################################
./math/PGnauStats.pl:#########################################################################################
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# Name : BoxPlot
./math/PGnauStats.pl:# Input : $min = the minimum value in the dataset
./math/PGnauStats.pl:# $q1 = the first quartile value
./math/PGnauStats.pl:# $q2 = the second quartile (median) value
./math/PGnauStats.pl:# $q3 = the third quartile value
./math/PGnauStats.pl:# $max = the maximum value in the dataset
./math/PGnauStats.pl:# Options = array of numbers to be plotted with tickmarks,
./math/PGnauStats.pl:# perhaps interspersed with the options below
./math/PGnauStats.pl:# in any order.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# Options :: The following may be passed AFTER the five numbers
./math/PGnauStats.pl:# (together with the labels, without regard to order):
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (1) Use "wmin=>number" (no quotes really) to set the
./math/PGnauStats.pl:# lower viewing window. Default is '$min'
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (2) Use "wmax=>number" (no quotes really) to set the
./math/PGnauStats.pl:# upper viewing window. Default is '$max'
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (3) Use "horzlabels=>number" to set the approximate
./math/PGnauStats.pl:# number of horizontal labels. Default is 10.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (4) Use "axis=>0" to hide the horizontal axis.
./math/PGnauStats.pl:# Default is to plot the axis.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (5) Use labels such as 'a','b' and so on to label any
./math/PGnauStats.pl:# of the five numbers with the desired string.
./math/PGnauStats.pl:# Default is no labels.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# Output : $pic = a graphics object.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:#####################################################################################
./math/PGnauStats.pl:#################
./math/PGnauStats.pl:# Name : SpecialData
./math/PGnauStats.pl:# Input : A string containing the type of data desired (Exp, Sym, Bi, Norm, Left, Right)
./math/PGnauStats.pl:# and any optional input.
./math/PGnauStats.pl:# Optional Input : count => n : the number of data values to generate (default = 500)
./math/PGnauStats.pl:# mean => n : The mean for the normal, left or right distributions (default = 0)
./math/PGnauStats.pl:# dev => n : The standard deviation for the normal, left or right distributions (default = 1)
./math/PGnauStats.pl:# min => n : The minimum value for the data (default = 0)
./math/PGnauStats.pl:# max => n : The maximum value for the data (default = 100)
./math/PGnauStats.pl:# Output : A list of data values with the special properties.
./math/PGnauStats.pl:#################
./math/PGnauStats.pl:######################################
./math/PGnauStats.pl:#Name: PercentStemAndLeaf
./math/PGnauStats.pl:#Input: List of percentage values (anything from 0 to 100).
./math/PGnauStats.pl:#Optional Input: At beginning of list:
./math/PGnauStats.pl:# all => 1,0 turns on or off the display of all columns of the
./math/PGnauStats.pl:# table (useful if data is within a small range).
./math/PGnauStats.pl:# sort => 1,0 turns on or off sorted data rows.
./math/PGnauStats.pl:# single=>1,0 displays answers as a single cell in the table or
./math/PGnauStats.pl:# determines the number from the data.
./math/PGnauStats.pl:#Output: A list containing two strings. The first is a string that represents
./math/PGnauStats.pl:# the html table to be displayed and the second is the TeX table to be
./math/PGnauStats.pl:# displayed.
./math/PGnauStats.pl:######################################
./math/PGnauStats.pl:###
./math/PGnauStats.pl:# Name : RoundStep
./math/PGnauStats.pl:###
./math/PGnauStats.pl:###
./math/PGnauStats.pl:# Name : CeilingStep
./math/PGnauStats.pl:###
./math/PGnauStats.pl:###
./math/PGnauStats.pl:# Name : FloorStep
./math/PGnauStats.pl:###
./math/PGnauStats.pl:#############################################################################
./math/PGnauStats.pl:# Name : Histogram
./math/PGnauStats.pl:# Input : @data = "the data"
./math/PGnauStats.pl:# Options = may be interspersed in the data in any order.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# Options :: The following may be passed AFTER the standard input
./math/PGnauStats.pl:# above (without regard to order):
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (1) Use "labelcells=>1" (no quotes really) to include
./math/PGnauStats.pl:# frequency labels at the top of each cell.
./math/PGnauStats.pl:# The default is no labels.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (2) Use "labelcount=>number" (no quotes really) to
./math/PGnauStats.pl:# set an approximate number of labels to use on the
./math/PGnauStats.pl:# vertical axis. Default is 5.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (3) Use "title=>string" to add a title, centered at
./math/PGnauStats.pl:# the top.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (4) Use "axislabel=>string" to add an axis label,
./math/PGnauStats.pl:# centered at the bottom.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# (5) Use "bins=>number" to specify approximately how
./math/PGnauStats.pl:# many bins should be used. Default is 10.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# Note : any extra numbers input at the end will be
./math/PGnauStats.pl:# taken as data.
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# Output : $pic = a graphics object
./math/PGnauStats.pl:#############################################################################
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:#Name: RandomNormalNumber
./math/PGnauStats.pl:#Input: None required
./math/PGnauStats.pl:#Optional Input: 'mean' => the mean of the normal distribution being used. (default = 0)
./math/PGnauStats.pl:# 'dev' => the standard deviation of the normal distribution being used. (default = 1)
./math/PGnauStats.pl:#Output: A number that is related to the standard normal curve with the given mean and deviation.
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:#Name: Scatterplot
./math/PGnauStats.pl:#Input: Correlation coefficient
./math/PGnauStats.pl:#Optional Input: 'count'=> Number of data points to be calculated.
./math/PGnauStats.pl:# 'mean' => the mean of the normal distribution being used.
./math/PGnauStats.pl:# 'dev' => the standard deviation of the normal distribution being used.
./math/PGnauStats.pl:# 'slope'=> the slope of the scatterplot.
./math/PGnauStats.pl:#Output: A picture of the scatterplot with given slope and correlation coefficient.
./math/PGnauStats.pl:################################
./math/PGnauStats.pl:######################################
./math/PGnauStats.pl:#Name: PieChart
./math/PGnauStats.pl:#Input: List of values as: decimals - which should add to 1. If it
./math/PGnauStats.pl:# sums to less than one, the function will make up the difference.
./math/PGnauStats.pl:# or numbers > 1 - will be treated as numerators for fractions. The sum of the
./math/PGnauStats.pl:# numbers will be the denominator and fractions will be placed on the
./math/PGnauStats.pl:# circle plot.
./math/PGnauStats.pl:#Optional Input: percent => 0, 1 : Off or on display of percentage values (regardless of input manner) (default = 0)
./math/PGnauStats.pl:# labels => 1, 0 : On or off label display. (default = 1)
./math/PGnauStats.pl:# values => 1, 0 : On or off value display. (default = 1)
./math/PGnauStats.pl:#Output: A picture of the corresponding circle plot
./math/PGnauStats.pl:######################################
./math/PGnauStats.pl:###########################################################################################################
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# Name : DrawNormalDist
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# Input : lower_z_point, upper_z_point (use -INF or INF for infinite values)
./math/PGnauStats.pl:#
./math/PGnauStats.pl:# Optional Input : After first two points.
./math/PGnauStats.pl:# $lower_label = the lower label to use. Default is 'a'
./math/PGnauStats.pl:# $upper_label = the upper label to use. Default is 'b'
./math/PGnauStats.pl:# (if only want upper label, must input a lower label)
./math/PGnauStats.pl:# outside => n - 0, 1 to shade between or outside the numbers Default = 0;
./math/PGnauStats.pl:# title => 'title string' - will display a title if desired.
./math/PGnauStats.pl:# mean => n - will display the given mean (default display nothing)
./math/PGnauStats.pl:#
./math/PGnauStats.pl:###########################################################################################################
./math/PGnumericalmacros.pl:# Cubic spline algorithm adapted from p319 of Kincaid and Cheney's Numerical Analysis.
./math/tableau_main_subroutines.pl:# subroutines included into the main:: package.
./math/tableau_main_subroutines.pl:########################
./math/tableau_main_subroutines.pl:##############
./math/tableau_main_subroutines.pl:# get_tableau_variable_values
./math/tableau_main_subroutines.pl:#
./math/tableau_main_subroutines.pl:# Calculates the values of the basis variables of the tableau,
./math/tableau_main_subroutines.pl:# assuming the parameter variables are 0.
./math/tableau_main_subroutines.pl:#
./math/tableau_main_subroutines.pl:# Usage: ARRAY = get_tableau_variable_values($MathObjectMatrix_tableau, $MathObjectSet_basis)
./math/tableau_main_subroutines.pl:#
./math/tableau_main_subroutines.pl:# feature request -- for tableau object -- allow specification of non-zero parameter variables
./math/tableau_main_subroutines.pl:#### Test -- assume matrix is this
./math/tableau_main_subroutines.pl:# 1 2 1 0 0 | 0 | 3
./math/tableau_main_subroutines.pl:# 4 5 0 1 0 | 0 | 6
./math/tableau_main_subroutines.pl:# 7 8 0 0 1 | 0 | 9
./math/tableau_main_subroutines.pl:# -1 -2 0 0 0 | 1 | 10 # objective row
./math/tableau_main_subroutines.pl:# and basis is {3,4,5} (start columns with 1)
./math/tableau_main_subroutines.pl:# $n= 4; $m = 7
./math/tableau_main_subroutines.pl:# $x1=0; $x2=0; $x3=s1=3; $x4=s2=6; $x5=s3=9; w=10=objective value
./math/SolveLinearEquationPCC.pl:#These three subroutines uniformize how all our "solve this equation" problems are handled.
./math/SolveLinearEquationPCC.pl:#"Solve the following linear equation; the answer could be in the form $eqTypesString, [|no solution|]*, or [|all real numbers|]*."
./math/SolveLinearEquationPCC.pl:#(Compute($ansEq[$i])->value)[1] => ["You have the solution, but the answer to this question should be in the form $ansType[$i]" , replaceMessage => 1],
./math/SolveLinearEquationPCC.pl:#sub {
./math/SolveLinearEquationPCC.pl:# my ($correct, $student, $ansHash) =@_;
./math/SolveLinearEquationPCC.pl:# return (Compute($ansHash->{original_student_ans})->class eq 'Set');
./math/SolveLinearEquationPCC.pl:#} => ["You are trying to give the solution set in set notation, but the answer to this question should be in the form $ansType[$i]" , replaceMessage => 1],
./math/SolveLinearEquationPCC.pl:#sub {
./math/SolveLinearEquationPCC.pl:# my ($correct, $student, $ansHash) =@_;
./math/SolveLinearEquationPCC.pl:# return (Compute($ansHash->{original_student_ans})->class eq 'Set' and $student == (Compute($ansEq[$i])->value)[1]);
./math/SolveLinearEquationPCC.pl:#} => ["You have the solution set, but the answers to this question should be in the form $ansType[$i]" , replaceMessage => 1],
./math/SolveLinearEquationPCC.pl:#if we make it through all the pre-2017 answer checking, now check for answers like 12 or {12} (as opposed to x=12) and award credit
./math/SystemsOfLinearEquationsProblemPCC.pl:##############################################
./math/SystemsOfLinearEquationsProblemPCC.pl:##############################################
./math/SystemsOfLinearEquationsProblemPCC.pl:##############################################
./math/SystemsOfLinearEquationsProblemPCC.pl:#############################################################
./math/SystemsOfLinearEquationsProblemPCC.pl:#############################################################
./math/SystemsOfLinearEquationsProblemPCC.pl:#if only the second equation has a 1 for one of its coefficients, swap equations; this is more to simplify the code of the solution.
./math/SystemsOfLinearEquationsProblemPCC.pl:#############################################################
./math/SystemsOfLinearEquationsProblemPCC.pl:#############################################################
./math/SystemsOfLinearEquationsProblemPCC.pl:#############################################################
./math/SystemsOfLinearEquationsProblemPCC.pl:#
./math/SystemsOfLinearEquationsProblemPCC.pl:# Set up the LinearSystems context
./math/SystemsOfLinearEquationsProblemPCC.pl:#
./math/PCCfactor.pl:####
./math/PCCfactor.pl:# End sub factoringMethods
./math/PCCfactor.pl:####
./math/PGmatrixmacros.pl:# Make an image of a big delimiter for a matrix
./math/PGmatrixmacros.pl:# Basically uses a table of special characters and simple
./math/PGmatrixmacros.pl:# recipe to produce big delimeters a la tth mode
./math/PGmatrixmacros.pl:# Make a row for the matrix
./math/draggableProof.pl:# Deprecated alias for ans_rule.
./math/draggableProof.pl:# Damerau-Levenshtein distance with adjacent transpositions.
./math/draggableProof.pl:# https://en.wikipedia.org/wiki/Damerau-Levenshtein_distance
./math/PGstatisticsmacros.pl:# Usage: ($t,$df,$p) = two_sample_t_test(\@data1,\@data2); # Perform a two-sided t-test using a pooled variance.
./math/PGstatisticsmacros.pl:# or: ($t,$df,$p) = two_sample_t_test(\@data1,\@data2,{'test'=>'right','variance'=>'pooled}); # Perform a right sided t-test using a pooled variance
./math/PGstatisticsmacros.pl:# or: ($t,$df,$p) = two_sample_t_test(\@data1,\@data2,{'test'=>'left','variance'=>'separate'}); # Perform a left sided t-test using a separate variance
./math/PGstatisticsmacros.pl:# or: ($t,$df,$p) = two_sample_t_test(\@data1,\@data2,{'test'=>'two-sided','variance'=>'pooled}); # Perform a left sided t-test using a pooled variance
./math/PGstatisticsmacros.pl:#
./math/PGstatisticsmacros.pl:# example:
./math/PGstatisticsmacros.pl:#
./math/PGstatisticsmacros.pl:# @data1 = (1,2,3,4,5,6,7);
./math/PGstatisticsmacros.pl:# @data2 = (2,3,4,5,6,7,9);
./math/PGstatisticsmacros.pl:# ($t,$df,$p) = two_sample_t_test(2.5,\@data1,\@data2,{'test'=>'right','variance'=>'pooled});
./math/PGstatisticsmacros.pl:#
./math/customizeLaTeX.pl:##### Set theory macros
./math/customizeLaTeX.pl:##### Logic macros
./math/customizeLaTeX.pl:##### Linear algebra macros
./math/customizeLaTeX.pl:##### Algebra macros
./math/customizeLaTeX.pl:# leave one of the following return commands uncommented, depending on what notation you want to use for finite cyclic groups (e.g., Z/nZ)
./math/customizeLaTeX.pl:# Macro to display the ring Z/nZ
./math/customizeLaTeX.pl:# if you want to display dihedral groups as D_n (for instance, D_4 is the dihedral group of order 8), then leave this subroutine unmodified
./math/customizeLaTeX.pl:# if you want to display dihedral groups as D_{2n} (for instance, D_8 is the dihedral group of order 8), then uncomment this set of if/else statements. The regular expression conditionals are to make sure it handles different types of arguments correctly.
./math/customizeLaTeX.pl:# if( "$n" =~ m/^\s*(\d+)\s*$/ )
./math/customizeLaTeX.pl:# {
./math/customizeLaTeX.pl:# $n = 2 * $1;
./math/customizeLaTeX.pl:# }
./math/customizeLaTeX.pl:# elsif( "$n" =~ m/^\s*(\w+)\s*$/ )
./math/customizeLaTeX.pl:# {
./math/customizeLaTeX.pl:# $n = "2$1";
./math/customizeLaTeX.pl:# }
./math/customizeLaTeX.pl:# else
./math/customizeLaTeX.pl:# {
./math/customizeLaTeX.pl:# $n = "2($n)";
./math/customizeLaTeX.pl:# }
./math/PGnauScheduling.pl:#####################################################################
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Name : ListProcEval (answer evaluator for the scheduling .pg files)
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:#####################################################################
./math/PGnauScheduling.pl:#############################################################
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Name : MakeArrow
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Input : $i_1 = the 'tail' x_coordinate in pixels
./math/PGnauScheduling.pl:# $i_2 = the 'tail' y_coordinate in pixels
./math/PGnauScheduling.pl:# $j_1 = the 'head' x_coordinate in pixels
./math/PGnauScheduling.pl:# $j_2 = the 'head' y_coordinate in pixels
./math/PGnauScheduling.pl:# $size = the arrowhead size, in pixels
./math/PGnauScheduling.pl:# $pic = the graphics object to modify
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Output : $pic
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:#############################################################
./math/PGnauScheduling.pl:####################################################################################################
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Name : DrawSchedule
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Input : $coordinates = "row (0, ... , 10), column (0, ... , 10), weight, ... , ... "
./math/PGnauScheduling.pl:# The order determines the vertex index and label used.
./math/PGnauScheduling.pl:# $connections = "vertex index (tail), vertex index (head), ... , ... "
./math/PGnauScheduling.pl:# The vertex indices are taken according to the ordering in
./math/PGnauScheduling.pl:# $coordinates.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Output : $pic = the graphics object.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:####################################################################################################
./math/PGnauScheduling.pl:######################################################################################################
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Name : ListProc (to determine the schedule from a priority list)
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Input : $coordinates = "row (0, ... , 10), column (0, ... , 10), weight, ... , ... "
./math/PGnauScheduling.pl:# The order determines the vertex index and label used.
./math/PGnauScheduling.pl:# $connections = "vertex index (tail), vertex index (head), ... , ... "
./math/PGnauScheduling.pl:# The vertex indices are taken according to the ordering in
./math/PGnauScheduling.pl:# $coordinates.
./math/PGnauScheduling.pl:# $order = The 'priority list' needed to realize the scheduling (p.79 textbook).
./math/PGnauScheduling.pl:# $machine_count = The number of available machines or processors.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Output : @done_list = The 'raw' scheduling solution, indexed by machine:
./math/PGnauScheduling.pl:# "vertex index, time, vertex index, time, ...
./math/PGnauScheduling.pl:# The last indexed entry is the algorithm time.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:#####################################################################################################
./math/PGnauScheduling.pl:###########################################################
./math/PGnauScheduling.pl:# To generate a randomly ordered list of distinct integers
./math/PGnauScheduling.pl:###########################################################
./math/PGnauScheduling.pl:############################################################################################################################
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Name : FindPathsSchedule ( Works only for appropriate schedule type graphs )
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Input : $start_vertex = An index indicating the 'start vertex' to consider. Indices here START WITH ZERO.
./math/PGnauScheduling.pl:# $connections = The connectivity vector to use to determine the paths. Indices here START WITH ZERO.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Output : @path_list = stores all possible paths from the 'start' vertex.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:############################################################################################################################
./math/PGnauScheduling.pl:###########################################################################################################
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Name : CritList ( Produces a priority list according to the critical path scheduling algorithm )
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Input : $coordinates = "row (0, ... , 10), column (0, ... , 10), weight, ... , ... "
./math/PGnauScheduling.pl:# The order determines the vertex index and label used.
./math/PGnauScheduling.pl:# $connections = "vertex index (tail), vertex index (head), ... , ... "
./math/PGnauScheduling.pl:# The vertex indices are taken according to the ordering in
./math/PGnauScheduling.pl:# $coordinates.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Output : $priority_list = The priority list to use, according to the critical path
./math/PGnauScheduling.pl:# algorithm. (The tasks are numerically labeled beginning with
./math/PGnauScheduling.pl:# 1 according to the order of $coordinates.)
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:#####################################################################################################
./math/PGnauScheduling.pl:##########################################################################################################
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Name : CritPath ( Finds the critical path in a schedule type graph. 'Ties' are broken by comparing
./math/PGnauScheduling.pl:# the task labels of the first task at which two paths disagree. The smaller label
./math/PGnauScheduling.pl:# is taken as the critical path. )
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Input : $coordinates = "row (0, ... , 10), column (0, ... , 10), weight, ... , ... "
./math/PGnauScheduling.pl:# The order determines the vertex index and label used.
./math/PGnauScheduling.pl:# If -1,-1,-1 appears for any vertex, that task is not considered
./math/PGnauScheduling.pl:# as part of the graph.
./math/PGnauScheduling.pl:# $connections = "vertex index (tail), vertex index (head), ... , ... "
./math/PGnauScheduling.pl:# The vertex indices are taken according to the ordering in
./math/PGnauScheduling.pl:# $coordinates.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Output : $crit_path = "task_label1, task_label2, ... , $task_labeln; total_weight
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:###########################################################################################################
./math/PGnauScheduling.pl:#######################################################################################################
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Name : PickSchedule
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Input : $random_flag = if zero, empty or out-of-range, a random choice is made. If positive
./math/PGnauScheduling.pl:# and in-range, this indexes the graph to use. If "easy", then an 'easy'
./math/PGnauScheduling.pl:# graph is chosen.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Output : $graph_info = $coordinates ; $connections where:
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# $coordinates = "row (0, ... , 10), column (0, ... , 10), weight, ... , ... "
./math/PGnauScheduling.pl:# The order determines the vertex index and label used.
./math/PGnauScheduling.pl:# $connections = "vertex index (tail), vertex index (head), ... , ... "
./math/PGnauScheduling.pl:# The vertex indices are taken according to the ordering in
./math/PGnauScheduling.pl:# $coordinates.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:########################################################################################################
./math/PGnauScheduling.pl:#######################################################################################################
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Name : DrawProcessorSchedule
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Input : $coordinates = "row (0, ... , 10), column (0, ... , 10), weight, ... , ... "
./math/PGnauScheduling.pl:# The order determines the vertex index and label used. The
./math/PGnauScheduling.pl:# weights are needed to draw the schedules.
./math/PGnauScheduling.pl:# $done_list = The scheduling solution, for the current processor.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:# Output : $schedule_graph = graphics object.
./math/PGnauScheduling.pl:#
./math/PGnauScheduling.pl:########################################################################################################
./math/PGnauScheduling.pl:###
./math/PGnauScheduling.pl:# Name : FindMinimum
./math/PGnauScheduling.pl:###
./math/MatrixUnimodular.pl:# Note: this is in algebraMacros.pl. Maybe put in a common place?
./math/draggableSubsets.pl:# Deprecated alias for ans_rule.
./math/LinearProgramming.pl:# perform a pivot operation
./math/LinearProgramming.pl:# lp_pivot([[1,2,3],...,[4,5,6]], row, col, fractionmode)
./math/LinearProgramming.pl:# row and col indecies start at 0
./math/LinearProgramming.pl:# ^function lp_pivot
./math/LinearProgramming.pl:# Find pivot column for standard part
./math/LinearProgramming.pl:# ^function lp_pivot_element
./math/LinearProgramming.pl:# Solve a linear programming problem
./math/LinearProgramming.pl:# lp_solve([[1,2,3],[4,5,6]])
./math/LinearProgramming.pl:# It returns a triple of the final tableau, a code to say if we
./math/LinearProgramming.pl:# succeeded, and the number of pivots
./math/LinearProgramming.pl:# ^function lp_solve
./math/LinearProgramming.pl:# ^uses set_default_options
./math/LinearProgramming.pl:# ^uses lp_pivot_element
./math/LinearProgramming.pl:# ^uses lp_pivot
./math/LinearProgramming.pl:# Get the current value of a variable from a tableau
./math/LinearProgramming.pl:# The variable is specified by column number, with 0 for P, 1 for x_1,
./math/LinearProgramming.pl:# and so on
./math/LinearProgramming.pl:# ^function lp_current_value
./math/LinearProgramming.pl:# ^uses Fraction::new
./math/LinearProgramming.pl:# Display a tableau in math mode
./math/LinearProgramming.pl:# ^function lp_display_mm
./math/LinearProgramming.pl:# ^uses lp_display
./math/LinearProgramming.pl:# Make a copy of a tableau
./math/LinearProgramming.pl:# ^function lp_clone
./math/LinearProgramming.pl:# Display a tableau
./math/LinearProgramming.pl:# ^function lp_display
./math/LinearProgramming.pl:# ^uses lp_clone
./math/LinearProgramming.pl:# ^uses display_matrix
./math/PGnauGraphCatalog.pl:# All simple graphs with fewer than 8 vertices
./math/PGdiffeqmacros.pl:#!/usr/bin/perl -w
./math/PGdiffeqmacros.pl:#my @answer = oldivy(1,2,1,8,4);
./math/PGdiffeqmacros.pl:#print ("The old program says:\n");
./math/PGdiffeqmacros.pl:#print ($answer[0]);
./math/PGdiffeqmacros.pl:#print ("\n");
./math/PGdiffeqmacros.pl:#@answer = ivy(1,2,1,8,4);
./math/PGdiffeqmacros.pl:#print ("My program says:\n");
./math/PGdiffeqmacros.pl:#print ($answer[0]);
./math/PGdiffeqmacros.pl:#print ("\n");
./math/PGdiffeqmacros.pl:#the subroutine is invoked with arguments such as complexmult(2,3,4,5) or
./math/PGdiffeqmacros.pl:#complexmult(@data), where @data = (2,3,4,5)
./math/PGdiffeqmacros.pl:##########
./math/PGdiffeqmacros.pl:# sub addtwo adds two strings formally
./math/PGdiffeqmacros.pl:# An "indicator" for a string is a
./math/PGdiffeqmacros.pl:# number ,e.g. coefficient,which indicates
./math/PGdiffeqmacros.pl:# whether the string is to be
./math/PGdiffeqmacros.pl:# added or is to be regarded as zero.
./math/PGdiffeqmacros.pl:# The non-zero terms are formally added as strings.
./math/PGdiffeqmacros.pl:# The input is an array
./math/PGdiffeqmacros.pl:# ($1staddend, $1stindicator,$2ndaddend,$2ndindicator)
./math/PGdiffeqmacros.pl:# The return is an array
./math/PGdiffeqmacros.pl:# (formal sum, indicator of formal sum)
./math/PGdiffeqmacros.pl:########
./math/PGdiffeqmacros.pl:# sub add generalizes sub addtwo to more addends.
./math/PGdiffeqmacros.pl:# It formally adds the nonzero terms.
./math/PGdiffeqmacros.pl:# The input is an array of even length
./math/PGdiffeqmacros.pl:# consisting of each addend,a string,
./math/PGdiffeqmacros.pl:# followed by its indicator.
./math/PGdiffeqmacros.pl:#######
./math/PGdiffeqmacros.pl:# sub diffop cleans up the typed expression
./math/PGdiffeqmacros.pl:# of a diff. operator.
./math/PGdiffeqmacros.pl:# input @diffop =($A,$B,$C) is the coefficients.
./math/PGdiffeqmacros.pl:# input is given as arguments viz difftop($A,$B,$C);
./math/PGdiffeqmacros.pl:# output is the diff. operator as a string $L in TEX
./math/PGdiffeqmacros.pl:########
./math/PGdiffeqmacros.pl:# sub rad simplifies (a/b)*(sqrt(c))
./math/PGdiffeqmacros.pl:# input is given as arguments on rad viz.: rad($a,$b,$c);
./math/PGdiffeqmacros.pl:# $a,$b,$c are integers and $c>=0 and $b is not zero.
./math/PGdiffeqmacros.pl:# output is an array =(answer as string,new$a,new$b, new$c)
./math/PGdiffeqmacros.pl:##########
./math/PGdiffeqmacros.pl:##########
./math/PGdiffeqmacros.pl:####
./math/PGdiffeqmacros.pl:# sub exp simplifies exp($r*t) in form for writing perl
./math/PGdiffeqmacros.pl:# or tex. The input is exp($r,$ind); $ind indicates whether
./math/PGdiffeqmacros.pl:# we want perl or tex mode. $r is a string that represents
./math/PGdiffeqmacros.pl:# a number.
./math/PGdiffeqmacros.pl:# If $ind = 0 output is "exp(($r)*t)", simplified if possible.
./math/PGdiffeqmacros.pl:# If $ind = 1 output is "exp(($r)*t)", simplified if possible.
./math/PGdiffeqmacros.pl:# y(t) = me^(-Bt/(2A))*cos(t*sqrt(4AC-B*B)/(2A))+(2An+Bm)*sqrt(4AC-B*B)/(4AC-B*B)*e^(-Bt/(2A))*sin(t*sqrt(4AC-B*B)/(2A))
./math/PGdiffeqmacros.pl:############
./math/PGdiffeqmacros.pl:#sub ivy solves the initial value problem
./math/PGdiffeqmacros.pl:# $a*y'' + $b*y' + $c*y = 0, with y(0) = $m, y'(0) = $n
./math/PGdiffeqmacros.pl:#The numbers $a,$b,$c,$m,$n should be integers with $a not 0.
./math/PGdiffeqmacros.pl:#The inputs are given as arguments viz: ivy ($a,$b,$c,$m,$n).
./math/PGdiffeqmacros.pl:#The output is the solution as a string giving a function of t.
./math/PGdiffeqmacros.pl:#################
./math/PGdiffeqmacros.pl:# undeterminedSin is a subroutine to solve
./math/PGdiffeqmacros.pl:# undetermined coefficient problems that have
./math/PGdiffeqmacros.pl:# sines and cosines.
./math/PGdiffeqmacros.pl:# The input is an array ($A,$B,$C,$r,$w,$q1,$q0,$r1,$r0)
./math/PGdiffeqmacros.pl:# given as arguments on undeterminedSin
./math/PGdiffeqmacros.pl:# $L =$A y'' + $B y' + $C y
./math/PGdiffeqmacros.pl:# $rhs = ($q1 t + $q0) cos($w t)exp($r t) +
./math/PGdiffeqmacros.pl:# ($r1 t + $r0) sin($w t)exp($r t)
./math/PGdiffeqmacros.pl:# The subroutine uses undetermined coefficients
./math/PGdiffeqmacros.pl:# to find a solution $y of $L = $rhs .
./math/PGdiffeqmacros.pl:# The output \is $y
./math/PGnauGraphtheory.pl:##################################################### Nandor
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRmatrix_graph
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRgraph_matrix
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRshuffledgraph_graph
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRgraph_size_random
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRgraph_size_random_weight_dweight
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRlabel_vertex_labels
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRlabels_vertices_labels
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRvertex_label_labels
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRvertices_labels_size
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRedges_graph
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRedgesstr_graph_labels
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRdegree_graph_vertex
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRdegrees_graph
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRncomponents_graph
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRpic_graph_labels
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRlabelpic_graph(_labels)
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRnearestnbr_graph_vertex
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRkruskal_graph
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRtex_braces
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRvertexlist_edgesstr_labels
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRgraph_size_labels_edgesstr
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:####################################################################### Edgar Fisher
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: VertDegree
./math/PGnauGraphtheory.pl:#Input: Vertex number followed by adjacency matrix for a graph
./math/PGnauGraphtheory.pl:#Output: Degree of the indicated vertex
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRgraph_degrees
./math/PGnauGraphtheory.pl:#Input: List of degree values
./math/PGnauGraphtheory.pl:#Output: A graph with the indicated degree values if possible or 'DNE' if not.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: ChangeWeight
./math/PGnauGraphtheory.pl:#Input: Vertex numbers to change, weight to change the edge to and graph
./math/PGnauGraphtheory.pl:#Output: A graph with the edge between the indicated vertices changed to weight
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRhaseulercircuit_graph
./math/PGnauGraphtheory.pl:#Input: Graph
./math/PGnauGraphtheory.pl:#Output: A list containing a value and message. The value is 0 if it is not
./math/PGnauGraphtheory.pl:#an Euler circuit and 1 otherwise. The message relays why it is not.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRhaseulertrail_graph
./math/PGnauGraphtheory.pl:#Input: Graph
./math/PGnauGraphtheory.pl:#Output: A list containing a value and message. The value is 0 if it is not
./math/PGnauGraphtheory.pl:#an Euler path and 1 otherwise. The message relays why it is not.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GReulercircuit_size
./math/PGnauGraphtheory.pl:#Input: Size of graph
./math/PGnauGraphtheory.pl:#Output: A graph that is an Euler Circuit
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GReulertrail_size
./math/PGnauGraphtheory.pl:#Input: Size of graph
./math/PGnauGraphtheory.pl:#Output: A graph that is an Euler Path but not an Euler Circuit
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRnoneuler_size
./math/PGnauGraphtheory.pl:#Input: Size of graph
./math/PGnauGraphtheory.pl:#Output: A graph that is not an Euler path
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: Matr_graph_Mult
./math/PGnauGraphtheory.pl:#Input:
./math/PGnauGraphtheory.pl:#Output:
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRhascircuit_graph
./math/PGnauGraphtheory.pl:#Input: A graph
./math/PGnauGraphtheory.pl:#Output: 1 if the graph has a circuit, 0 otherwise
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRistree_graph
./math/PGnauGraphtheory.pl:#Input: A graph
./math/PGnauGraphtheory.pl:#Output: A list containing a 1 if it is a tree, 0 if not a tree and a
./math/PGnauGraphtheory.pl:# message about why it was not a tree.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRisforest_graph
./math/PGnauGraphtheory.pl:#Input: A graph
./math/PGnauGraphtheory.pl:#Output: A list containing a 1 if it is a forest, 0 if not a forest and a
./math/PGnauGraphtheory.pl:# message about why it was not a forest.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GoodEdge
./math/PGnauGraphtheory.pl:#Input: A graph
./math/PGnauGraphtheory.pl:#Output: A 1 if the edge should be placed in a sorted edges based graph
./math/PGnauGraphtheory.pl:# 0 if not.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRsortededges_graph
./math/PGnauGraphtheory.pl:#Input: A graph
./math/PGnauGraphtheory.pl:#Output: A list of the values of the edges included in the graph
./math/PGnauGraphtheory.pl:# in the order of their inclusion.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRiseulertrail_graph_vertices
./math/PGnauGraphtheory.pl:#Input: A graph and list of selected vertices
./math/PGnauGraphtheory.pl:#Output: A list containing a 1 if the indicated list of
./math/PGnauGraphtheory.pl:# vertices is an euler path in the graph or 0 if
./math/PGnauGraphtheory.pl:# it is not and a message indicating the reason.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRiseulercircuit_graph_vertices
./math/PGnauGraphtheory.pl:#Input: A graph and list of selected vertices
./math/PGnauGraphtheory.pl:#Output: A list containing a 1 if the indicated list of
./math/PGnauGraphtheory.pl:# vertices is an euler circuit in the graph or 0 if
./math/PGnauGraphtheory.pl:# it is not and a message indicating the reason.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRforest_size
./math/PGnauGraphtheory.pl:#Input: Size of the desired graph to be a forest
./math/PGnauGraphtheory.pl:#Output: A graph that is a forest
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRtree_size
./math/PGnauGraphtheory.pl:#Input: size of desired tree
./math/PGnauGraphtheory.pl:#Output: A graph that is a tree
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRisbipartite_graph
./math/PGnauGraphtheory.pl:#Input: Graph object
./math/PGnauGraphtheory.pl:#Output: A 1 is the graph is bipartite, 0 otherwise
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRbipartite_size
./math/PGnauGraphtheory.pl:#Input: Size of the desired graph
./math/PGnauGraphtheory.pl:#Output: A graph that has is bipartite
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRdijkstra_graph_vertex_vertex
./math/PGnauGraphtheory.pl:#Input: A graph, starting vertex and ending vertex for Dijkstra's algorithm
./math/PGnauGraphtheory.pl:#Output: Two lists, the first, a list of distances from the start vertex
./math/PGnauGraphtheory.pl:# to every other vertex. The second a list of the vertices preceding
./math/PGnauGraphtheory.pl:# the current vertex to achieve the shortest path.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRgraphpic_dim_random_labels_weight_dweight
./math/PGnauGraphtheory.pl:#Input: Dimensions of the table in (row, column) format, a value to determine
./math/PGnauGraphtheory.pl:# the probability of an edge existing between vertices, labels for the vertices,
./math/PGnauGraphtheory.pl:# starting weight and weight difference for edge weights.
./math/PGnauGraphtheory.pl:#Output: A graph with weights and a picture of the graph in tabular format.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRhamiltonian_size
./math/PGnauGraphtheory.pl:#Input: Size of the desired graph (5 or greater)
./math/PGnauGraphtheory.pl:#Output: A graph that has is hamiltonian
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRnonhamiltonian_size_type
./math/PGnauGraphtheory.pl:#Input: Size of the desired graph and a type of non hamiltonian graph:
./math/PGnauGraphtheory.pl:# odd: Has two cycles joined by a single edge
./math/PGnauGraphtheory.pl:# even: Has a vertex of degree one
./math/PGnauGraphtheory.pl:# If the odd type, size must be at least 6
./math/PGnauGraphtheory.pl:#Output: A graph that has is not hamiltonian of the specified type
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRcycle_size
./math/PGnauGraphtheory.pl:#Input: Size for cycle
./math/PGnauGraphtheory.pl:#Output: A picture of a graph that is a cycle (with no labels).
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRcomplete_size
./math/PGnauGraphtheory.pl:#Input: Size for complete graph
./math/PGnauGraphtheory.pl:#Output: A picture of a complete graph (with no labels).
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRwheel_size
./math/PGnauGraphtheory.pl:#Input: Size for wheel
./math/PGnauGraphtheory.pl:#Output: A picture of a graph that is a wheel (with no labels).
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRcompletebipartite_size_size
./math/PGnauGraphtheory.pl:#Input: Size for upper and size for lower bipartite graph
./math/PGnauGraphtheory.pl:#Output: A picture of a bipartite graph with size and
./math/PGnauGraphtheory.pl:# size labels on top and bottem (and no labels).
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRcube
./math/PGnauGraphtheory.pl:#Input: None
./math/PGnauGraphtheory.pl:#Output: A picture of a graph that is a flattened cube.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRpetersen
./math/PGnauGraphtheory.pl:#Input: None
./math/PGnauGraphtheory.pl:#Output: A picture of the Petersen graph.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRdodecahedron
./math/PGnauGraphtheory.pl:#Input: None
./math/PGnauGraphtheory.pl:#Output: A picture of a graph that is a flattened dodecahedron.
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:######################################
./math/PGnauGraphtheory.pl:#Name: GRvertices_labels_labels
./math/PGnauGraphtheory.pl:#Input: string of labels, string of all graph labels
./math/PGnauGraphtheory.pl:#Output: Returns a list of vertex numbers corresponding to the
./math/PGnauGraphtheory.pl:# labels in the first string.
./math/PGnauGraphtheory.pl:######################################
./math/MatrixUnits.pl:###################################################
./math/MatrixUnits.pl:#######################################################
./math/MatrixUnits.pl:########################################################
./math/MatrixUnits.pl:#######################################################
./math/PGmorematrixmacros.pl:# set the prefix used for arrays.
./math/PGmorematrixmacros.pl:# These should be compared to similar subroutines made later in
./math/PGmorematrixmacros.pl:# MatrixCheckers.pl
./math/PGmorematrixmacros.pl:## This is where the correct answer should be checked someday.
./math/PGmorematrixmacros.pl:# $rh_ans->{ans_label} =~ /$ArRaY(\d+)\[\d+,\d+,\d+\]/; # CHANGE made to accomodate HTML 4.01 standards for name attribute
./math/PGmorematrixmacros.pl:# The following subroutines, meant to be used with MatrixReal1 type matrices, are
./math/PGmorematrixmacros.pl:# deprecated. In general you should use the MathObject Matrix type and the
./math/PGmorematrixmacros.pl:# checking methods in MatrixCheckers.pl
./math/PGmorematrixmacros.pl:# are_orthogonal_vecs($vec_ref, %opts)
./math/PGmorematrixmacros.pl:# is_diagonal($matrix, %opts)
./math/PGmorematrixmacros.pl:# are_unit_vecs($vec_ref, %opts)
./math/PGmorematrixmacros.pl:# display_correct_vecs($vec_ref, %opts)
./math/PGmorematrixmacros.pl:# vec_solution_cmp($vec,%opts)
./math/PGmorematrixmacros.pl:# filter: compare_vec_solution($rh_ans,%opts);
./math/PGmorematrixmacros.pl:## This is where the correct answer should be checked someday.
./math/PGmorematrixmacros.pl:# changes by MEG 6/24/05
./math/PGmorematrixmacros.pl:# the student answer needs to be a linear combination of the instructors vectors
./math/PGmorematrixmacros.pl:# and the coefficient of the first vector needs to be 1 (it is NOT enough that it be non-zero).
./math/PGmorematrixmacros.pl:# if this is not the case, then the answer is wrong.
./math/PGmorematrixmacros.pl:# replaced $x_vector->[0][0][0] by $x_vector->element(1,1) since this doesn't depend on the internal structure of the matrix object.
./math/VectorListCheckers.pl:########################################################
./math/VectorListCheckers.pl:########################################################
./math/VectorListCheckers.pl:########################################################
./PGcourse.pl:#loadMacros("source.pl");
./contexts/contextRationalFunction.pl:##################################################
./contexts/contextRationalFunction.pl:##############################################
./contexts/contextRationalFunction.pl:##############################################
./contexts/contextRationalFunction.pl:##############################################
./contexts/contextRationalFunction.pl:##############################################
./contexts/contextRationalFunction.pl:##############################################
./contexts/contextForm.pl:###########################
./contexts/contextForm.pl:#
./contexts/contextForm.pl:# Subclass the numeric functions
./contexts/contextForm.pl:#
./contexts/contextForm.pl:#
./contexts/contextForm.pl:# Override sqrt() to return a special value times x when evaluated
./contexts/contextForm.pl:#
./contexts/contextForm.pl:#
./contexts/contextForm.pl:# Override root(n,) to return a special value times x when evaluated
./contexts/contextForm.pl:#
./contexts/contextLimitedVector.pl:##################################################
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:# Handle common checking for BOPs
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:# Do original check and then if the operands are numbers, its OK.
./contexts/contextLimitedVector.pl:# Otherwise, check if there is a duplicate constant from either term
./contexts/contextLimitedVector.pl:# Otherwise, do an operator-specific check for if vectors are OK.
./contexts/contextLimitedVector.pl:# Otherwise report an error.
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:# filled in by subclasses
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:# Check if a constant has been repeated
./contexts/contextLimitedVector.pl:# (we maintain a hash that lists if one is below us in the parse tree)
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:# Now we get the individual replacements for the operators
./contexts/contextLimitedVector.pl:# that we don't want to allow. We inherit everything from
./contexts/contextLimitedVector.pl:# the original Parser::BOP class, and just add the
./contexts/contextLimitedVector.pl:# vector checks here.
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:# Now we do the same for the unary operators
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:# Absolute value does vector norm, so we
./contexts/contextLimitedVector.pl:# trap that as well.
./contexts/contextLimitedVector.pl:#
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextLimitedVector.pl:##############################################
./contexts/contextInteger.pl:###########################################################################
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# Initialize the contexts and make the creator function.
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# divisor function
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# Prime Factorization
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# Euler's totient function phi(n)
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# number of divisors function tau(n)
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# Greatest Common Divisor
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# Extended Greatest Common Divisor
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# return (g, x, y) a*x + b*y = gcd(x, y)
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# Modular inverse
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# x = mulinv(b) mod n, (x * b) % n == 1
./contexts/contextInteger.pl:#
./contexts/contextInteger.pl:# Least Common Multiple
./contexts/contextInteger.pl:#
./contexts/contextTrigDegrees.pl:#######################################
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:# Check the number of arguments, and call the proper method with the
./contexts/contextTrigDegrees.pl:# the proper factor involved.
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:# Call the proper method with the correct factor
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:# Do chain rule derivative, taking the $deg factor into account
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:#######################################
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:# Hook the common functions into these classes
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:#######################################
./contexts/contextTrigDegrees.pl:#######################################
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:# Change the classes for the trig functions to be our classes above,
./contexts/contextTrigDegrees.pl:# and mark the inverses so that the degrees can be applied in the
./contexts/contextTrigDegrees.pl:# proper location.
./contexts/contextTrigDegrees.pl:#
./contexts/contextTrigDegrees.pl:# Define the sin, cos, and atan2 functions so that they will call our
./contexts/contextTrigDegrees.pl:# methods even if their arguments are Perl reals.
./contexts/contextTrigDegrees.pl:#
./contexts/contextComplexJ.pl:##########################################################################
./contexts/contextComplexJ.pl:###############################################################
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:# Enables complex j notation in the given context
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:# Sets all the complex-based default contexts to use ComplexJ
./contexts/contextComplexJ.pl:# notation. The two arguments determine the values for the
./contexts/contextComplexJ.pl:# enterComplex and displayComplex flags. If enterComplex is "j",
./contexts/contextComplexJ.pl:# then student answers must use the j notation (though
./contexts/contextComplexJ.pl:# professors can use either).
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:###############################################################
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:# Handle Complex numbers so that they are displayed
./contexts/contextComplexJ.pl:# with the proper i or j value.
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:###############################################################
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:# Make Parser Value object maintain the indicator for
./contexts/contextComplexJ.pl:# which notation was used for a complex number.
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:###############################################################
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:# Make sure complex numbers maintain their flag for
./contexts/contextComplexJ.pl:# which format was used to create them.
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:###############################################################
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:# Produce error messages when the wrong notation
./contexts/contextComplexJ.pl:# is used for complex numbers.
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:# Swap i and j when required by the displayComplex flag
./contexts/contextComplexJ.pl:# in the output of constants.
./contexts/contextComplexJ.pl:#
./contexts/contextComplexJ.pl:###############################################################
./contexts/contextLimitedPoint.pl:##################################################
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:# Handle common checking for BOPs
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:# Do original check and then if the operands are numbers, its OK.
./contexts/contextLimitedPoint.pl:# Otherwise report an error.
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:# Now we get the individual replacements for the operators
./contexts/contextLimitedPoint.pl:# that we don't want to allow. We inherit everything from
./contexts/contextLimitedPoint.pl:# the original Parser::BOP class, except the _check
./contexts/contextLimitedPoint.pl:# routine, which comes from LimitedPoint::BOP above.
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:# Now we do the same for the unary operators
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:# Absolute value does vector norm, so we
./contexts/contextLimitedPoint.pl:# trap that as well.
./contexts/contextLimitedPoint.pl:#
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextLimitedPoint.pl:##############################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Extend a given context (by name or actual Context object) to include fractions
./contexts/contextFraction.pl:# The options are the default values for the Fraction context flags
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Initialize the contexts and make the creator function.
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Backward compatibility
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Greatest Common Divisor
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Least Common Multiple
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Reduced fraction
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Takes a positive real input and outputs an array (a,b) where a/b
./contexts/contextFraction.pl:# is a very good fraction approximation with b no larger than
./contexts/contextFraction.pl:# maxdenominator.
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Convert a real to a reduced fraction approximation.
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Uses $context->continuedFracation() to convert .333333... into 1/3
./contexts/contextFraction.pl:# rather than 333333/1000000, etc.
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# A common class for getting the super-class of an extension class
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# A common class for handling the fraction class data in an object's typeRef
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# When strictFraction is in effect, only allow division
./contexts/contextFraction.pl:# with integers and negative integers
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Create a Fraction from the given data
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Reduce the fraction
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Display minus signs outside the fraction
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Derivative of fraction is 0 since it is constant
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# If the implied multiplication represents a proper fraction with a
./contexts/contextFraction.pl:# preceding integer, then switch to the proper fraction operator
./contexts/contextFraction.pl:# (for proper handling of string() and TeX() calls), otherwise,
./contexts/contextFraction.pl:# convert the object to a standard multiplication.
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# For when the space operator's string property sends to an
./contexts/contextFraction.pl:# operator we didn't otherwise subclass.
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Implements the space between mixed numbers
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# For proper fractions, add the integer to the fraction
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Reduce the fraction
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Derivative of a mixed number is 0 since it is constant
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# For strict fractions, only allow minus on certain operands
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Handle reductions of negative fractions
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Add parentheses if they were there originally, or are needed by precedence
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Add parentheses if they were there originally, or
./contexts/contextFraction.pl:# are needed by precedence and we asked for exxxtra parens
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Just return the fraction
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Distinguish integers from decimals
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Allow Real to convert Fractions to Reals
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Since the signed number pattern now include fractions, we need to make sure
./contexts/contextFraction.pl:# we handle them when a real is made and it looks like a fraction
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Since this is called directly, pass it up to the parent
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:##################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Implements the MathObject for fractions
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Produce a real if one of the terms is not an integer
./contexts/contextFraction.pl:# otherwise produce a fraction.
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Promote to a fraction, allowing reals to be $x/1 even when
./contexts/contextFraction.pl:# not an integer (later $self->make() will produce a Real in
./contexts/contextFraction.pl:# that case)
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Create a new formula from the number
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Return the real number type
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Return the real value
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Parts are not Value objects, so don't transfer
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Check if a value is an integer
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Get a flag that has been renamed
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:##################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Binary operations
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:##################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Numeric functions
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:##################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Trig functions
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:##################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Differentiation
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:##################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Utility
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:##################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Formatting
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:###########################################################################
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:# Answer Checker
./contexts/contextFraction.pl:#
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextFraction.pl:#################################################################################################
./contexts/contextRationalExponent.pl:#
./contexts/contextRationalExponent.pl:# Set up the RationalExponent context
./contexts/contextRationalExponent.pl:#
./contexts/contextRationalExponent.pl:###########################
./contexts/contextRationalExponent.pl:#
./contexts/contextRationalExponent.pl:# Create root(n, x)
./contexts/contextRationalExponent.pl:#
./contexts/contextRationalExponent.pl:###########################
./contexts/contextRationalExponent.pl:#
./contexts/contextRationalExponent.pl:# Subclass the numeric functions
./contexts/contextRationalExponent.pl:#
./contexts/contextRationalExponent.pl:#
./contexts/contextRationalExponent.pl:# Override sqrt() to return a special value times x when evaluated
./contexts/contextRationalExponent.pl:#
./contexts/contextFiniteSolutionSets.pl:###########################
./contexts/contextFiniteSolutionSets.pl:#
./contexts/contextFiniteSolutionSets.pl:# Subclass the numeric functions
./contexts/contextFiniteSolutionSets.pl:#
./contexts/contextFiniteSolutionSets.pl:#
./contexts/contextFiniteSolutionSets.pl:# Override sqrt() to return a special value times x when evaluated
./contexts/contextFiniteSolutionSets.pl:#
./contexts/contextFiniteSolutionSets.pl:#
./contexts/contextFiniteSolutionSets.pl:# Override root(n,) to return a special value times x when evaluated
./contexts/contextFiniteSolutionSets.pl:#
./contexts/legacyFraction.pl:###########################################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Initialize the contexts and make the creator function.
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# contFrac($x, $maxdenominator)
./contexts/legacyFraction.pl:# Subroutine that takes a positive real input $x and outputs an array
./contexts/legacyFraction.pl:# (a,b) where a/b is a very good fraction approximation with b no
./contexts/legacyFraction.pl:# larger than maxdenominator.
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Convert a real to a reduced fraction approximation
./contexts/legacyFraction.pl:# Uses contFrac() to convert .333333... into 1/3 rather
./contexts/legacyFraction.pl:# than 333333/1000000, etc.
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Greatest Common Divisor
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Least Common Multiple
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Reduced fraction
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:###########################################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Create a Fraction or Real from the given data
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# When strictFraction is in effect, only allow division
./contexts/legacyFraction.pl:# with integers and negative integers
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Reduce the fraction, if it is one, otherwise do the usual reduce
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Display minus signs outside the fraction
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Indicate if the value is a fraction or not
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:###########################################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# For proper fractions, add the integer to the fraction
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# If the implied multiplication represents a proper fraction with a
./contexts/legacyFraction.pl:# preceeding integer, then switch to the proper fraction operator
./contexts/legacyFraction.pl:# (for proper handling of string() and TeX() calls), otherwise,
./contexts/legacyFraction.pl:# convert the object to a standard multiplication.
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Indicate if the value is a fraction or not
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Reduce the fraction
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:###########################################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# For strict fractions, only allow minus on certain operands
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# class is MINUS if it is a negative number
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# make isNeg properly handle the modified class
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:###########################################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Indicate if the Value object is a fraction or not
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Handle reductions of negative fractions
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Add parentheses if they were there originally, or are needed by precedence
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Add parentheses if they were there originally, or
./contexts/legacyFraction.pl:# are needed by precedence and we asked for exxxtra parens
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:###########################################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Allow Real to convert Fractions to Reals
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Since the signed number pattern now include fractions, we need to make sure
./contexts/legacyFraction.pl:# we handle them when a real is made and it looks like a fraction
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:###########################################################################
./contexts/legacyFraction.pl:###########################################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Implements the MathObject for fractions
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Produce a real if one of the terms is not an integer
./contexts/legacyFraction.pl:# otherwise produce a fraction.
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Promote to a fraction, allowing reals to be $x/1 even when
./contexts/legacyFraction.pl:# not an integer (later $self->make() will produce a Real in
./contexts/legacyFraction.pl:# that case)
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Create a new formula from the number
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Return the real number type
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Return the real value
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Parts are not Value objects, so don't transfer
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Check if a value is an integer
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Get a flag that has been renamed
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:##################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Binary operations
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:##################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Numeric functions
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:##################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Trig functions
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:##################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Differentiation
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:##################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Utility
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:##################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Formatting
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:###########################################################################
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:# Answer Checker
./contexts/legacyFraction.pl:#
./contexts/legacyFraction.pl:###########################################################################
./contexts/contextLimitedPowers.pl:#
./contexts/contextLimitedPowers.pl:# Test for whether the power is an integer in the specified range
./contexts/contextLimitedPowers.pl:#
./contexts/contextLimitedPowers.pl:#
./contexts/contextLimitedPowers.pl:# Legacy code to accommodate older approach to setting the operators
./contexts/contextLimitedPowers.pl:#
./contexts/contextLimitedPowers.pl:##################################################
./contexts/contextLimitedPowers.pl:##################################################
./contexts/contextLimitedPowers.pl:##################################################
./contexts/contextPartition.pl:###########################################################
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Create the contexts and add the constructor functions
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:###########################################################
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# The Partition object
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Check the data and create the object
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Add a number to a partition, or add two partitions
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Produce the sum for a partition
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Compare two partitions (numbers are promoted)
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Produce a canonical representation (numbers sorted)
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Promote a number to a Real (since we can add a number to a
./contexts/contextPartition.pl:# partition), and promote others to partitions, if possible.
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Check if types are compatible
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Produce a string version
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Produce a TeX version
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:###########################################################
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Implement special + operator that produces
./contexts/contextPartition.pl:# partitions rather than sums
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Check that the operands are appropriate, and return
./contexts/contextPartition.pl:# the proper type reference, or give an error.
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Check that the type of an operand is OK
./contexts/contextPartition.pl:# (It must be a partiation or a number)
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:# Evaluate two numbers by forming a partition,
./contexts/contextPartition.pl:# otherwise use addition (Value object will take over)
./contexts/contextPartition.pl:#
./contexts/contextPartition.pl:###########################################################
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Create the needed context and the constructor function
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:##################################################
./contexts/contextPiecewiseFunction.pl:##################################################
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# A class to implement undefined values (points that
./contexts/contextPiecewiseFunction.pl:# are not in the domain of the function)
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:##################################################
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Implement the "if" operator to specify a branch
./contexts/contextPiecewiseFunction.pl:# of the piecewise function.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Only allow inequalities on the right.
./contexts/contextPiecewiseFunction.pl:# Mark the object with identifying values
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Return the function's value if the variable is within
./contexts/contextPiecewiseFunction.pl:# the inequality for this branch (otherwise return
./contexts/contextPiecewiseFunction.pl:# and undefined value).
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Make a piecewise function from this branch
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Make an interval=>formula pair from this item
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Print using the TeX method of the PiecewiseFunction object
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Make an if-then-else statement that returns the function's
./contexts/contextPiecewiseFunction.pl:# value or an undefined value (depending on whether the
./contexts/contextPiecewiseFunction.pl:# variable is in the interval or not).
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:##################################################
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Implement the "else" operator to join the
./contexts/contextPiecewiseFunction.pl:# different branches of the function.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Make sure there is an "if" that goes with this else.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Use the result of the "if" to decide which value to return.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Make a PiecewiseFunction from the (nested) if-then-else values.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Recursively flatten the if-then-else tree to a list
./contexts/contextPiecewiseFunction.pl:# of interval=>formula pairs.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Don't do extra parens for nested else's.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Use the PiecewiseFunction TeX method.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Use an if-then-else to determine the value to use.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:##################################################
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Implement an "in" operator for "x in (a,b)" as an
./contexts/contextPiecewiseFunction.pl:# alternative to inequality notation.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Make sure the variable is to the left and an interval,
./contexts/contextPiecewiseFunction.pl:# set, or union is to the right.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Call this an Inequality so it will be allowed to the
./contexts/contextPiecewiseFunction.pl:# right of "if" operators.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:##################################################
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# This implements the "in" operator as in inequality.
./contexts/contextPiecewiseFunction.pl:# We inherit all the inequality methods, and simply
./contexts/contextPiecewiseFunction.pl:# need to handle the string and TeX output. The
./contexts/contextPiecewiseFunction.pl:# underlying type is still an Inerval.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:##################################################
./contexts/contextPiecewiseFunction.pl:##################################################
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# This implements the PiecewiseFunction. It is an unusual mix
./contexts/contextPiecewiseFunction.pl:# of a Value object and a Formula object. It looks like a
./contexts/contextPiecewiseFunction.pl:# Formula for the most part, but doesn't have the same internal
./contexts/contextPiecewiseFunction.pl:# structure. Most of the Formula methods have been provided
./contexts/contextPiecewiseFunction.pl:# so that eval, substitute, reduce, etc will be applied to all
./contexts/contextPiecewiseFunction.pl:# the branches.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Create the PiecewiseFunction object, with error reporting
./contexts/contextPiecewiseFunction.pl:# for problems in the data.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Usage: PiecewiseFunction("formula")
./contexts/contextPiecewiseFunction.pl:# PiecewiseFunction(I1 => f1, I2 => f2, ... , fn);
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# In the first case, the formula is parsed for "if" and "else" values
./contexts/contextPiecewiseFunction.pl:# to produce the function. In the second, the function is given
./contexts/contextPiecewiseFunction.pl:# by interval/formula pairs that associate what function to map over
./contexts/contextPiecewiseFunction.pl:# interval. If there is an unpaired formula at the end, it is
./contexts/contextPiecewiseFunction.pl:# the "otherwise" formula that will be used whenever the input
./contexts/contextPiecewiseFunction.pl:# does not fall into one of the given intervals.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Note that the intervals above actually can be Interval, Set,
./contexts/contextPiecewiseFunction.pl:# or Union objects, not just plain intervals.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Create a PiecewiseFunction without error checking (so overlapping intervals,
./contexts/contextPiecewiseFunction.pl:# incorrect variables, and so on could appear).
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Do the consistency checks for the separate branches.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Check that all the inequalities are for the same variable.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Check that no domain intervals overlap.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Check that all the branches return the same type of result.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# This is always considered a formula.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Look through the branches for the one that contains
./contexts/contextPiecewiseFunction.pl:# the variable's value, and evaluate it. If not in
./contexts/contextPiecewiseFunction.pl:# any of the intervals, use the "otherwise" value,
./contexts/contextPiecewiseFunction.pl:# or die with no value if there isn't one.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Reduce each branch individually.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Substitute into each branch individually.
./contexts/contextPiecewiseFunction.pl:# If the function's variable is substituted, then
./contexts/contextPiecewiseFunction.pl:# if it is a constant, find the branch for that value
./contexts/contextPiecewiseFunction.pl:# and substitute into that, otherwise if it is
./contexts/contextPiecewiseFunction.pl:# just another variable, replace the variable
./contexts/contextPiecewiseFunction.pl:# in the inequalities as well as the formulas.
./contexts/contextPiecewiseFunction.pl:# Otherwise, just replace in the formulas.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Return the domain of the function (will be (-inf,inf) if
./contexts/contextPiecewiseFunction.pl:# there is an "otherwise" formula.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# The set (-inf,inf).
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# The domain formed by the explicitly given intervals
./contexts/contextPiecewiseFunction.pl:# (excludes the "otherwise" portion, if any)
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Creates a copy of the PiecewiseFunction where the "otherwise"
./contexts/contextPiecewiseFunction.pl:# formula has been given explicit intervals within the object.
./contexts/contextPiecewiseFunction.pl:# (This makes it easier to compare two PiecewiseFormulas
./contexts/contextPiecewiseFunction.pl:# interval by interval.)
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Look up the function for the nth branch (or the "otherwise"
./contexts/contextPiecewiseFunction.pl:# function if n is omitted or too big or too small).
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Look up the domain for the nth branch (or the "otherwise"
./contexts/contextPiecewiseFunction.pl:# domain if n is omitted or too big or too small).
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Get the function for the given value of the variable
./contexts/contextPiecewiseFunction.pl:# (or undef if there is none).
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Implements the <=> operator (really only handles equality ir not)
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Check that the function domains have the same number of
./contexts/contextPiecewiseFunction.pl:# components, and that those components agree, interval by interval.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Now that the intervals are known to agree, compare
./contexts/contextPiecewiseFunction.pl:# the individual functions on each interval. Do an
./contexts/contextPiecewiseFunction.pl:# appropriate check depending on the type of each
./contexts/contextPiecewiseFunction.pl:# branch: Interval, Set, or Union.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Use the Interval to determine the limits for use
./contexts/contextPiecewiseFunction.pl:# in comparing the two functions.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# For a set, check that the functions agree on every point.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# For a union, do the appropriate check for
./contexts/contextPiecewiseFunction.pl:# each object in the union.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Stringify using newlines at after each "else".
./contexts/contextPiecewiseFunction.pl:# (Otherwise the student and correct answer can
./contexts/contextPiecewiseFunction.pl:# get unacceptably long.)
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# TeXify using a "cases" LaTeX environment.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Create a code segment that returns the correct value depending on which
./contexts/contextPiecewiseFunction.pl:# interval contains the variable's value (or an undefined value).
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Handle the types correctly for error messages and such.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Allow comparison only when the two functions return
./contexts/contextPiecewiseFunction.pl:# the same type of result.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:##################################################
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:# Overrides the Formula() command so that if
./contexts/contextPiecewiseFunction.pl:# the result is a PiecewiseFunction, it is
./contexts/contextPiecewiseFunction.pl:# turned into one automatically. Conversely,
./contexts/contextPiecewiseFunction.pl:# if a PiecewiseFunction is put into Formula(),
./contexts/contextPiecewiseFunction.pl:# this will turn it into a Formula.
./contexts/contextPiecewiseFunction.pl:#
./contexts/contextPiecewiseFunction.pl:######################################################################
./contexts/contextComplexExtras.pl:####################################################
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:# Base UOP class that checks for matrix arguments
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:# Check that the operand is a Matrix
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:####################################################
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:# Implements the ~ operation on matrices and complex numbers
./contexts/contextComplexExtras.pl:# (as a left-associative unary operator)
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:####################################################
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:# Implements the ^T operation on matrices and complex numbers
./contexts/contextComplexExtras.pl:# (as a right-associative unary operator)
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:####################################################
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:# Implements the ^* operation on matrices and complex numbers
./contexts/contextComplexExtras.pl:# (as a right-associative unary operator)
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:####################################################
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:# Implement functions with one matrix input and complex output
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:# Check for a single Matrix-valued input
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:# Evaluate by promoting to a Matrix
./contexts/contextComplexExtras.pl:# and then calling the routine from the Value package
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:#
./contexts/contextComplexExtras.pl:# Check for a single Matrix-valued argument. Then promote it to a Matrix (does error checking)
./contexts/contextComplexExtras.pl:# and call the routine from Value package (after converting "tr" to "trace")
./contexts/contextComplexExtras.pl:#
./contexts/contextPolynomialFactors.pl:##################################################
./contexts/contextPolynomialFactors.pl:##############################################
./contexts/contextPolynomialFactors.pl:##############################################
./contexts/contextPolynomialFactors.pl:##############################################
./contexts/contextPolynomialFactors.pl:##############################################
./contexts/contextPolynomialFactors.pl:##############################################
./contexts/contextPolynomialFactors.pl:##############################################
./contexts/contextPolynomialFactors.pl:##############################################
./contexts/contextPolynomialFactors.pl:##############################################
./contexts/contextPermutation.pl:###########################################################
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Create the contexts and add the constructor functions
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:###########################################################
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Methods common to cycles and permutations
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Use the usual make(), and then add the permutation data
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Permform multiplication of a number by a cycle or permutation,
./contexts/contextPermutation.pl:# or a product of two cycles or permutations.
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Perform powers by repeated multiplication;
./contexts/contextPermutation.pl:# Negative powers are inverses.
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Compare canonical representations
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# True if the permutation is in canonical form
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Promote a number to a Real (since we can take a number times a
./contexts/contextPermutation.pl:# permutation, or a permutation to a power), and anything else to a
./contexts/contextPermutation.pl:# Cycle or Permutation.
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Produce a canonical representation as a collection of
./contexts/contextPermutation.pl:# cycles that have their lowest entry first, sorted
./contexts/contextPermutation.pl:# by initial entry.
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Produce the inverse of a permutation or cycle.
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Produce a string version (use "(1)" as the identity).
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Produce a TeX version (uses \; for spaces)
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:###########################################################
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# A single cycle
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Find the internal representation of the cycle
./contexts/contextPermutation.pl:# (a hash representing where each element goes)
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:###########################################################
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# A combination of cycles
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Find the internal representation of the permutation
./contexts/contextPermutation.pl:# (a hash representing where each element goes)
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:###########################################################
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Space between numbers forms a cycle.
./contexts/contextPermutation.pl:# Space between cycles forms a permutation.
./contexts/contextPermutation.pl:# Space between a number and a cycle or
./contexts/contextPermutation.pl:# permutation evaluates the permutation
./contexts/contextPermutation.pl:# on the number.
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Check that the operands are appropriate, and return
./contexts/contextPermutation.pl:# the proper type reference, or give an error.
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Evaluate by forming a list if this is acting as a comma,
./contexts/contextPermutation.pl:# othewise take a product (Value object will take care of things).
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# If the operator is not a comma, return the item itself.
./contexts/contextPermutation.pl:# Otherwise, make a list out of the lists that are the left
./contexts/contextPermutation.pl:# and right operands.
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Produce the TeX form
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:###########################################################
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Powers of cycles form permutations
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Check that the operands are appropriate,
./contexts/contextPermutation.pl:# and return the proper type reference
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:###########################################################
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# The List subclass for cycles in the parse tree
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Check that the coordinates are numbers.
./contexts/contextPermutation.pl:# If there is one parameter and it is a cycle or permutation
./contexts/contextPermutation.pl:# treat this as plain parentheses, not cycle parentheses
./contexts/contextPermutation.pl:# (so you can take groups of cycles to a power).
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Produce a string version. (Shouldn't be needed, but there is
./contexts/contextPermutation.pl:# a bug in the Value.pm version that neglects the separator value.)
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:# Produce a TeX version.
./contexts/contextPermutation.pl:#
./contexts/contextPermutation.pl:###########################################################
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# A class for making set-builder sets by hand
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# The Parser object that holds the set-builder notation
./contexts/contextInequalitySetBuilder.pl:# (and also allows point-set notation)
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# The such-that operator
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# Make sure it is only used in set braces
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# Give a warning about adding sets
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# Handle subtraction of sets
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# Handle unions of sets
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# Common function for the classes below
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# Special Inequalities::Interval subclass that
./contexts/contextInequalitySetBuilder.pl:# prints using set-builder notation.
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# Special Inequalities::Union subclass that
./contexts/contextInequalitySetBuilder.pl:# prints using set-builder notation.
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:# Special Inequalities::Set subclass that
./contexts/contextInequalitySetBuilder.pl:# prints using set-builder notation.
./contexts/contextInequalitySetBuilder.pl:#
./contexts/contextInequalitySetBuilder.pl:##################################################
./contexts/contextMatrixExtras.pl:####################################################
./contexts/contextMatrixExtras.pl:#
./contexts/contextMatrixExtras.pl:# Implements the ^T operation on matrices
./contexts/contextMatrixExtras.pl:# (as a right-associative unary operator)
./contexts/contextMatrixExtras.pl:#
./contexts/contextMatrixExtras.pl:####################################################
./contexts/contextMatrixExtras.pl:#
./contexts/contextMatrixExtras.pl:# Implement functions with one matrix input and real output
./contexts/contextMatrixExtras.pl:#
./contexts/contextMatrixExtras.pl:#
./contexts/contextMatrixExtras.pl:# Check for a single Matrix-valued input
./contexts/contextMatrixExtras.pl:#
./contexts/contextMatrixExtras.pl:#
./contexts/contextMatrixExtras.pl:# Evaluate by promoting to a Matrix
./contexts/contextMatrixExtras.pl:# and then calling the routine from the Value package
./contexts/contextMatrixExtras.pl:#
./contexts/contextMatrixExtras.pl:#
./contexts/contextMatrixExtras.pl:# Check for a single Matrix-valued argument
./contexts/contextMatrixExtras.pl:# Then promote it to a Matrix (does error checking)
./contexts/contextMatrixExtras.pl:# and call the routine from Value package (after
./contexts/contextMatrixExtras.pl:# converting "tr" to "trace")
./contexts/contextMatrixExtras.pl:#
./contexts/contextLimitedComplex.pl:##################################################
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:# Handle common checking for BOPs
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:# Do original check and then if the operands are numbers, its OK.
./contexts/contextLimitedComplex.pl:# Otherwise, do an operator-specific check for if complex numbers are OK.
./contexts/contextLimitedComplex.pl:# Otherwise report an error.
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:# filled in by subclasses
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:# Get the form for use in error messages
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:# Now we get the individual replacements for the operators
./contexts/contextLimitedComplex.pl:# that we don't want to allow. We inherit everything from
./contexts/contextLimitedComplex.pl:# the original Parser::BOP class, and just add the
./contexts/contextLimitedComplex.pl:# complex checks here. Note that checkComplex only
./contexts/contextLimitedComplex.pl:# gets called if exactly one of the terms is complex
./contexts/contextLimitedComplex.pl:# and the other is real.
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:# Base must be 'e' (then we know the other is the complex
./contexts/contextLimitedComplex.pl:# since we only get here if exactly one term is complex)
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:# Now we do the same for the unary operators
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:# Absolute value does complex norm, so we
./contexts/contextLimitedComplex.pl:# trap that as well.
./contexts/contextLimitedComplex.pl:#
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedComplex.pl:##############################################
./contexts/contextLimitedFactor.pl:#
./contexts/contextLimitedFactor.pl:# Set up the LimitedFactor context
./contexts/contextLimitedFactor.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Initialization creates a Currency context object
./contexts/contextCurrency.pl:# and sets up a Currency() constructor.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Quote characters that are special in regular expressions
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Quote common TeX special characters, and put
./contexts/contextCurrency.pl:# the result in {\rm ... } if there are alphabetic
./contexts/contextCurrency.pl:# characters included.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:######################################################################
./contexts/contextCurrency.pl:######################################################################
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# The Currency context has an extra "currency" data
./contexts/contextCurrency.pl:# type (like flags, variables, etc.)
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# It also creates some patterns needed for handling
./contexts/contextCurrency.pl:# currency values, and sets the Parser and Value
./contexts/contextCurrency.pl:# hashes to activate the Currency objects.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# The tolerance is set to .005 absolute so that
./contexts/contextCurrency.pl:# answers must be correct to the penny. You can
./contexts/contextCurrency.pl:# change this in the context, or for individual
./contexts/contextCurrency.pl:# currency values.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:##################################################
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# This is the context data for currency.
./contexts/contextCurrency.pl:# A special pattern is maintained for the
./contexts/contextCurrency.pl:# comma form of numbers (using the specified
./contexts/contextCurrency.pl:# comma and decimal-place characters).
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# You specify the currency symbol via
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Context()->currency->set(symbol=>'$');
./contexts/contextCurrency.pl:# Context()->currency->set(comma=>',',decimal=>'.');
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# You can add extra symbols via
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Context()->currency->addSymbol("dollar","dollars");
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# If the symbol contains alphabetic characters, it
./contexts/contextCurrency.pl:# is made to be right-associative (i.e., comes after
./contexts/contextCurrency.pl:# the number), otherwise it is left-associative (i.e.,
./contexts/contextCurrency.pl:# before the number). You can change that for a
./contexts/contextCurrency.pl:# symbol using
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Context()->currency->setSymbol("Euro"=>{associativity=>"left"});
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Finally, an extra symbol can be removed with
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Context()->currency-removeSymbol("dollar");
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Set up the initial data
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Create, set and remove extra currency symbols
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Update the currency patterns in case the characters have changed,
./contexts/contextCurrency.pl:# and if the symbol has changed, remove the old operator(s) and
./contexts/contextCurrency.pl:# create a new one for the given symbol.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:######################################################################
./contexts/contextCurrency.pl:######################################################################
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# When creating Number objects in the Parser, we need to remove the
./contexts/contextCurrency.pl:# comma (and currency) characters and replace the decimal character
./contexts/contextCurrency.pl:# with an actual decimal point.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:##################################################
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# This class implements the currency symbol.
./contexts/contextCurrency.pl:# It checks that its operand is a numeric constant
./contexts/contextCurrency.pl:# in the correct format, and produces
./contexts/contextCurrency.pl:# a Currency object when evaluated.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Use the Currency MathObject to produce the output formats
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:######################################################################
./contexts/contextCurrency.pl:######################################################################
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# This is the MathObject class for currency objects.
./contexts/contextCurrency.pl:# It is basically a Real(), but one that stringifies
./contexts/contextCurrency.pl:# and texifies itself to include the currency symbol
./contexts/contextCurrency.pl:# and commas every three digits.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# We need to override the new() and make() methods
./contexts/contextCurrency.pl:# so that the Currency object will be counted as
./contexts/contextCurrency.pl:# a Value object. If we aren't promoting Reals,
./contexts/contextCurrency.pl:# produce an error message.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Look up the currency symbols either from the object of the context
./contexts/contextCurrency.pl:# and format the output as a currency value (use 2 decimals and
./contexts/contextCurrency.pl:# insert commas every three digits). Put the currency symbol
./contexts/contextCurrency.pl:# on the correct end for the associativity and remove leading
./contexts/contextCurrency.pl:# and trailing spaces.
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Override the class name to get better error messages
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:# Add promoteReals option to allow Reals with no dollars
./contexts/contextCurrency.pl:#
./contexts/contextCurrency.pl:######################################################################
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# The main MathObject class for reactions
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Some type declarations for the various classes
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Set up the context and Reaction() constructor
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#<<<
./contexts/contextReaction.pl:#>>>
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Handle postfix - and + in superscripts
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Handle superscripts of just + or -
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Compare by checking of the trees are equivalent
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Don't allow evaluation
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Provide a useful name
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Set up the answer checker. Avoid the list checker in
./contexts/contextReaction.pl:# Value::Formula::cmp_equal (for when the answer is a
./contexts/contextReaction.pl:# sum of compounds) and provide a postprocessor to
./contexts/contextReaction.pl:# give warnings when a reaction is compared to a
./contexts/contextReaction.pl:# student answer that isn't a reaction.
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Since the context only allows things that are comparable, we
./contexts/contextReaction.pl:# don't really have to check anything. (But if someone added
./contexts/contextReaction.pl:# strings or constants, we would.)
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# The replacement for the Parser:Number class
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Equivalent is equal
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# The replacement for Parser::Variable. We hold the elements here.
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Two elements are equivalent if their names are equal
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Print element names in Roman
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# For a printable name, use a constant's name,
./contexts/contextReaction.pl:# and 'an element' for an element.
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# General binary operator (add, multiply, arrow, and underscore
./contexts/contextReaction.pl:# are subclasses of this).
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Binary operators produce chemicals (unless overridden, as in arrow)
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Two nodes are equivalent if their operands are equivalent
./contexts/contextReaction.pl:# and they have the same operator
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Implements the --> operator
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# It is a reaction, not a chemical
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Check that the operands are correct.
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Implements addition, which forms a list of operands, so acts like
./contexts/contextReaction.pl:# the Parser::BOP::comma operator
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Check that the operands are OK
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Two are equivalent if they are equivalent in either order.
./contexts/contextReaction.pl:# (never really gets used, since these result in the creation
./contexts/contextReaction.pl:# of a list rather than an "add" node in the final tree.
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Implements concatenation, which produces compounds or integer
./contexts/contextReaction.pl:# multiples of elements or molecules.
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Check that the operands are OK
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Remove ground state, if needed
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# No space in output for implied multiplication
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Handle states separately
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Implements the underscore for creating molecules
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Check that the operands are OK
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Create proper TeX output
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Create proper text output
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Implements the superscript for creating ions
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Check that the operands are OK
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Create proper TeX output
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Create proper text output
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# General unary operator (minus and plus are subclasses of this).
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Unary operators produce numbers
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Two nodes are equivalent if their operands are equivalent
./contexts/contextReaction.pl:# and they have the same operator
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Always put signs on the right
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Always put signs on the right
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Negative numbers (for ion exponents)
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Positive numbers (for ion exponents)
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Implements sums of compounds as a list
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Two sums are equivalent if their terms agree in any order.
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Get a hash of element (or compound, etc.) names used in the list
./contexts/contextReaction.pl:# mapping to the count of each and a hash of the states used and
./contexts/contextReaction.pl:# their counts. States are only recorded if students don't need
./contexts/contextReaction.pl:# to include them (otherwise the hash names will include the states).
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Use "+" between entries in the list (with no parens)
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Implements complexes as a list
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:# Two complexes are equivalent if their contents are equivalent
./contexts/contextReaction.pl:# (we check by stringifying them and sorting, then compare results)
./contexts/contextReaction.pl:#
./contexts/contextReaction.pl:######################################################################
./contexts/contextAlternateDecimal.pl:###########################################################
./contexts/contextAlternateDecimal.pl:###########################################################
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# Create the AlternateDecimal contexts
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# Enables alternate decimals in the given context
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# Sets all the default contexts to use alternate decimals.
./contexts/contextAlternateDecimal.pl:# The two arguments determine the values for the
./contexts/contextAlternateDecimal.pl:# enterDecimals and displayDecimals flags. If enterDecimals
./contexts/contextAlternateDecimal.pl:# is ",", then student answers must use commas for decimals
./contexts/contextAlternateDecimal.pl:# (though professors can use either). If the display is not
./contexts/contextAlternateDecimal.pl:# ".", then separators for lists, points, vectors, etc, are
./contexts/contextAlternateDecimal.pl:# displayed as ";".
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:###########################################################
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# Handle numbers with commas as decimal indicators, and produce an
./contexts/contextAlternateDecimal.pl:# error if the format is not what is allowed. Mark the number if it
./contexts/contextAlternateDecimal.pl:# is in the alternate form, so we can display it correctly later. If
./contexts/contextAlternateDecimal.pl:# needed, save the original string, swap the comma for a dot, save
./contexts/contextAlternateDecimal.pl:# THAT, and correct the number's numeric value.
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# If we have an alternate form, make a Real out of it so that
./contexts/contextAlternateDecimal.pl:# we can retain the alternateForm flag. (I'm not sure if there
./contexts/contextAlternateDecimal.pl:# will be any problems from that, since it usually only returns
./contexts/contextAlternateDecimal.pl:# a Perl real).
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# Fix the decimal separators depending on the display format.
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# Return the proper class
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:###########################################################
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# Make the number and issue a warning if the wrong format is used.
./contexts/contextAlternateDecimal.pl:# Save the decimal in standard notation, but mark it as alternate
./contexts/contextAlternateDecimal.pl:# form so that it can be displayed in its original form, if needed.
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# Display the number in the correct form depending on the displayDecimals flag.
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:###########################################################
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:# Allow Parser::Value to create Parser::Number objects
./contexts/contextAlternateDecimal.pl:# from decimals without checking for commas (since these
./contexts/contextAlternateDecimal.pl:# are the results of computations, not values entered
./contexts/contextAlternateDecimal.pl:# directly by students).
./contexts/contextAlternateDecimal.pl:#
./contexts/contextAlternateDecimal.pl:###########################################################
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:# Handle creating String() constants
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:# Replacement for Parser::String that uses the original string verbatim
./contexts/contextArbitraryString.pl:# (but replaces \r and \r\n by \n to handle different browser multiline input)
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:# Replacement for Value::String that creates preview strings
./contexts/contextArbitraryString.pl:# that work for multiline input
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:# Mark a multi-line string to be displayed verbatim in TeX
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:# Quote HTML special characters
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:#
./contexts/contextArbitraryString.pl:# Adjust preview and strings so they display multiline answers properly.
./contexts/contextArbitraryString.pl:#
./contexts/contextRestrictedDomains.pl:###########################
./contexts/contextRestrictedDomains.pl:#
./contexts/contextRestrictedDomains.pl:# Subclass the numeric functions
./contexts/contextRestrictedDomains.pl:#
./contexts/contextRestrictedDomains.pl:#
./contexts/contextRestrictedDomains.pl:# Override sqrt() to return a special value times x when evaluated
./contexts/contextRestrictedDomains.pl:#
./contexts/contextExtensions.pl:#################################################################################################
./contexts/contextExtensions.pl:#################################################################################################
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# This package provides create() and extend() functions that can be
./contexts/contextExtensions.pl:# used to get a copy of an existing context and extend it by
./contexts/contextExtensions.pl:# overriding the existing classes with your own, while maintaining
./contexts/contextExtensions.pl:# information about those original classes so that you can fall back
./contexts/contextExtensions.pl:# on them for any situations that don't involve your new
./contexts/contextExtensions.pl:# functionality. These functions are designed so that multiple
./contexts/contextExtensions.pl:# extensions can be added without interfering with one another.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# ID to use for contexts that need a dynamic extension
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Copy the given context (given by name or as a Context object)
./contexts/contextExtensions.pl:# and name the new one. For example,
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# $context = context::Extensions::create("Quaternions", "Complex");
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# would create a context named "Quaternions-Complex" as a copy of the
./contexts/contextExtensions.pl:# Complex context. The implementation for classes added to this
./contexts/contextExtensions.pl:# context should be in the context::Quaternions namespace.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Extend a given Context object to include new features by specifying
./contexts/contextExtensions.pl:# classes to use for operators, functions, value object, and parser
./contexts/contextExtensions.pl:# objects, while retaining the old classes for fallback use.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# The changes are specified in the options following the Context, and these
./contexts/contextExtensions.pl:# can include:
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# opClasses => { op => 'class', ... }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# specifies the operators to override, and the class suffix to
./contexts/contextExtensions.pl:# use for their implementations. For example, using
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# opClasses => { '+' => 'BOP::add' }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# would attach the class context::Quaternions::BOP::add to the
./contexts/contextExtensions.pl:# plus sign in our Quaternion setting. If the space operator (' ')
./contexts/contextExtensions.pl:# is in your list, and if the original context has it point to an
./contexts/contextExtensions.pl:# operator that is NOT in your list, then that referenced operator
./contexts/contextExtensions.pl:# is redirected automatically to 'BOP::Space' in your base context
./contexts/contextExtensions.pl:# package. In our case, we would want to include a definition for
./contexts/contextExtensions.pl:# context::Quaternions::BOP::Space in order to cover that possibility.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# ops => { op => {def}, ... }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# specifies new operators to add to the context (where "def" is
./contexts/contextExtensions.pl:# an operator definition like those for any context).
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# functions => 'class1|class2|...'
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# specifies the function categories that you are overriding (e.g.,
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# functions => 'numeric|trig|hyperbolic'
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# would override the functions that have classes that end in
./contexts/contextExtensions.pl:# ::Functions:numeric, ::Function::trig, or ::Function::hyperbolic
./contexts/contextExtensions.pl:# and direct them to your own versions of these. In our quaternion
./contexts/contextExtensions.pl:# setting that would be to context::Quaternions::Function::numeric
./contexts/contextExtensions.pl:# for the first of these, and similarly for the others.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# value => ['Class1', 'Class2', ...]
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# specifies the Value object classes to override. For instance,
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# value => ['Real', 'Formula']
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# would set $context->{value}{Real} and $context->{value}{Formula}
./contexts/contextExtensions.pl:# to point to your own versions of these (e.g., in our example,
./contexts/contextExtensions.pl:# these would be context::Quaternions::Value::Real and
./contexts/contextExtensions.pl:# context::Quaternions::Value::Formula. Note that if you list
./contexts/contextExtensions.pl:# the parenthesized version (used by the corresponding constructor
./contexts/contextExtensions.pl:# functions), then the parentheses are replaced by "_Parens" in the
./contexts/contextExtensions.pl:# class name. For example,
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# value => ['Real()']
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# would set
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# $context->{value}{Real()} = 'context::Quaternions::Value::Real_Parens';
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# parser => ['Class1', 'Class2', ... ]
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# specifies the Parser classes to override. This works similarly
./contexts/contextExtensions.pl:# to the "value" option above, so that
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# parser => ['Number']
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# would set $context->{parser}{Number} to your version of this class,
./contexts/contextExtensions.pl:# which would be context::Quaternions::Parser::Number in our example.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# flags => { flag => value, ...}
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# specifies the new flags to add to the context (or existing ones to
./contexts/contextExtensions.pl:# override.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# reductions => { name => 1 or 0, ... }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# specifies new reduction rules to add to the context, and
./contexts/contextExtensions.pl:# whether they are in effect by default (1) or not (0). Of
./contexts/contextExtensions.pl:# course, you need to implement these reduction rules in your
./contexts/contextExtensions.pl:# Parser objects.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# context => "Context"
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# specifies that your context is a subclass of Parser::Context
./contexts/contextExtensions.pl:# that adds methods to the context. If specified, the modified
./contexts/contextExtensions.pl:# context will be blessed using this value as the suffix for the
./contexts/contextExtensions.pl:# context's class. In our quaternion example, the value "Context"
./contexts/contextExtensions.pl:# would mean the resulting modified context would be blessed
./contexts/contextExtensions.pl:# as context::Quaternions::Context.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# The extend() function returns the modified context.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# The various operators, functions, and value and Parser objects that
./contexts/contextExtensions.pl:# you define should use the context::Extensions::Super package below
./contexts/contextExtensions.pl:# in order to access the original classes for those objects. Ideally,
./contexts/contextExtensions.pl:# your new objects will mutate (i.e., re-bless) themselves to their
./contexts/contextExtensions.pl:# original classes if they don't involve your new MathObjects.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# For example, the new context::Quaternions::BOP::add class should
./contexts/contextExtensions.pl:# have the context::Extensions::Super object as one of its
./contexts/contextExtensions.pl:# superclasses, and then its _check() method could check if either
./contexts/contextExtensions.pl:# operand is a quaternion, and if not, it can call
./contexts/contextExtensions.pl:# $self->mutate->_check to turn itself into the original object's
./contexts/contextExtensions.pl:# class and perform its _check() actions. That way, the new BOP::add
./contexts/contextExtensions.pl:# class only needs to worry about implementing the situation for
./contexts/contextExtensions.pl:# quaternions, and lets the original class deal with everything else.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Record original operator class and set the new one,
./contexts/contextExtensions.pl:# extending to a new class if needed.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Record original class for a given Value or Parser class
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#################################################################################################
./contexts/contextExtensions.pl:#################################################################################################
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# A common class for getting the super-class of an extension class.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# This class handles all the details of dealing with the original
./contexts/contextExtensions.pl:# object classes that you have overridden in the context. You should
./contexts/contextExtensions.pl:# create a subclass of this class and define its extensionContext()
./contexts/contextExtensions.pl:# method to return your base context name, and then include that
./contexts/contextExtensions.pl:# subclass in your @ISA arrays for your new classes that override the
./contexts/contextExtensions.pl:# original context's classes. (This is not strictly necessary, but
./contexts/contextExtensions.pl:# it is more efficient to do this than to have the Super class
./contexts/contextExtensions.pl:# have to figure it out every time a Super method is used.)
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# For our quaternions example, you would use
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# package context::Quaternions::Super
./contexts/contextExtensions.pl:# our @ISA = ('context::Extensions::Super');
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# sub extensionContext { 'context::Quaternions' }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# and then use 'context::Quaternions::Super' in the @ISA of your new
./contexts/contextExtensions.pl:# classes for operators, functions, or Value or Parser objects.
./contexts/contextExtensions.pl:# E.g.,
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# package context::Quaternions::BOP::add;
./contexts/contextExtensions.pl:# our @ISA = ('context::Quaternions::Super', 'Parser::BOP');
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# sub _check {
./contexts/contextExtensions.pl:# my $self = shift;
./contexts/contextExtensions.pl:# return $self->mutate->_check
./contexts/contextExtensions.pl:# unless $self->{lop}->class eq 'Quaternion' || $self->{rop}->class eq 'Quaternion';
./contexts/contextExtensions.pl:# # Do your checking for proper arguments to go along with a quaternion here
./contexts/contextExtensions.pl:# }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# sub _eval {
./contexts/contextExtensions.pl:# # Do what is needed to perform addition between quaternions or between
./contexts/contextExtensions.pl:# # a quaternion or another legal value here. You don't have to worry
./contexts/contextExtensions.pl:# # about any other types here, as the mutate() call above will change
./contexts/contextExtensions.pl:# # the class to the original class (and its _eval() method) if one
./contexts/contextExtensions.pl:# # of the operands isn't a quaternion.
./contexts/contextExtensions.pl:# }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# If you need to call a method from the original class, use
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# &{$self->super("method")}($self, args...);
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# where "method" is the name of the method to call, and "args" are any arguments
./contexts/contextExtensions.pl:# that you need to pass. For example,
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# my $string = &{$self->super("string")}($self);
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# would get the string output from the original class.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# If you are defining a new() or make() method (where the $self could be
./contexts/contextExtensions.pl:# the class name rather than a class instance), you will need to pass the
./contexts/contextExtensions.pl:# context to mutate(), super(), or superClass(). See the example for
./contexts/contextExtensions.pl:# new() below.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# The superClass() method gets you the name of the original class, in
./contexts/contextExtensions.pl:# case you need to access any class variables from that.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Get a method from the original class from the extended context
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Get the super class name from the extension hash in the context
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Re-bless the current object to become the other object,
./contexts/contextExtensions.pl:# if there is one, or the object's super class if not.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Use the super-class new() method
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Get the object's class from its class name
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# This method assumes the extension is in a class named
./contexts/contextExtensions.pl:# "context::" where is replaced by the name of the
./contexts/contextExtensions.pl:# context. E.g., context::Quaternions in our example.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# That assumption can be changed by subclassing
./contexts/contextExtensions.pl:# context::Extensions::Super package and overriding this method with
./contexts/contextExtensions.pl:# one that returns the extension context's name. It is more efficient
./contexts/contextExtensions.pl:# to do that, anyway, but you can get away without it.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#################################################################################################
./contexts/contextExtensions.pl:#################################################################################################
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# A common class for handling the private extension data in an object's typeRef.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# This allows you to add and retrieve custom data to and from an
./contexts/contextExtensions.pl:# object's type in such a way that it doesn't interfere with the
./contexts/contextExtensions.pl:# original object's type, or that of any other extensions.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# A MathObject's typeRef property is a HASH that includes information
./contexts/contextExtensions.pl:# about the object's type, its length (for things like lists and
./contexts/contextExtensions.pl:# vectors), and entry types (again for objects like lists and
./contexts/contextExtensions.pl:# vectors). We can add data to this hash to store additional
./contexts/contextExtensions.pl:# information that we need in order to be more granular about the
./contexts/contextExtensions.pl:# type or class of a Parser object.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# To use this, create a subclass of context::Extensions::Data that
./contexts/contextExtensions.pl:# has an extensionID() method that returns a name to use as the hash
./contexts/contextExtensions.pl:# key to store your custom data (the default is to use the base
./contexts/contextExtensions.pl:# context name). Your subclass should also include your Super class
./contexts/contextExtensions.pl:# as a parent class. For example:
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# package context::Quaternions::Data;
./contexts/contextExtensions.pl:# our @ISA = ('context::Quaternions::Super', 'context::Extensions:Data');
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# sub extensionID { 'quatData' }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Then use this new subclass in the @ISA list for any class that needs access
./contexts/contextExtensions.pl:# to your custom data.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# The extensionData() method returns the complete hash of your custom
./contexts/contextExtensions.pl:# data, from which you can extract the value of the property you
./contexts/contextExtensions.pl:# need, or can set any properties that you want. E.g.,
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# $self->extensionData->{class};
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# could be used to obtain the custom "class" property of your data.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# The setExtensionType() method is used to set an object's
./contexts/contextExtensions.pl:# $self->{type} property (which holds the object's typeRef) to a
./contexts/contextExtensions.pl:# named type residing in your base context. For example:
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# package context::Quaternions;
./contexts/contextExtensions.pl:# our $QUATERNION = Value::Type("Number, undef, undef, quatData => {class => "QUATERNION"});
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# package context::Quaternions::Super
./contexts/contextExtensions.pl:# our @ISA = ('context::Extensions::Super');
./contexts/contextExtensions.pl:# sub extensionContext { 'context::Quaternions' }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# package context::Quaternions::Data;
./contexts/contextExtensions.pl:# our @ISA = ('context::Quaternions::Super', 'context::Extensions:Data');
./contexts/contextExtensions.pl:# sub extensionID { 'quatData' }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# package context::Quaternions::BOP::add;
./contexts/contextExtensions.pl:# our @ISA = ('context::Quaternions::Data', 'Parser::BOP');
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# sub _check {
./contexts/contextExtensions.pl:# my $self = shift;
./contexts/contextExtensions.pl:# unless $self->{lop}->class eq 'Quaternion' || $self->{rop}->class eq 'Quaternion';
./contexts/contextExtensions.pl:# # other type checking here
./contexts/contextExtensions.pl:# $self->setExtensionType("QUATERNION"); # Use the type in the $QUATERNION variable above
./contexts/contextExtensions.pl:# }
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Finally, the extensionDataMatch() method checks if the value of a
./contexts/contextExtensions.pl:# given property is one of a set of values. For example, if you have
./contexts/contextExtensions.pl:# a property called "class", then
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# $self->extensionDataMatch($self->{lop}, "class", "QUATERNION", "COMPLEX");
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# would return 1 if the quatData->{class} was either "QUATERNION" or
./contexts/contextExtensions.pl:# "COMPLEX" in the $self->{lop}{type} hash, and 0 otherwise.
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Get the object's extensionData
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Set the object's extensionData (and the rest of its type)
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# Check if an object's extension property matches one of the given values
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:# The extension context can subclass that is produce a better name
./contexts/contextExtensions.pl:#
./contexts/contextExtensions.pl:#################################################################################################
./contexts/contextExtensions.pl:#################################################################################################
./contexts/contextOrdering.pl:###########################################
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# The main Ordering routines
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# Here we set up the prototype contexts and define the needed
./contexts/contextOrdering.pl:# functions in the main:: namespace. Some error messages are
./contexts/contextOrdering.pl:# modified to read better for these contexts.
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# A routine to set the letters allowed in this context.
./contexts/contextOrdering.pl:# (Old letters are cleared, and > and = are allowed, but hidden,
./contexts/contextOrdering.pl:# since they are used in the List() objects that implement the context).
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# Create orderings from strings or lists of letter => value pairs.
./contexts/contextOrdering.pl:# A copy of the current context is created that contains the proper
./contexts/contextOrdering.pl:# letters, and the correct string is created and parsed into an
./contexts/contextOrdering.pl:# Ordering object.
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#############################################################
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# This is a Parser BOP used to create the Ordering objects
./contexts/contextOrdering.pl:# used internally. They are actually lists with the operator
./contexts/contextOrdering.pl:# and the two operands, and the comparisons is based on the
./contexts/contextOrdering.pl:# standard list comparisons. The operands are either the strings
./contexts/contextOrdering.pl:# for individual letters, or another Ordering object as a
./contexts/contextOrdering.pl:# nested List.
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#############################################################
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# This is the Value object used to implement the list That represents
./contexts/contextOrdering.pl:# one ordering operation. It is simply a normal Value::List with the
./contexts/contextOrdering.pl:# operator as the first entry and the two operands as the remaing
./contexts/contextOrdering.pl:# entries in the list. The new() method is overriden to make binary
./contexts/contextOrdering.pl:# trees of equal operators into flat sorted lists. We override the
./contexts/contextOrdering.pl:# List string and TeX methods so that they print correctly as binary
./contexts/contextOrdering.pl:# operators. The cmp_equal method is overriden to make sure the that
./contexts/contextOrdering.pl:# the lists are treated as a unit during answer checking. There is
./contexts/contextOrdering.pl:# also a routine for adding letters to the object's context.
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# Put all equal letters into one list and sort them
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# Make sure we do comparison as a list of lists (rather than as the
./contexts/contextOrdering.pl:# individual entries in the underlying Value::List that encodes
./contexts/contextOrdering.pl:# the ordering)
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# Add more letters to the ordering's context (so student answers
./contexts/contextOrdering.pl:# can include them even if they aren't in the correct answer).
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#############################################################
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# This overrides the TeX method of the letters
./contexts/contextOrdering.pl:# so that they don't print using the \rm font.
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#############################################################
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# Override Parser classes so that we can check for repeated letters
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# Save the letters positional reference
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#########################
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# Move letters to Value object
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# Return Ordering class if the object is one
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#############################################################
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:# This overrides the cmp_equal method to make sure that
./contexts/contextOrdering.pl:# Ordering lists are put into nested lists (since the
./contexts/contextOrdering.pl:# underlying ordering is a list, we don't want the
./contexts/contextOrdering.pl:# list checker to test the individual parts of the list,
./contexts/contextOrdering.pl:# but rather the list as a whole).
./contexts/contextOrdering.pl:#
./contexts/contextOrdering.pl:#############################################################
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Initialization sets up a Perent() constructor and
./contexts/contextPercent.pl:# creates the percent contexts.
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:######################################################################
./contexts/contextPercent.pl:######################################################################
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# When creating Number objects in the Parser, keep Percent objects.
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:##################################################
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# This class implements the percent symbol.
./contexts/contextPercent.pl:# It checks that its operand is a numeric constant
./contexts/contextPercent.pl:# in the correct format, and produces
./contexts/contextPercent.pl:# a Percent object when evaluated.
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Use the Percent MathObject to produce the output formats
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:######################################################################
./contexts/contextPercent.pl:######################################################################
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# This is the MathObject class for Percent objects.
./contexts/contextPercent.pl:# It is basically a Real(), but one that stringifies
./contexts/contextPercent.pl:# and texifies itself to include the percent symbol,
./contexts/contextPercent.pl:# and evaluates to its value divided by 100.
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# We need to override the new() and make() methods
./contexts/contextPercent.pl:# so that the Percent object will be counted as
./contexts/contextPercent.pl:# a Value object. If we aren't promoting Reals,
./contexts/contextPercent.pl:# produce an error message.
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Format the output as a percent value.
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Override the class name to get better error messages
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Check for whether we want to work with reals as percents
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:######################################################################
./contexts/contextPercent.pl:######################################################################
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# LimitedPercent contexts
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:##################################################
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Handle common checking for BOPs
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Do original check and then if the operands are numbers, its OK.
./contexts/contextPercent.pl:# Otherwise report an error.
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Now we get the individual replacements for the operators
./contexts/contextPercent.pl:# that we don't want to allow. We inherit everything from
./contexts/contextPercent.pl:# the original Parser::BOP class, except the _check
./contexts/contextPercent.pl:# routine, which comes from LimitedPercent::BOP above.
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Now we do the same for the unary operators
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:##############################################
./contexts/contextPercent.pl:#
./contexts/contextPercent.pl:# Absolute value does vector norm, so we
./contexts/contextPercent.pl:# trap that as well.
./contexts/contextPercent.pl:#
./contexts/contextLimitedRadicalComplex.pl:#
./contexts/contextLimitedRadicalComplex.pl:# Set up the LimitedRadical context
./contexts/contextLimitedRadicalComplex.pl:#
./contexts/contextLimitedRadicalComplex.pl:###########################
./contexts/contextLimitedRadicalComplex.pl:#
./contexts/contextLimitedRadicalComplex.pl:# Create root(n, x)
./contexts/contextLimitedRadicalComplex.pl:#
./contexts/contextLimitedRadicalComplex.pl:###########################
./contexts/contextLimitedRadicalComplex.pl:#
./contexts/contextLimitedRadicalComplex.pl:# Subclass the numeric functions
./contexts/contextLimitedRadicalComplex.pl:#
./contexts/contextLimitedRadicalComplex.pl:#
./contexts/contextLimitedRadicalComplex.pl:# Override sqrt() to return a special value times x when evaluated
./contexts/contextLimitedRadicalComplex.pl:#
./contexts/contextAlternateIntervals.pl:##########################################################################
./contexts/contextAlternateIntervals.pl:##########################################################################
./contexts/contextAlternateIntervals.pl:# Create the AlternateIntervals contexts
./contexts/contextAlternateIntervals.pl:# Enables alternate intervals in the given context
./contexts/contextAlternateIntervals.pl:#
./contexts/contextAlternateIntervals.pl:# Sets the default Interval context to use alternate decimals. The
./contexts/contextAlternateIntervals.pl:# two arguments determine the values for the enterIntervals and
./contexts/contextAlternateIntervals.pl:# displayIntervals flags. If enterIntervals is "alternate", then
./contexts/contextAlternateIntervals.pl:# student answers must use the alternate format for entering
./contexts/contextAlternateIntervals.pl:# intervals (though professors can use either).
./contexts/contextAlternateIntervals.pl:#
./contexts/contextAlternateIntervals.pl:##########################################################################
./contexts/contextAlternateIntervals.pl:# Replace the standard Open with one that handles formInterval better.
./contexts/contextAlternateIntervals.pl:# We need to handle several possible close delimiters.
./contexts/contextAlternateIntervals.pl:#
./contexts/contextAlternateIntervals.pl:# We need to modify the test for formInterval to NOT check the number
./contexts/contextAlternateIntervals.pl:# of entries so that better error messages are produced, and to handle
./contexts/contextAlternateIntervals.pl:# multiple close delimiters. These are both in teh "operand" branch,
./contexts/contextAlternateIntervals.pl:# so do the original for all the choices, and copy that branch here,
./contexts/contextAlternateIntervals.pl:# with our modifications.
./contexts/contextAlternateIntervals.pl:#
./contexts/contextAlternateIntervals.pl:##########################################################################
./contexts/contextAlternateIntervals.pl:# Convert alternative form to regular form, but mark it as alternative.
./contexts/contextAlternateIntervals.pl:# Give error messages about forms that aren't allowed by the context flags.
./contexts/contextAlternateIntervals.pl:# For alternative form, switch back to the alternative brackets for printing,
./contexts/contextAlternateIntervals.pl:# or force standard or alternative form based on the context flags.
./contexts/contextAlternateIntervals.pl:# This gets called directly, so pass it up the line
./contexts/contextAlternateIntervals.pl:# Make sure that the standard open and close delimiters are
./contexts/contextAlternateIntervals.pl:# used so that comparisons and so on will work properly.
./contexts/contextAlternateIntervals.pl:# Report errors when invalid form is specified
./contexts/contextAlternateIntervals.pl:# Make a copy with the alternate delimiters, if needed.
./contexts/contextAlternateIntervals.pl:# Override the output methods to replace the alternate delimiters, when needed.
./contexts/contextLimitedRadical.pl:#
./contexts/contextLimitedRadical.pl:# Set up the LimitedRadical context
./contexts/contextLimitedRadical.pl:#
./contexts/contextLimitedRadical.pl:###########################
./contexts/contextLimitedRadical.pl:#
./contexts/contextLimitedRadical.pl:# Convenience
./contexts/contextLimitedRadical.pl:#
./contexts/contextLimitedRadical.pl:# Pass $a,$b, get Formula("$a sqrt($b)") but simplified
./contexts/contextLimitedRadical.pl:###########################
./contexts/contextLimitedRadical.pl:#
./contexts/contextLimitedRadical.pl:# Create root(n, x)
./contexts/contextLimitedRadical.pl:#
./contexts/contextLimitedRadical.pl:###########################
./contexts/contextLimitedRadical.pl:#
./contexts/contextLimitedRadical.pl:# Subclass the numeric functions
./contexts/contextLimitedRadical.pl:#
./contexts/contextLimitedRadical.pl:#
./contexts/contextLimitedRadical.pl:# Override sqrt() to return a special value times x when evaluated
./contexts/contextLimitedRadical.pl:#
./contexts/contextCongruence.pl:###########################################################################
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:# Initialize the contexts and make the creator function.
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:# Produce a string version
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:# Produce a TeX version
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:# Check for two real-valued arguments
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:# Check that the inputs are OK
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:# Call the appropriate routine
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:# Congruence Class
./contexts/contextCongruence.pl:# ax ≡ b (mod m)
./contexts/contextCongruence.pl:#
./contexts/contextCongruence.pl:# returns gcd, residue, divisor
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# The class name for the number-with-unit class
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Value types for units and numbers with units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Common error message for functions when they get arguments with units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Create the Units and LimitedUnits contexts, and the
./contexts/contextUnits.pl:# Unit(), NumberWithUnit(), and FormulaWithUnit() functions.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# The context subclass that adds unit-handling functions
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# The units from the original Units package
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# The categories of units that can be selected.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# These give the fundamental units of the unit names to be added to
./contexts/contextUnits.pl:# the context, or a list of such, or a list of names of known units.
./contexts/contextUnits.pl:# If a name begins with a dash, then REMOVE the category or named
./contexts/contextUnits.pl:# unit. For example, the "length" category excludes the lengths that
./contexts/contextUnits.pl:# are part of the "atomics" and "astronomy" categories. If a name
./contexts/contextUnits.pl:# ends in an asterisk, then add or remove all the aliases for that
./contexts/contextUnits.pl:# unit as well.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Add new units, either by name, as name => unit_def, or as unit_def
./contexts/contextUnits.pl:# (where unit_def is like one of the known units). Also add other
./contexts/contextUnits.pl:# units that are aliases for the given one in the known_units list.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Add new units, either by name or name => unit_def (where unit_def
./contexts/contextUnits.pl:# is like one of the known units). Don't add any aliases for these
./contexts/contextUnits.pl:# units.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Add a single unit by name or name => unit_def
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Adds all the aliases for a given named unit or unit definition
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Add the units for the given named categories
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Add the units for a single category
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Alias for addUnitsFor
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Remove the named units and their aliases
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Remove a named unit and its aliases
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Removes the named units nit not their aliases
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Assigns units to a list of variables (for differentiation)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# The MathObject class for units (single or compound)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Create a new Unit object, either by parsing a string version of
./contexts/contextUnits.pl:# the units, or by giving the name of a known unit, or as name => unit_def,
./contexts/contextUnits.pl:# where unit_def is an object like the known units. You can also use this
./contexts/contextUnits.pl:# object in the Unit from a Number-with-Unit, or to make a copy of an
./contexts/contextUnits.pl:# existing Unit.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Copy a Unit by duplicating the internal hashes and arrays.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the factor by which the unit must be multiplied to obtain
./contexts/contextUnits.pl:# a quantity in the corresponding fundamental units.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Multiply the Unit by another Unit
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Divide the Unit by another Unit
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Raise the Unit to a power
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Add the powers of units in the $units hash into the Unit's $key1
./contexts/contextUnits.pl:# list, and cancel powers between the $key1 and $key2 lists, moving
./contexts/contextUnits.pl:# any negative powers into the $key2 list.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Add $n to the unit $u in the $units hash, and move it to
./contexts/contextUnits.pl:# the $other hash if the power ends up being negative.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Check if there is cancellation between the $key1 and $key2 lists,
./contexts/contextUnits.pl:# and move any negative powers from the $key1 list to the $key2 list
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Handle cancellation of powers in the $units and $other lists.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Multiply a Unit by a Number or another Unit
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Divide a Unit by a Number or another Unit
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Raise a Unit to a numeric power
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Compare two Units (0 means equal)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the list of variables to differentiate by
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Differentiate by the given variables (provided they have assigned units).
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# The default flags for answer checking (take them from the context instead)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Check for sameUnits and exactUnits, and give the needed messages and partial credit
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the string version using the original units and powers
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the string version using the fundamental units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the string version using original units using:
./contexts/contextUnits.pl:# The original order and powers if $exact is set, or
./contexts/contextUnits.pl:# Alphabetic order and fractions otherwise. Use
./contexts/contextUnits.pl:# alias strings to normalize the result.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Creates the string version using the given order and power settings
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Create the string for a given unit and power and push it
./contexts/contextUnits.pl:# into the $units or $invert array depending on whether it has
./contexts/contextUnits.pl:# a negative power or not
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Create the TeX string for the Units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Create the TeX string for a given unit and power and
./contexts/contextUnits.pl:# push it into the $units array.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Create the Perl code to recreate the Units.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Override the functions to produce errors on Unit inputs
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# The MathObject class for numbers with units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Create a new Number-with-Unit object, either by giving the number
./contexts/contextUnits.pl:# and units separately. The number can be any MathObject that is of
./contexts/contextUnits.pl:# type Number (including a Formula returning a number), or a string to
./contexts/contextUnits.pl:# be parsed to compute the number. The unit can be a Unit object or
./contexts/contextUnits.pl:# a string that can be parsed to a Unit.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Return the proper type and class data
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Functions for obtaining the various parts of the Number-with-Units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the string version using the fundamental units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the string version using original units using:
./contexts/contextUnits.pl:# The original order and powers if the argument is true, or
./contexts/contextUnits.pl:# Alphabetic order and fractions if not.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the string version of the Number with Units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the TeX version of the Number with Units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the Perl code to re-create the Number with Units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Since the string version contains a space, we add parentheses when stringifying
./contexts/contextUnits.pl:# into another string
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# The default flags for answer checking (take them from the context instead)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Give a message about incorrect units, and check for sameUnits and
./contexts/contextUnits.pl:# exactUnits, and give the needed messages and partial credit.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Negate by negating the numeric part
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Take absolute value on the numeric part
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Add a Number with Units to another one
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Subtract a Number with Units from another one
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Multiply a Number with Units by another Number with Units, or a Unit, or a Number
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Divide a Number with Units by another Number with Units, or a Unit, or a Number,
./contexts/contextUnits.pl:# or divide a Number, Unit, or Number with Units by a Number with Units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Raise a Number with Units to an integer
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Compare two Numbers with Units (0 means equal)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Differentiate the number and unts by the given variables.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Functions that can't have Numbers with Units as arguments
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# sin() and cos() can take arguments that are angles
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Convert a Number with Units to one using the base units (in
./contexts/contextUnits.pl:# alphabetical order)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Convert a Number with Units to one using the given units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# A common class for getting the super-class of an extension class
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# A common base class for unit-based binary operators. It is used as
./contexts/contextUnits.pl:# part of a dynamically created class that includes a units class and
./contexts/contextUnits.pl:# original class from the context that the units context extends.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# True if one of the operands is a Unit or Number with Unit
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# True if both operands are Units or Numbers with Units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# True if one of the operands is a Number with Units and the other is
./contexts/contextUnits.pl:# a Number with Unit or a Number
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# True if both of the operands are a Numbers with Units
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Call the _check from the original class unless one of the operands
./contexts/contextUnits.pl:# is a Number with Units, in which case, we check that operations are
./contexts/contextUnits.pl:# allowed, and set the type if they are.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Call the _check from the original class unless one of the operands
./contexts/contextUnits.pl:# is a Unit or Number with Units. Otherwise, check the operands
./contexts/contextUnits.pl:# and report any messages, and set the type accordingly.
./contexts/contextUnits.pl:# For multiplication, use space or \, for string and TeX versions, not '*'.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# When we have "(x unit) unit" or "(x unit) / unit", adjust these to be
./contexts/contextUnits.pl:# "x (unit unit) or "x (unit / unit)" so that the output is better
./contexts/contextUnits.pl:# (i.e., doesn't include extra parentheses).
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Hack to replace BOP with a division BOP.
./contexts/contextUnits.pl:# (When check() is changed to accept a return value,
./contexts/contextUnits.pl:# this will not be necessary.)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Check if the units have cancelled, and set the type accordingly
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# For string output, add parentheses if the precedence is the same
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Call the super TeX method (so fractions are properly handled, for example)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Implements "squared", "cubed", "square", and "cubic" operators.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# A common base class for the unit function classes to allow trig and hyperbolic functions
./contexts/contextUnits.pl:# to have arguments that are Numbers with Units when the units are angles or other units.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# True when $x is a Number with Units where the units are degrees.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Check whether degrees or other units are allowed,
./contexts/contextUnits.pl:# otherwise convert to the usual function and do its check.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Convert an angle to radians if the argument is an angle (and conversion is allowed)
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Convert an angle to radians if the argument is an angle (and conversion is allowed)
./contexts/contextUnits.pl:# before calling the function.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Differentiate a function with a number-with-units as an argument.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Get the argument as a Formula.
./contexts/contextUnits.pl:# If the the argument is an angle, get its quantity (which includes
./contexts/contextUnits.pl:# the unit factor) and differentiate that.
./contexts/contextUnits.pl:# Otherwise, remove the unit from the function call and differentiate that.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#############################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Allow Real() to return the numeric part of a Number with Units,
./contexts/contextUnits.pl:# otherwise, do the original Real() call.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Allow Formulas to have "unit" and "number" methods
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:# Allow parentheses to be used around units in contexts (like
./contexts/contextUnits.pl:# LimitedNumeric) where they have been removed. This allows
./contexts/contextUnits.pl:# you to enter "kg/(m s)" in such contexts.
./contexts/contextUnits.pl:#
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextUnits.pl:#################################################################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Sets up the two inequality contexts
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# General BOP that handles the inequalities.
./contexts/contextInequalities.pl:# The difference comes in the _eval() method,
./contexts/contextInequalities.pl:# which tells what each computes.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Check that the inequality is formed between a variable and a number,
./contexts/contextInequalities.pl:# or between a number and another compatible inequality. Otherwise,
./contexts/contextInequalities.pl:# give an error.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# varPos and numPos tell which of lop or rop is the variable and which
./contexts/contextInequalities.pl:# the number. varName is the variable involved in the inequality.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Generate the interval for the given type of inequality.
./contexts/contextInequalities.pl:# If it is a combined inequality, intersect with the other
./contexts/contextInequalities.pl:# one to get the final set.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Inequalities have dummy variables that are not really
./contexts/contextInequalities.pl:# variables of a formula.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Avoid unwanted parentheses from the standard routines.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Implements the "and" operation as set intersection
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Implements the "or" operation as set union
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Subclass of Parser::Variable that records whether
./contexts/contextInequalities.pl:# this variable has already been seen in the formula
./contexts/contextInequalities.pl:# (so that it can be removed from the formula's
./contexts/contextInequalities.pl:# variable list when used in an inequality.)
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# A special class used for the variables in
./contexts/contextInequalities.pl:# inequalities, since they are not really
./contexts/contextInequalities.pl:# variables for the formula. (They don't need
./contexts/contextInequalities.pl:# to be substituted or given values when the
./contexts/contextInequalities.pl:# formula is evaluated, and so on.) These are
./contexts/contextInequalities.pl:# really just placeholders, here.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Give an error when U is used.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Don't allow sums and differences of inequalities
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Don't allow sums and differences of inequalities
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# For the Inequalities-Only context, report
./contexts/contextInequalities.pl:# an error for Intervals, Sets or Union notation.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Subclasses of the Interval, Set, and Union classes
./contexts/contextInequalities.pl:# that stringify as inequalities
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Some common routines to all three classes
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Turn the object back into its usual Value version
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Needed to get Interval data in the right order for make(),
./contexts/contextInequalities.pl:# and demote all the items in a Union
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Recursively mark Intervals and Sets in a Union as Inequalities
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Demote the operands to normal Value objects and
./contexts/contextInequalities.pl:# perform the action, then remake the result into
./contexts/contextInequalities.pl:# an Inequality again.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# The name to use for error messages in answer checkers
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Get the precedence based on the type rather than the class.
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Produce better error messages for inequalities
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Mark all the parts of the union as inequalities
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Update the intervals and sets when a new union is made
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Demote all the items in the union
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# A class for making inequalities by hand
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Allow Interval() to coerce types to Value::Interval
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:# Mark this as a list of inequalities (if it is)
./contexts/contextInequalities.pl:#
./contexts/contextInequalities.pl:##################################################
./contexts/contextString.pl:##################################################
./contexts/contextString.pl:##################################################
./contexts/contextString.pl:##################################################
./contexts/contextPermutationUBC.pl:###########################################################
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Create the contexts and add the constructor functions
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:###########################################################
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Methods common to cycles and permutations
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Use the usual make(), and then add the permutation data
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Permform multiplication of a number by a cycle or permutation,
./contexts/contextPermutationUBC.pl:# or a product of two cycles or permutations.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Perform powers by repeated multiplication;
./contexts/contextPermutationUBC.pl:# Negative powers are inverses.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Compare canonical representations
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# True if the permutation is in canonical form
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Promote a number to a Real (since we can take a number times a
./contexts/contextPermutationUBC.pl:# permutation, or a permutation to a power), and anything else to a
./contexts/contextPermutationUBC.pl:# Cycle or Permutation.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Produce a canonical representation as a collection of
./contexts/contextPermutationUBC.pl:# cycles that have their lowest entry first, sorted
./contexts/contextPermutationUBC.pl:# by initial entry.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Produce the inverse of a permutation or cycle.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Produce a string version (use "(1)" as the identity).
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Produce a TeX version (uses \; for spaces)
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:###########################################################
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# A single cycle
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Find the internal representation of the permutation
./contexts/contextPermutationUBC.pl:# (a hash representing where each element goes)
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:###########################################################
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# A combination of cycles
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Find the internal representation of the permutation
./contexts/contextPermutationUBC.pl:# (a hash representing where each element goes)
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:###########################################################
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Space between numbers forms a cycle.
./contexts/contextPermutationUBC.pl:# Space between cycles forms a permutation.
./contexts/contextPermutationUBC.pl:# Space between a number and a cycle or
./contexts/contextPermutationUBC.pl:# permutation evaluates the permutation
./contexts/contextPermutationUBC.pl:# on the number.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Check that the operands are appropriate, and return
./contexts/contextPermutationUBC.pl:# the proper type reference, or give an error.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Evaluate by forming a list if this is acting as a comma,
./contexts/contextPermutationUBC.pl:# othewise take a product (Value object will take care of things).
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# If the operator is not a comma, return the item itself.
./contexts/contextPermutationUBC.pl:# Otherwise, make a list out of the lists that are the left
./contexts/contextPermutationUBC.pl:# and right operands.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Produce the TeX form
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:###########################################################
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Powers of cycles form permutations
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Check that the operands are appropriate,
./contexts/contextPermutationUBC.pl:# and return the proper type reference
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:###########################################################
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# The List subclass for cycles in the parse tree
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Check that the coordinates are numbers.
./contexts/contextPermutationUBC.pl:# If there is one parameter and it is a cycle or permutation
./contexts/contextPermutationUBC.pl:# treat this as plain parentheses, not cycle parentheses
./contexts/contextPermutationUBC.pl:# (so you can take groups of cycles to a power).
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Produce a string version. (Shouldn't be needed, but there is
./contexts/contextPermutationUBC.pl:# a bug in the Value.pm version that neglects the separator value.)
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Produce a TeX version.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#########################################################################
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# The List subclass for one line notation permutations in the parse tree
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Check that the coordinates are numbers.
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:# Call the appropriate creation routine from Value.pm
./contexts/contextPermutationUBC.pl:# (Can be over-written by sub-classes)
./contexts/contextPermutationUBC.pl:#
./contexts/contextPermutationUBC.pl:###########################################################
./contexts/contextBaseN.pl:# Define the contexts 'BaseN' and 'LimitedBaseN'
./contexts/contextBaseN.pl:# Create a Context based on Numeric that allows +, -, *, /, %, and ^ on BaseN integers.
./contexts/contextBaseN.pl:# set the base of the context. Either an integer that is at least 2, an arrayref of digits,
./contexts/contextBaseN.pl:# or a preset: 'binary', 'octal', 'decimal', 'duodecimal', 'hexadecimal', or 'base64'.
./contexts/contextBaseN.pl:# Convert a number in base10 to the given base.
./contexts/contextBaseN.pl:# Convert a number in a given base to base 10.
./contexts/contextBaseN.pl:# A replacement for Parser::Number that accepts numbers in a non-decimal base and
./contexts/contextBaseN.pl:# converts them to decimal for internal use
./contexts/contextBaseN.pl:# Create a new number in the given base and convert to base 10.
./contexts/contextBaseN.pl:# Modulo operator
./contexts/contextBaseN.pl:#
./contexts/contextBaseN.pl:# Do the division.
./contexts/contextBaseN.pl:#
./contexts/contextBaseN.pl:# A replacement for Value::Real that handles non-decimal integers
./contexts/contextBaseN.pl:# Stringify and TeXify the number in the context's base
./contexts/contextBaseN.pl:# Define division as integer division.
./contexts/contextBoolean.pl:# top-level access to context-specific T and F
./contexts/contextBoolean.pl:# Subclass the Parser::Context to override copy() and add T and F functions
./contexts/contextBoolean.pl:# Access to the constant T and F values
./contexts/contextBoolean.pl:# Easy setting of precedence to different types
./contexts/contextBoolean.pl:# Subclass Parser::Number to return the constant T or F
./contexts/contextBoolean.pl:# Subclass Value::Formula for boolean formulas
./contexts/contextBoolean.pl:# use every combination of T/F across all variables
./contexts/contextBoolean.pl:# remove once UOP::string passses 'same' as second argument
./contexts/contextBoolean.pl:# remove once UOP::TeX passses 'same' as second argument
./contexts/contextBoolean.pl:# use the context settings
./contexts/contextBoolean.pl:# use the context settings
./contexts/contextLimitedPolynomial.pl:##################################################
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Handle common checking for BOPs
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Mark a variable as having power 1
./contexts/contextLimitedPolynomial.pl:# Mark a number as being present (when strict coefficients are used)
./contexts/contextLimitedPolynomial.pl:# Mark a monomial as having its given powers
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Get a hash of variable names that point to indices
./contexts/contextLimitedPolynomial.pl:# within the array of powers for a monomial
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Check for a constant expression
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:##################################################
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Handle common checking for BOPs
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Do original check and then if the operands are numbers, its OK.
./contexts/contextLimitedPolynomial.pl:# Otherwise, do an operator-specific check for if the polynomial is OK.
./contexts/contextLimitedPolynomial.pl:# Otherwise report an error.
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# filled in by subclasses
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Check that the exponents of a monomial are OK
./contexts/contextLimitedPolynomial.pl:# and record the new exponent array
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Check that the powers of combined monomials are OK
./contexts/contextLimitedPolynomial.pl:# and record the new power list
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Report an error when both operands are constants
./contexts/contextLimitedPolynomial.pl:# and strictCoefficients is in effect.
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Now we get the individual replacements for the operators
./contexts/contextLimitedPolynomial.pl:# that we don't want to allow. We inherit everything from
./contexts/contextLimitedPolynomial.pl:# the original Parser::BOP class, and just add the
./contexts/contextLimitedPolynomial.pl:# polynomial checks here. Note that checkPolynomial
./contexts/contextLimitedPolynomial.pl:# only gets called if at least one of the terms is not
./contexts/contextLimitedPolynomial.pl:# a number.
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Now we do the same for the unary operators
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Don't allow absolute values
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:# Only allow numeric function calls
./contexts/contextLimitedPolynomial.pl:#
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextLimitedPolynomial.pl:##############################################
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Creates and initializes the ScientificNotation context
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:##################################################
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# The Scientific Notation multiplication operator
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Check that the operand types are compatible, and give
./contexts/contextScientificNotation.pl:# approrpiate error messages if not. (We have to work
./contexts/contextScientificNotation.pl:# hard to make a good message about the number of
./contexts/contextScientificNotation.pl:# decimal digits required.)
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Perform the multiplication and return a ScientificNotation object
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Use the ScientificNotation MathObject to produce the output formats
./contexts/contextScientificNotation.pl:# (if other operators are added back into the context, these will
./contexts/contextScientificNotation.pl:# need to be modified to include parens at the appropriate times)
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:##################################################
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Scientific Notation exponentiation operator
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Check that the operand types are compatible and
./contexts/contextScientificNotation.pl:# produce appropriate errors if not
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#####################################
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# A subclass of Real that handles scientific notation
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Override these so we can mark ourselves as scientific notation
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Stringify using x notation not E,
./contexts/contextScientificNotation.pl:# using the right number of digits, and trimming
./contexts/contextScientificNotation.pl:# if requested.
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Convert x notation to TeX form
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# What to call us in error messages
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:# Only match against strings and Scientific Notation
./contexts/contextScientificNotation.pl:#
./contexts/contextScientificNotation.pl:#########################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:# just override the _check method
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:# handle _check to set type for numbers and sets
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./contexts/contextTypeset.pl:######################################################################
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# Create a SolutionFor object of the correct type
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:######################################################################
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# Define the new class (we make subclasses below)
./parsers/parserSolutionFor.pl:# (we need subclasses in order to make things work
./parsers/parserSolutionFor.pl:# properly with single-variable complex or real-valued
./parsers/parserSolutionFor.pl:# equations)
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# Evaluate the formula on the given point
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# The name of this object for error messages
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# Do a comparison by testing if the formula's equality
./parsers/parserSolutionFor.pl:# operation returns true or false.
./parsers/parserSolutionFor.pl:# (Since we are implementing <=> here, we need
./parsers/parserSolutionFor.pl:# to return 0 when true and 1 when false.)
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# Set up a new context that is a copy of the current one, but
./parsers/parserSolutionFor.pl:# has the equality operator defined, and the SolutionFor object
./parsers/parserSolutionFor.pl:# prededence set so that comparisons with points or numbers will
./parsers/parserSolutionFor.pl:# be promoted to comparisons with the SolutionFor
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:######################################################################
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# A separate class for Reals, to get Value::Real in the ISA list
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# Pass the real number directly
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:######################################################################
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# A separate class for Complexes
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# Pass the complex number directly
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:######################################################################
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# A separate class for Points
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:#
./parsers/parserSolutionFor.pl:# Use the Point's defaults, but turn off coordinate hints
./parsers/parserSolutionFor.pl:# (since a wrong coordinate isn't detectable)
./parsers/parserSolutionFor.pl:#
./parsers/parserCheckboxList.pl:# Order the choices (randomizing where requested).
./parsers/parserCheckboxList.pl:# Collect the labels from those that have them, and add ones to those that don't (if requested).
./parsers/parserCheckboxList.pl:# Find the correct choices in the ordered array
./parsers/parserCheckboxList.pl:# Format a label using the user-provided format string
./parsers/parserCheckboxList.pl:# Convert a value string into a numeric index.
./parsers/parserCheckboxList.pl:# Trim the selected choice or label so that it is not too long to be displayed in the results table.
./parsers/parserCheckboxList.pl:# Use the actual choice strings in the output rather than the value string.
./parsers/parserCheckboxList.pl:# Adjust student preview and answer strings to be the actual choice strings rather than the value strings.
./parsers/parserCheckboxList.pl:# Put normal strings into \text{} and others into \verb
./parsers/parserCheckboxList.pl:# Quote HTML special characters
./parsers/parserCheckboxList.pl:# Given a choice, a label, or an index into the choices array, return the choice.
./parsers/parserCheckboxList.pl:# Get a numeric index (-1 if not defined or not a number).
./parsers/parserCheckboxList.pl:# Create the checkbox text
./parsers/parserRadioButtons.pl:##################################################################
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# The package that implements RadioButtons
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Set up the main:: namespace
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Create a new RadioButtons object
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Get the choices into the correct order (randomizing where requested)
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Collect the labels from those that have them, and add ones
./parsers/parserRadioButtons.pl:# to those that don't (if requested)
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Find the correct choice in the ordered array
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Format a label using the user-provided format string
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Convert a value string into a numeric index.
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Trim the selected choice or label so that it is not too long
./parsers/parserRadioButtons.pl:# to be displayed in the results table.
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Use the actual choice string rather than the value string as the output
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Adjust student preview and answer strings to be the actual
./parsers/parserRadioButtons.pl:# choice string rather than the value string.
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Allow users to convert the value string into a choice or label
./parsers/parserRadioButtons.pl:# Include the value string for the correct choice in the answer hash
./parsers/parserRadioButtons.pl:##################################################################
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Handle old-style options (order, first, last, randomize)
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Given a choice, a label, or an index into the choices array,
./parsers/parserRadioButtons.pl:# return the choice.
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Get a numeric index (-1 if not defined or not a number)
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:# Create the radio-buttons text
./parsers/parserRadioButtons.pl:#
./parsers/parserRadioButtons.pl:##################################################################
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Create an instance of a FormulaUpToConstant. If no constant
./parsers/parserFormulaUpToConstant.pl:# is supplied, we add C ourselves.
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:##################################################
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Remember that compare implements the overloaded perl <=> operator,
./parsers/parserFormulaUpToConstant.pl:# and $a <=> $b is -1 when $a < $b, 0 when $a == $b and 1 when $a > $b.
./parsers/parserFormulaUpToConstant.pl:# In our case, we only care about equality, so we will return 0 when
./parsers/parserFormulaUpToConstant.pl:# equal and other numbers to indicate the reason they are not equal
./parsers/parserFormulaUpToConstant.pl:# (this can be used by the answer checker to print helpful messages)
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Return the {adapt} formula with test points adjusted
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Inherit from the main FormulaUpToConstant, but
./parsers/parserFormulaUpToConstant.pl:# adjust the test points to include the constants
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Insert dummy values for the constants for the test points
./parsers/parserFormulaUpToConstant.pl:# (These are supposed to be +C, so the value shouldn't matter?)
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:##################################################
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Here we override part of the answer comparison
./parsers/parserFormulaUpToConstant.pl:# routines in order to be able to generate
./parsers/parserFormulaUpToConstant.pl:# helpful error messages for students when
./parsers/parserFormulaUpToConstant.pl:# they leave off the + C.
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Show hints by default
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Provide diagnostics based on the adapted function used to check
./parsers/parserFormulaUpToConstant.pl:# the student's answer
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Make it possible to graph single-variable formulas by setting
./parsers/parserFormulaUpToConstant.pl:# the arbitrary constants to 0 first.
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Add useful messages, if the author requested them
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Don't perform equivalence check
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:##################################################
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Get the name of the constant
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Remove the constant and return a Formula object
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# Override the differentiation so that we always return
./parsers/parserFormulaUpToConstant.pl:# a Formula, not a FormulaUpToConstant (we don't want to
./parsers/parserFormulaUpToConstant.pl:# add the C in again).
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:######################################################################
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserFormulaUpToConstant.pl:# This class replaces the Parser::Variable class, and its job
./parsers/parserFormulaUpToConstant.pl:# is to look for new constants that aren't in the context,
./parsers/parserFormulaUpToConstant.pl:# and add them in. This allows students to use ANY constant
./parsers/parserFormulaUpToConstant.pl:# they want, and a different one from the professor. We check
./parsers/parserFormulaUpToConstant.pl:# that the student only used ONE arbitrary constant, however.
./parsers/parserFormulaUpToConstant.pl:#
./parsers/parserLogb.pl:# Check for numeric arguments
./parsers/parserLogb.pl:# Check that the inputs are OK and call the named routine
./parsers/parserLogb.pl:# Call the appropriate routine
./parsers/parserLogb.pl:# Check that the parameters are OK
./parsers/parserLogb.pl:# Compute log base b using log(x)/log(b)
./parsers/parserLogb.pl:# If b < 0 or x < 0, either promote to a complex or throw an error.
./parsers/parserLogb.pl:# Implement differentiation: (logb(b, u))' -> u'/(u * ln(b)) - b'/(b * ln(u)) * logb(b, u)
./parsers/parserLogb.pl:# Output TeX using \log_{b}(x)
./parsers/parserParametricPlane.pl:#
./parsers/parserParametricPlane.pl:# Define the subclass of Formula
./parsers/parserParametricPlane.pl:#
./parsers/parserParametricPlane.pl:#
./parsers/parserParametricPlane.pl:# Report some errors that were stopped by the showEqualErrors=>0 above.
./parsers/parserParametricPlane.pl:#
./parsers/parserLinearRelation.pl:##################################################
./parsers/parserLinearRelation.pl:#
./parsers/parserLinearRelation.pl:# Initialize the contexts and make the creator function.
./parsers/parserLinearRelation.pl:#
./parsers/parserLinearRelation.pl:# $R = LinearRelation("x + y + 2z <= 5");
./parsers/parserLinearRelation.pl:# $R = Formula("x + y + 2z <= 5");
./parsers/parserLinearRelation.pl:# $R = Compute("x + y + 2z <= 5");
./parsers/parserLinearRelation.pl:# $R = LinearRelation([1,2,1], [1,1,2], "<=");
./parsers/parserLinearRelation.pl:# $R = LinearRelation([1,2,1], 5, "<=");
./parsers/parserLinearRelation.pl:#
./parsers/parserLinearRelation.pl:# If the vectors are zero, check if true or false
./parsers/parserLinearRelation.pl:# If the vectors are non-zero, check if the equations are multiples of each other.
./parsers/parserLinearRelation.pl:#
./parsers/parserLinearRelation.pl:#
./parsers/parserLinearRelation.pl:# Only compare two relations
./parsers/parserLinearRelation.pl:#
./parsers/parserLinearRelation.pl:#
./parsers/parserLinearRelation.pl:# We subclass BOP::equality so that we can assign a type using _check and
./parsers/parserLinearRelation.pl:# override the _eval method for relation operators
./parsers/parserLinearRelation.pl:#
./parsers/parserLinearRelation.pl:#
./parsers/parserLinearRelation.pl:# We use a special formula object to check if the formula is a
./parsers/parserLinearRelation.pl:# LinearRelation or not, and return the proper class. This allows
./parsers/parserLinearRelation.pl:# lists of linear relations, for example.
./parsers/parserLinearRelation.pl:#
./parsers/parserAutoStrings.pl:######################################################################
./parsers/parserAutoStrings.pl:######################################################################
./parsers/parserAutoStrings.pl:######################################################################
./parsers/parserWordCompletion.pl:# Setup the context and the PopUp() command
./parsers/parserWordCompletion.pl:# Create a new WordCompletion object
./parsers/parserWordCompletion.pl:# Replacement for Parser::String that takes the complete parse string as its value and gives an error if the answer
./parsers/parserWordCompletion.pl:# given is not one of the allowed answers.
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:# Create the ImplicitEquation package
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:# Override the comparison method.
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:# Turn the right-hand equation into an ImplicitEquation. This creates
./parsers/parserImplicitEquation.pl:# the test points (i.e., finds the solution points). Then check
./parsers/parserImplicitEquation.pl:# the professor's function on the student's test points and the
./parsers/parserImplicitEquation.pl:# student's function on the professor's test points.
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:# Use the original equation for these (but not for perl(), since we
./parsers/parserImplicitEquation.pl:# need that to use perlFunction).
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:# Locate points that satisfy the equation
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:# Get random points and sort them by sign of the function.
./parsers/parserImplicitEquation.pl:# Also, get the average function value, and indicate if
./parsers/parserImplicitEquation.pl:# we actually did find both positive and negative values.
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:# Make a list of positive and negative points sorted by
./parsers/parserImplicitEquation.pl:# the distance between them. Also return the average distance
./parsers/parserImplicitEquation.pl:# between points.
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:#
./parsers/parserImplicitEquation.pl:# Use bisection algorithm to find a point where the function is zero
./parsers/parserImplicitEquation.pl:# (i.e., where the original equation is an equality)
./parsers/parserImplicitEquation.pl:# If we can't find a point (e.g., we are at a discontinuity),
./parsers/parserImplicitEquation.pl:# return an undefined value.
./parsers/parserImplicitEquation.pl:#
./parsers/parserParametricLine.pl:#
./parsers/parserParametricLine.pl:# Define the subclass of Formula
./parsers/parserParametricLine.pl:#
./parsers/parserParametricLine.pl:# Two parametric lines are equal if they have
./parsers/parserParametricLine.pl:# parallel direction vectors and either the same
./parsers/parserParametricLine.pl:# points or the vector between the points is
./parsers/parserParametricLine.pl:# parallel to the (common) direction vector.
./parsers/parserParametricLine.pl:#
./parsers/parserParametricLine.pl:# Report some errors that were stopped by the showEqualErrors=>0 above.
./parsers/parserParametricLine.pl:#
./parsers/parserLinearInequality.pl:##################################################
./parsers/parserLinearInequality.pl:#
./parsers/parserLinearInequality.pl:# Define the subclass of Formula
./parsers/parserLinearInequality.pl:#
./parsers/parserLinearInequality.pl:#
./parsers/parserLinearInequality.pl:# We already know the vectors are non-zero, so check
./parsers/parserLinearInequality.pl:# if the equations are multiples of each other.
./parsers/parserLinearInequality.pl:#
./parsers/parserLinearInequality.pl:#
./parsers/parserLinearInequality.pl:# Only compare two equalities
./parsers/parserLinearInequality.pl:#
./parsers/parserLinearInequality.pl:#
./parsers/parserLinearInequality.pl:# We subclass BOP::equality so that we can give a warning about
./parsers/parserLinearInequality.pl:# things like 1 = 3, and compute the values of inequalities.
./parsers/parserLinearInequality.pl:#
./parsers/parserLinearInequality.pl:#
./parsers/parserLinearInequality.pl:# We use a special formula object to check if the formula is a
./parsers/parserLinearInequality.pl:# LinearEquality or not, and return the proper class. This allows
./parsers/parserLinearInequality.pl:# lists of linear equalities, for example.
./parsers/parserLinearInequality.pl:#
./parsers/parserRoot.pl:########################################################################
./parsers/parserRoot.pl:########################################################################
./parsers/parserRoot.pl:########################################################################
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:# Check for arguments that are an integer and a number
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:# Check that the inputs are OK and call the named routine
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:# Call the appropriate routine
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:# Check that the parameters are OK
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:# Compute root using x**(1/n)
./parsers/parserRoot.pl:# If x < 0 and n is even, either promote x to a complex
./parsers/parserRoot.pl:# or throw an error.
./parsers/parserRoot.pl:# If x < 0 and n is odd, use -(abs(x))**(1/n)
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:# Implement differentiation: (u^(1/n))' -> (1/n)(u^(1/n))^(1-n) * u' - u^(1/n)ln(u)/n^2 * n'
./parsers/parserRoot.pl:# (We use (u^(1/n))^(1-n) rather than u^(1/n-1) so that we have the
./parsers/parserRoot.pl:# same domain as u^(1/n) does originally).
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:# Output TeX using \sqrt[n]{x}
./parsers/parserRoot.pl:#
./parsers/parserRoot.pl:########################################################################
./parsers/parserFunction.pl:#
./parsers/parserFunction.pl:# The package that will manage user-defined functions
./parsers/parserFunction.pl:#
./parsers/parserFunction.pl:#
./parsers/parserFunction.pl:# Check that there are the right number of arguments
./parsers/parserFunction.pl:# and they are of the right type.
./parsers/parserFunction.pl:#
./parsers/parserFunction.pl:#
./parsers/parserFunction.pl:# Call the function stored in the definition
./parsers/parserFunction.pl:#
./parsers/parserFunction.pl:#
./parsers/parserFunction.pl:# Check the arguments and compute the result.
./parsers/parserFunction.pl:#
./parsers/parserFunction.pl:#
./parsers/parserFunction.pl:# Get the name for a number
./parsers/parserFunction.pl:#
./parsers/parserFormulaAnyVar.pl:#
./parsers/parserFormulaAnyVar.pl:# Create an instance of a FormulaAnyVar.
./parsers/parserFormulaAnyVar.pl:#
./parsers/parserFormulaAnyVar.pl:##################################################
./parsers/parserFormulaAnyVar.pl:#
./parsers/parserFormulaAnyVar.pl:# Implement comparison that first replaces the student
./parsers/parserFormulaAnyVar.pl:# variable by the professor's (if they differ).
./parsers/parserFormulaAnyVar.pl:#
./parsers/parserFormulaAnyVar.pl:######################################################################
./parsers/parserFormulaAnyVar.pl:#
./parsers/parserFormulaAnyVar.pl:# This class replaces the Parser::Variable class, and its job
./parsers/parserFormulaAnyVar.pl:# is to look for new variables that aren't in the context,
./parsers/parserFormulaAnyVar.pl:# and add them in. This allows students to use ANY variable
./parsers/parserFormulaAnyVar.pl:# they want, even a different one from the professor. We check
./parsers/parserFormulaAnyVar.pl:# that the student only used ONE variable, however.
./parsers/parserFormulaAnyVar.pl:#
./parsers/parserMultiAnswer.pl:##################################################
./parsers/parserMultiAnswer.pl:# Set flags to be passed to individual answer checkers
./parsers/parserMultiAnswer.pl:# Creates an answer checker (or array of same) to be passed
./parsers/parserMultiAnswer.pl:# to ANS() or NAMED_ANS(). Any parameters are passed to
./parsers/parserMultiAnswer.pl:# the individual answer checkers.
./parsers/parserMultiAnswer.pl:######################################################################
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Get the answer checker used for when all the answers are treated
./parsers/parserMultiAnswer.pl:# as a single result.
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Check the answers when they are treated as a single result.
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# First, call individual answer checkers to get any type-check errors
./parsers/parserMultiAnswer.pl:# Then perform the user's checker routine
./parsers/parserMultiAnswer.pl:# Finally collect the individual answers and errors and combine
./parsers/parserMultiAnswer.pl:# them for the single result.
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Return a given string or a default if it is empty or not defined
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:######################################################################
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Answer checker to use for individual entries when singleResult
./parsers/parserMultiAnswer.pl:# is not in effect.
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Call the correct answer's checker to check for syntax and type errors.
./parsers/parserMultiAnswer.pl:# If this is the last one, perform the user's checker routine as well
./parsers/parserMultiAnswer.pl:# Return the individual answer (our answer hash is discarded).
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:######################################################################
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Collect together the correct and student answers, and call the
./parsers/parserMultiAnswer.pl:# user's checker routine.
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# If any of the answers produced errors or the types don't match
./parsers/parserMultiAnswer.pl:# don't call the user's routine.
./parsers/parserMultiAnswer.pl:# Otherwise, call it, and if there was an error, report that.
./parsers/parserMultiAnswer.pl:# Set the individual scores based on the result from the user's routine.
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:######################################################################
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# The user's checker can call setMessage(n,message) to set the error message
./parsers/parserMultiAnswer.pl:# for the n-th answer blank.
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# The user's checker can add messages to the single_ans_messages array,
./parsers/parserMultiAnswer.pl:# which are joined together along with any ans_messages from the
./parsers/parserMultiAnswer.pl:# individual answers.
./parsers/parserMultiAnswer.pl:######################################################################
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Produce the name for a named answer blank.
./parsers/parserMultiAnswer.pl:# (When the singleResult option is true, use the standard name for the first
./parsers/parserMultiAnswer.pl:# one, and create the prefixed names for the rest.)
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Record an answer-blank name (when using extensions)
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Produce an answer rule for the next item in the list,
./parsers/parserMultiAnswer.pl:# taking care to use names or extensions as needed
./parsers/parserMultiAnswer.pl:# by the settings of the MultiAnswer.
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:# Do the same, but for answer arrays, which are generated by the
./parsers/parserMultiAnswer.pl:# Value objects automatically sized to suit their data.
./parsers/parserMultiAnswer.pl:# Reset the correct_ans once the array is made
./parsers/parserMultiAnswer.pl:#
./parsers/parserMultiAnswer.pl:######################################################################
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# The package that implements pop-up menus
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Set up the main:: namespace
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Create a new PopUp object
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Get the choices into the correct order (randomizing where requested)
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Collect the labels and values
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Find the correct choice in the ordered array
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Convert a value string into a numeric index.
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Use the actual choice string (aka label) rather than the value string as the output
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Adjust student preview and answer strings to be the actual
./parsers/parserPopUp.pl:# choice string rather than the value string.
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Allow users to convert the value string into a label
./parsers/parserPopUp.pl:# Include the value string for the correct choice in the answer hash
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Answer rule is the menu list
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# DropDown() variant of PopUp() with placeholder
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# TrueFalse() variant of PopUp()
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:##################################################
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:# Replacement for Parser::String that takes the
./parsers/parserPopUp.pl:# complete parse string as its value
./parsers/parserPopUp.pl:#
./parsers/parserPopUp.pl:##################################################
./parsers/parserPrime.pl:##########################################
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# Package to enable and disable the prime operator
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# Add prime to the given or current context
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# Remove prime from the context
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:##########################################
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# Prime operator is a subclass of the unary operator class
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# Do a typecheck on the operand
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# A hack to prevent double-primes from inserting parentheses
./parsers/parserPrime.pl:# in string and TeX output (change the precedence to hide it)
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# Produce a perl version of the derivative
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# Evaluate the derivative
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# Reduce by replacing with derivative
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:#
./parsers/parserPrime.pl:# Handle derivative by taking derivative of a prime by taking
./parsers/parserPrime.pl:# derivative of the prime's value (which is itself a derivative)
./parsers/parserPrime.pl:#
./parsers/parserOneOf.pl:######################################################################
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Define the OneOf() creator function
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Use Compute() to handle each of the entries so correct_ans will be set
./parsers/parserOneOf.pl:# for each entry
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Return the type of the first entry (usually these will all be the same)
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Try to match against all the entries, and if any one of them matches,
./parsers/parserOneOf.pl:# go with it.
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Return the class for the first entry
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Use the standard cmp_equal, not the list version, since
./parsers/parserOneOf.pl:# this acts as a single item not a list.
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Check if the student value equals one of the ones in the correct-answer list
./parsers/parserOneOf.pl:# and return the result of that comparison if it is correct.
./parsers/parserOneOf.pl:# (FIXME: should this check all and return the highest score?)
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Produce the correct answer by combining correct answers of the originals.
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Produce the string version by making a comma separated list with " or " for the last comma
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Produce the TeX version by making a comma separated list with " or " for the last comma
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Produce a list of entries separated by $sep with $or as the final separator.
./parsers/parserOneOf.pl:# The entries are converted using the given $method of the entry.
./parsers/parserOneOf.pl:# If there is a format (or tex_format) flag, use that to format the list instead.
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:#
./parsers/parserOneOf.pl:# Make a list containing a formula object rather than a
./parsers/parserOneOf.pl:# formula returning a list.
./parsers/parserOneOf.pl:#
./parsers/parserImplicitPlane.pl:##################################################
./parsers/parserImplicitPlane.pl:#
./parsers/parserImplicitPlane.pl:# Define the subclass of Formula
./parsers/parserImplicitPlane.pl:#
./parsers/parserImplicitPlane.pl:#
./parsers/parserImplicitPlane.pl:# We already know the vectors are non-zero, so check
./parsers/parserImplicitPlane.pl:# if the equations are multiples of each other.
./parsers/parserImplicitPlane.pl:#
./parsers/parserImplicitPlane.pl:#
./parsers/parserImplicitPlane.pl:# Only compare two equalities
./parsers/parserImplicitPlane.pl:#
./parsers/parserImplicitPlane.pl:#
./parsers/parserImplicitPlane.pl:# We subclass BOP::equality so that we can give a warning about
./parsers/parserImplicitPlane.pl:# things like 1 = 3
./parsers/parserImplicitPlane.pl:#
./parsers/parserFunctionPrime.pl:#
./parsers/parserFunctionPrime.pl:# The package that will manage function primes
./parsers/parserFunctionPrime.pl:#
./parsers/parserFunctionPrime.pl:#
./parsers/parserFunctionPrime.pl:# Override the Parser::Function new() method to handle names with primes.
./parsers/parserFunctionPrime.pl:# When such a name appears, define a new (hidden) parserFunction that
./parsers/parserFunctionPrime.pl:# has the proper function and formula for the number of derivatives
./parsers/parserFunctionPrime.pl:# requested.
./parsers/parserFunctionPrime.pl:#
./parsers/parserRadioMultiAnswer.pl:# Convert a value string into a numeric index.
./parsers/parserRadioMultiAnswer.pl:# Creates an answer evaluator to be passed to ANS() or an array with a label and answer
./parsers/parserRadioMultiAnswer.pl:# evaluator to be passed to LABELED_ANS(). Any parameters are passed to the individual answer
./parsers/parserRadioMultiAnswer.pl:# evaluators. A default checker is supplied if one is not supplied by the problem author. This
./parsers/parserRadioMultiAnswer.pl:# checker returns 1 if the student selects the correct radio answer, and all answers in that
./parsers/parserRadioMultiAnswer.pl:# part are equal to correct answers in that part.
./parsers/parserRadioMultiAnswer.pl:# Check the answers. First, call individual answer checkers to get any type-check errors. Then
./parsers/parserRadioMultiAnswer.pl:# perform the user's checker routine. Finally collect the individual answers and errors and
./parsers/parserRadioMultiAnswer.pl:# combine them for the single result.
./parsers/parserRadioMultiAnswer.pl:# Return a given string or a default if it is empty or not defined
./parsers/parserRadioMultiAnswer.pl:# Collect the correct and student answers, and call the user's checker routine. If any of the
./parsers/parserRadioMultiAnswer.pl:# answers in the selected part produced errors or the types don't match, don't call the user's
./parsers/parserRadioMultiAnswer.pl:# routine. Otherwise, call it, and if there was an error, report that. Set the score from the
./parsers/parserRadioMultiAnswer.pl:# supplied checker.
./parsers/parserRadioMultiAnswer.pl:# The user's checker can call appendMessage(message) to add an error message.
./parsers/parserRadioMultiAnswer.pl:# Produce the name for an answer blank. (Use the standard name for the first one, and create
./parsers/parserRadioMultiAnswer.pl:# the prefixed names for the rest.)
./parsers/parserRadioMultiAnswer.pl:# Produce the label for a part of the radio answer.
./parsers/parserRadioMultiAnswer.pl:# Produce the answer rule.
./parsers/parserRadioMultiAnswer.pl:# Format a label.
./parsers/parserRadioMultiAnswer.pl:# Start a radio button container.
./parsers/parserRadioMultiAnswer.pl:# End a radio button container.
./parsers/parserRadioMultiAnswer.pl:# Record an answer-blank name (when using extensions)
./parsers/parserFormulaWithUnits.pl:#
./parsers/parserFormulaWithUnits.pl:# Now uses the version in Parser::Legacy::NumberWithUnits
./parsers/parserFormulaWithUnits.pl:# to avoid duplication of common code.
./parsers/parserFormulaWithUnits.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# FIXME: allow any variables in declaration
./parsers/parserAssignment.pl:# FIXME: Add more hints when variable name isn't right
./parsers/parserAssignment.pl:# or function name or number of arguments isn't right.
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:######################################################################
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Check that the left operand is a variable and not used on the right
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Convert to an Assignment object
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Don't count the left-hand variable
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Create an Assignment object
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Display without unwanted parentheses
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Add/Remove the Assignment operator to/from a context
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:######################################################################
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# A special List object that holds a variable and a value, and
./parsers/parserAssignment.pl:# that prints with an equal sign.
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Mark assignments so that they are not treated as lists by classMatch()
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Produce proper output
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Needed since these are called explicitly without an object
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Class is an a variable assigned to whatever
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Return the proper type
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:######################################################################
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# A subclass of Formula that does typematching properly for Assignments
./parsers/parserAssignment.pl:# (the match is against the right-hand sides)
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# Convert varaible names to those used in the correct answer, if the
./parsers/parserAssignment.pl:# student answer uses different ones
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:######################################################################
./parsers/parserAssignment.pl:#
./parsers/parserAssignment.pl:# A dummy function that is used for assignments like f(x) = x^2
./parsers/parserAssignment.pl:#