# IMathAS Help Documentation

## Table of Contents

- Administration
  - Creating Courses
    - Course Creation Settings
    - Adding Teachers
    - Transfering Ownership
    - Deleting
  - Question Set Management
    - Manage Question Set
    - Export Question Set
    - Import Question Set
  - Library Management
    - Manage Libraries
    - Export Libraries
    - Import Libraries
  - Install Macro File
  - Delete Old Users
  - Import Students
  - Manage Groups
  - Diagnostics
  - Managing Administrators and Teachers
    - Adding Administrators and Teachers
    - Rights
    - Resetting Admin Passwords
    - Deleting
- Course Management
  - Course Page Layout
  - Adding Items
    - Blocks
    - Inline Text Items
    - Linked Text Items
    - Forum Items
    - Assessments
      - Assessment Settings
      - Adding Questions to an Assessment
        - Icons used in question listing
        - Adding an Introduction to a Question
      - Adding New Questions
      - Categorizing Questions
      - Making Print Copies
  - Quick View
  - Calendar
  - Question Set Management
    - Manage Question Set
    - Export Question Set
    - Import Question Set
  - Library Management
    - Manage Libraries
    - Export Libraries
    - Import Libraries
  - List Students
    - Exceptions
    - Resetting Passwords / Changing Info
    - Unenrolling
    - Import Students
    - Assigning Section and/or Code Numbers
    - Manage LatePasses
    - Manage Tutors
  - Gradebook
    - Gradebook Settings and Categories
    - Offline Grades
    - Gradebook Detail
  - Student Groups
  - Messages
  - Copy Course Items
  - Change Dates
  - Change Assessments
  - Import/Export Course Items
  - LTI Integration
    - Canvas Integration - Using Import (recommended)
    - Canvas Integration - Manual Setup
    - Blackboard Integration - Using Import (recommended)
    - Blackboard Integration - Manual Setup
    - D2L Brightspace Integration
    - Moodle Integration
    - LTI Integration for Other LMSs - Using Import
    - LTI Integration for Other LMSs - Manual Setup
- Writing Questions
  - Question Parts
  - Basic Control Syntax
  - Randomizers
  - Graph/Table Macros
  - Format Macros
  - String Macros
  - Array Macros
  - General Macros
  - Math Macros
  - Conditional Test Macros
  - Feedback Macros
  - Using Other Macros
  - Math Entry
  - Solver
  - Options Common to All Types
  - Question Types
    - Number
    - Calculated
    - Multiple-Choice
    - Multiple-Answer
    - Matching
    - Function
    - String
    - Essay
    - Drawing
    - N-Tuple
    - Calculated N-Tuple
    - Complex
    - Calculated Complex
    - Numerical Matrix
    - Calculated Matrix
    - Interval
    - Calculated Interval
    - Chemical Equation
    - File Upload
    - Multipart
    - Conditional
- Using the System
  - Registering
  - Logging In
  - Home Page
    - Changing Your User Profile
      - Accessibility and Display Preferences
    - Enrolling in a Course
  - Course Page
  - Calendar
  - Course Map
  - Taking Assessments
    - Entering Math

# Administration

From an administrator's home page, the Admin page can be reached by clicking the "Go to Admin Page" link near the end of the page.

Not all the options described here may be available to you depending upon your rights setting

## Creating Courses

Create a new course by clicking the "Add New Course" button.

### Course Creation Settings

When you add a new course or click the "Modify" link next to a course name, enter the course name and an enrollment key. If you are allowing students to self-enroll then the enrollment key should be given to students, and will be required for them to enroll in this course, along with the Course ID. For new courses, the course ID will display when you return to the Admin page.

Other option:

- Enrollment Key: A entry password for students to self-enroll in the course. If you provide a semicolon-separated list of keys, students can enroll with any of them, and the key will get recorded as the student's section
- Available: Whether course is available to students, and whether it should display on the instructor's home page
- Lock for Assessment: Shuts down access to the course except for the specified assessment. Intended for in-class testing situations.
- Theme: Change the look and feel of your course
- Icons: Whether to display icons next to different course items.
- Allow self un-enroll: Whether students should be able to unenroll themselves from your course (usually NO is the best choice, so students can't accidentally delete their scores)
- Allow other instructors to copy: Whether other instructors should be allowed to copy course items without needing an enrollment key. You can limit this ability to instructors in your own group.
- Message System: allows you decide which features of the internal messaging system you want to enable. This allows you restrict who, if anyone, the student can send messages to.
- Live Chat: Enable a live chat room for this course
- Student Quick-Pick Top Bar: What items, if any, to have in a bar at the top of the student's course page
- Instructor Quick-Pick Top Bar: What items, if any, to have in a bar at the top of the instructor's course page
- Instructor Course Management Links: Whether to have course management links at the bottom or along the left side of the instructor's course page
- LTI access secret: A secret code to allow placement of your course into a BasicLTI consumer. More info

### Adding Teachers

After creating a course, click the "Add/Remove Teachers" link after the course name. Here you can add or remove users authorized as a teacher for this course. Only Group and full Admins have rights to add/remove teachers.

### Transfering Ownership

Click the "Transfer" link after the course name to transfer the ownership of the course to another teacher/admin. In general, course ownership is not highly important, but Course Creators can only modify courses for which they have ownership.

### Deleting

Clicking the "Delete" link after the course name will delete the course and all items contained within the course. However, it will not delete any questions added to the Question Set from within the course; the Question Set is shared, and not linked to any course

## Question Set Management

### Manage Question Set

Clicking the "Manage Question Set" link will allow you to search through the Question Set, modify questions, add questions, remove question, transfer ownership, or add a set of questions to a question library. Only administrators or question owners have the rights to remove a question. Be aware that if you remove a question that is currently being used in an assessment (as shown in the "Times Used" column), it will mess up that assessment.

The options available in the question set manager are:

- Modify: Change the source code of the question and make library assignments. You will only see this option for questions you own or when the owner has given permission for anyone to modify the question.
- View: View the source code of the question and make library assignements. You will only see this option for question you do not own.
- Template: Create a new question, using the code of an existing question as a starting point. When you template a question, the original question is not changed.
- Delete: Delete the question completely from the questionset and all libraries. You will only see this option for questions you own or when the owner has given permission for anyone to modify the question. You can delete many questions at once by selecting questions with the checkboxes, then clicking the Delete button near the top of the page.
- Transfer: Transfer ownership of the question to another user. You will only see this option for questions you own. You can transfer many questions at once by selecting questions with the checkboxes, then clicking the Transfer button near the top of the page.
- Library Assignment: The Library Assignment button near the top of the page can be used with the checkboxes to add or change your library assignments for the selected questions. This will not affect other people's assignments

Note that the assignment of questions into libraries can be done by anyone, but only the person who made the assignment is able to remove the question from the assigned library

### Export Question Set

Use the "Export Question Set" feature to export a portion of the Question Set for backup or sharing. Use the search feature with the checkboxes to select questions for inclusion in the export. Clicking the "Finalize" button, you will be asked for a Library Description.

### Import Question Set

Use the "Import Question Set" feature to import a Question Set that you or someone else had exported from IMathAS. Be sure to only import question sets from trusted sources. After specifying an import file, you will be given a chance to select specific questions from the set to be imported.

Imported questions will have ownership assigned to the importer. Select the userights you want to apply to all imported questions. You also can import the questions directly into an existing or new question library

If any questions (identified by a unique id) already exist in your system, you will be asked if you want to update the existing questions, or add as new questions. If you have modified questions previously imported, you may want to add as new.

## Library Management

### Manage Libraries

Use the library manager to remove, rename, change rights, change parent, or transfer ownership of question libraries. Be aware that if a library is deleted, the questions in that library will become unassigned; they are not deleted.

Libraries have a tree structure, where each library has a parent library. When you add or modify a library, you can change it's parent library. If you change a library's parent, all children library move with a library. You can only specify an empty library or existing parent library as a parent.

Libraries have use rights. Options are:

- Private: Only the owner or an administrator can list questions in these libraries
- Closed to group, private to others: Anyone in group can list and use questions, , but only the owner or an admin can add questions to the library. Hidden to anyone outside the group.
- Open to group, private to others: Anyone in group can list and use questions and add to the library. Hidden to anyone outside the group.
- Closed to all: Everyone can list and use questions, but only the owner or an admin can add questions to the library
- Open to group, close to others: Anyone in group can list and use questions and add to the library. Outside the group, users can only list and use questions; they cannot add questions to the library
- Open to all: Everyone can list and use questions and add to the library

With library rights, child rights take precedence over parent rights. For example, if an open library is a child to a private library, the parent will not be hidden from other users. However a private library as child to a private parent will be hidden from other users.

Depending upon the system configuration, non-admins may be limited to creating libraries that are private to others outside their group. If this is the case, a non-admin will need to contact an admin to create a library that is closed or open to all.

Library assignments are done in question management. Library assignments can be done by any user, but only the person who made the assignment can remove that assignment.

### Export Libraries

Use the "Export Libraries" feature to export an entire library or tree of libraries for backup or sharing. Use the tree to select libraries to export. Note that if a parent library is selected, it's children libraries are automatically included in the export, and heirarchy will be maintained. If libraries from different trees are selected, the topmost libraries in each branch selected will be exported at the same level.

### Import Libraries

Use the "Import Libraries" feature to import an entire library or tree of libraries. After selecting a file, the tree of libraries in the import file will be shown, and you can deselect libraries you do not want to import. Note that if a parent library is not selected, NONE of the children libraries will be added, regardless of whether they're checked or not.

You will be asked if you want to update existing questions/libraries, or add as new. If a library or question (identified by a unique id) in the import already exists on your system, this will tell the importer whether to update the existing libraries/questions, or import the libraries/questions as a new copy (a new unique id is assigned). If you have modified questions previously imported, you may want to add as new.

Imported libraries and questions will have ownership assigned to the importer. Select the userights you want to apply to all imported questions and libraries. You can select a parent in the library tree for all (top level) imported libraries

If you load a file that does not have a library tree embedded in the file, you will be told to use the Import Question Set feature instead. Even if a file has a library tree, you can use the Import Question Set feature to import specific questions from the file.

## Install Macro File

A Macro Library contains macros (functions) which can be used in questions. These expand the capabilities of IMathAS. If allowed, installation requires selecting the file name from your local computer and clicking "Submit". Be aware that any existing macro library of the same name will be replaced. A help file is automatically generated for newly installed macro libraries.

Warning!: Macro libraries are pure PHP (programming code), and have a large security risk. Only install macro libraries from a trusted source

## Delete Old Users

Use the Delete Old Users option to delete users who have not accessed the system within some specified number of months. You can delete just students, or all non-Admin users.

## Import Students from File

Use the Import Students from File feature to register and enroll a set of students automatically from a CSV (commas separated values) file. You can generate a CSV file using any spreadsheet program.

The form will guide you through specifying which columns of the CSV file contain First name, Last name, email address, and desired username. Once setting these options, the first five rows of the file will be displayed so you can verify that the import settings are correct. If you selected a class to enroll the imported students in, the students will be both registered and enrolled in that class upon submission.

## Manage Groups

Groups allow instructors to be divided into groups (by school, for example). Groups can create group-specific libraries, and Group Admins can be assigned to have Admin rights over group users and libraries. By default, users are added to a Default group.

Click Edit Groups to add, modify, or delete groups.

## Diagnostics

Diagnostics allow you to create a special login page for larger-scale diagnostic assessment. This provides a way for students to access and take the diagnostic without needing to register and enroll in a course. Also, it delivers them the correct assessment based on a specified selection.

If you are a group admin or full admin, click the "Add New Diagnostic" button to set up a new diagnostic. Diagnostics are linked with assessments in a course, so you should first create a course and add your diagnostic assessments to that course.

Over two pages, you will be asked for:

- Diagnostic name: the name of your diagnostic to display to students on the login page
- Term designator: Can be changed each term for ongoing assessments to keep track of which term an assessment was taken in. Also will create a unique username for each term, so same student ID could take the assessment again in the different term.
- Linked with course: What course contains your diagnostic assessments. You must be listed as a teacher for the course
- Available: Whether students can take the diagnostic
- Public: Whether the diagnostic should be listed on the main Diagnostics list page at $imasroot/diag. If set to no, students will have to be provided with the direct link to the diagnostic.
- Allow Reentry: Whether students should be forced to complete the diagnostic in one sitting, or whether you'll allow them to reaccess the test at a later time. If Yes, you can set a testing window that limits the number of minutes after first accessing the diagnostic they can reenter the diagnostic.
- Unique ID prompt: How you want to word the prompt for a unique user id
- ID entry format: Lets you specify the format of the unique ID, so ensure valid IDs
- Allow access IP addresses: IP addressed for which the diagnostic can be taken without a password. If you want to allow access from anywhere, enter "*". You can use "*" for a wildcard as well, e.g. 123.45.* to allow any IP beginning with 123.45.
- Passwords: Passwords which will allow access to the diagnostic from other IP addresses. Passwords are not case sensitive.
- Super passwords: These passwords will override the "allow reentry" time limit, if you specified one earlier. These passwords would be intended for use by instructors or proctors, and generally would not be shared directly with students.
- First level selector name: Students will be asked to select two items from pull-down lists, with the values in the second depending upon the values in the first. The choice in the first list also dictates which assessment is delivered. For selector name, specify what this selection should be called, filling in the blank "Please enter your ______". In many cases the two selectors will be Course and Instructor, or Course and Section
- First level selector options: Add options for the first level selector
- Second level selector name: Secondary selection, with values depending upon the first-level selector choice. Fill in the blank "Enter your _________". Second level selectors will be become the student's section identifier in the course, allowing you to use the tutor system with diagnostics.
- Deliver assessment: For each first-level selector, specify which assessment should be delivered if the student selects that option
- Second level selector options: For each first-level selector, specify the options for the second level selector.

After submitting the second page, you will be provided with the direct access link to the diagnostic, which you can provide to students or use to create a link from another website

In courses for which a diagnostic has been set up, the gradebook will display differently, showing the student unique ID, the term, and the first and second selector values in addition to the students' names and scores

## Managing Administrators and Teachers

At the bottom of the admin page is a list of users. Group Admins will see the teachers in their group. For Full Admins, teacher and higher level users are grouped by instructor Group, or are in the Default group if you haven't defined groups. Student accounts can be listed by choosing the corresponding first letter of the last name. To approve teachers who have filled out the "new instructor account request" form, choose Pending from the list. Note that if you require email confirmation of students, they might also show up in the Pending list until they confirm their account.

### Adding Administrators and Teachers

You can add a new administrator, teacher, or student by clicking the "Add New User" button. You will be asked to provide a username, user's name, and email. The user's password defaults to 'password'. If a user already has self-registered, and you want to promote them to administrator or teacher, find them in the user list and click the "Change Rights" link.

### Rights

When adding a new administrator or changing rights, there are several rights levels, each higher level including the rights of the lower levels:

1. Guest: Can access all class materials, including taking tests (however, test is restarted next time the guest user accesses the test). Cannot enroll or unenroll in courses, or change user info or password. Cannot post in forums
2. Student: Can only access class materials - cannot edit anything
3. Teacher: Can edit course materials and create assessments, but only in courses to which they have been assigned as a teacher
4. Course Creator: Can add courses, and they are automatically assigned as the teacher. Can delete courses that they create.
5. Diagnostic Creator: Can add courses, and they are automatically assigned as the teacher. Can delete courses that they create. Can create diagnostics.
6. Group Admin: Can add/delete teachers and set user rights, but only for users in their group. Can modify/delete questions and libraries created by members of the group regardless of ownership or use rights. Can always create "open to all" libraries
7. Full Administrator: Can add/delete administrators and set user rights. Can import macro files, if installation allows. Can modify/delete questions and libraries regardless of ownership or use rights

### Resetting Admin Passwords

You can reset a user's password to 'password' by clicking the "Reset Password" link next to the user's name.

### Deleting

You can delete an administrator by clicking the "Delete" button next to their name. Note that if they were teaching a course, this will unset them as a teacher, but does not delete the course itself.

# Course Management

Accessing a course as a teacher shows the course in management (edit) mode.

## Course Page Layout

The course page consists of a list of items. There are six types of items:

- Blocks: Groupings of items (Inline Text, Linked Text, Assessments)
- Inline Text Items: Text that displays on the course page
- Linked Text Items: A summary displays on the course page. A link is provided that can display text, an uploaded file, or a weblink
- Forum Items: Basic disussion forum
- Assessments: Tests or Practice questions
- Calendar: The course calendar, if you want to embed it on your course page

Blocks have a colored header. If a block is displayed collapsed, click the block name or the "Expand" button to view the block's contents. If the block is displayed as a folder (has a folder icon next to it), click the block name to view the block items.

Text items are preceded with an information ! icon, forums are preceded with a F icon, and assessments are preceded with a ? icon. The icons will be grey when the item is not available, and (depending upon install settings) may change color as a deadline approaches. The color is green at two weeks, yellow at one week, and red on due date.

The item order can be rearranged by using the number selector to the left of the item. Items can also be moved into or out of blocks using this selector.

## Adding Items

Add an item by selecting the item type from the "Add Item" pulldown. Using the "Add Item" pulldown inside a block will add the item to that block.

### Blocks

For Blocks, you will asked to provide:

- Title: The title of the block
- Available after: The first date for the item to display to students
- Available until: The last date for the item to display to students
- When available: Whether you want to display the block Expanded, Collapsed, or as a folder when available
- When not available: Whether you want to hide the block from students when not available, or show collapsed or as folder (depending on available setting). Use the show collapsed/folder option if the block contains items that students still need to be able to access.
- Colors: Allows you to specify colors other than the defaults for blocks

### Inline Text Items

For Inline Text items, you will asked to provide:

- Title: The title of the item
- Hide title: If you want to hide the title and icon, and just display the text
- Text: The actual text (displays on course page)
- Files: You can attach one or more files to an inline text item. For each file, provide a description of the file. A list of the descriptions, with links to the files, will display at the bottom of your text item.
- Available after: The first date for the item to display to students
- Available until: The last date for the item to display to students

### Linked Text Items

For Linked Text items, you will asked to provide:

- Title: The title of the item
- Summary: A description of the link (displays on course page)
- Text: Enter one of the following:
  - Type text in box provided. The text will display when link is clicked
  - Enter a weblink (like http://www.google.com). The link will take students to this weblink
  - Attach a file. The link will open the file. Note: Do not change the text on subsequent modifications
- Available after: The first date for the item to display to students
- Available until: The last date for the item to display to students

### Forum Items

For Forum items, you will asked to provide:

- Name: The name of the forum
- Description: A description of the forum (displays on course page)
- Available after: The first date for the item to display to students
- Available until: The last date for the item to display to students
- Group linked: If you have a group assessment, you can link the forum to the groups of that assessment. If you do this, students viewing the forum will only see posts from their group members and instructors. Be aware that posts to group linked forums often won't trigger the red "New Posts" flag on the home page.
- Allow anonymous posts: Whether you want to allow students to post anonymously
- Allow students to modify posts: Whether you want students to be able to modify their posts
- Email notify: Whether you want to receive an email whenever a new post is made on the forum
- Default display: Whether you want threads to display Expanded, Collapsed, or in Condensed format by default. Users can change the display once they view the thread
- Students can reply by: Optionally set date restrictions for students replying to posts. Can be overridden in individual threads.
- Students can create new threads by: Optionally set date restrictions for students creating new threads
- Count in gradebook: Whether you want the forum to count in the gradebook for points. You will be able to assign points for individual posts made.
- Gradebook category: Category for the gradebook, if assigning points to the forum.

When you as a teacher start a new thread, you are given the option to have it be:

- A regular post
- Always display at the top of the list
- Displayed at top and locked (no replies can be made)
- Displayed at top and replies are hidden from students

You can use the middle two options to, for example, post discussion instructions. You can use the last option to post a question in class, and have students respond without seeing other students' replies.

When viewing the forum thread list as an instructor, there is a "List Posts by Name" link which will list all posts in the forum, grouped by student name. New threads are colored in black, replies in green

### Assessments

Warning: Making changes to an assessment after students have already taken it can seriously mess up those students' assessment results. It is NOT safe to change: Default points per problem or Default penalty.

#### Assessment Settings

You need to set the assessment settings when you add an assessment. You can change these settings by clicking the "Modify Settings" link next to the assessment in the course page.

- Name: The name of the assessment
- Summary: A description of the summary (shows on course page)
- Intro/Instructions: Displays at the top of the test (see below for details on making question-specific instructions)
- Available after: The first date for the item to be available to students
- Available until: The last date for the item to be available to students. Students must complete the assessment by this date - they will be kicked out if they are in the middle of an assessment when this time is reached.
- Available for review: If the checkbox is clicked, the assessment will convert to review mode after the due date until this date. Review mode defaults to Skip Around display, unlimited attempts, answers shown always. Scores are not saved in Review mode.
- Count: Whether the assessment score should be counted in the gradebook, not counted in the grade total, or counted as extra credit.
- Copy Options From: If you have other assessments in your course already, you can select to copy the assessment settings from another assessment.
- Password: If specified, requires student to enter this password to access the assessment. Leave blank to require no password.
- Time Limit: The time limit, in minutes, for the test (0 for none). If the student exceeds the time limit, their test will be recorded, and you can decide whether or not to accept it in the gradebook detail. Partial minutes are possible using decimal values. If you check the "Kick student out at timelimit" box, then the assessment will automatically finalize at the timelimit, and submission attempts after the timelimit will be rejected.
- Display method:
  - Full test at once: All questions are displayed on one page
  - One question at a time: One question is shown at a time. Students must complete the questions in the order presented
  - Full test, submit one at time: Full test is displayed, but student submits answer to one question at a time. Student can skip between questions.
  - Skip around: Students are provided with a navigation bar and can jump between questions and complete them in any order
  - Embedded: Similar to "Full test, submit one at time", but all questions are always active, and any one can be submitted at any time. Questions can be embedded into the Intro/Instructions using [QUESTION #] tags.
- Default points per problem: How many points each problem should be worth by default. This can be changed for individual problems.
- Default attempts per problem: How many attempts a student should have at each problem by default. This can be changed for individual problems. Enter 0 for unlimited attempts
- Reattempts different versions: Reattempting a problem will regenerate the question with new numbers. By default, reattempts of problems receive the same version of the problem. This option does not make sense to use with Homework mode.
- Default penalty per missed attempt: What percentage of points possible a student should lose for an incorrect attempt. This can be changed for individual problems. You can select a penalty for each missed attempt, to start after a certain number of missed attempts, or specify a penalty for the last possible attempt only.
- Feedback method: What detail the students should see
  - No scores shown: No scores, including the total, are shown to the student. If reattempts are allowed, the student is forced to retake all questions (even ones they got right the first time). With this mode, access to grade detail in the gradebook controlled by the Show Answers setting.
  - Final score: Only final (total) score is shown at the end. If reattempts are allowed, the student is forced to retake all questions (even ones they got right the first time). With this mode, access to grade detail in the gradebook controlled by the Show Answers setting.
  - Show score on each at end: At the end of the test, the student is shown their score on each question. If reattempts are allowed, they are then allowed to go back and reattempt problems.
  - Show as submitted: As each question is submitted, the score is shown, and students are offered a chance to reattempt the problem (if allowed). This method does not apply to the "Full test at once" display method.
  - Practice Test: Same as above, and the test can be regenerated (re-randomized) whenever the student wants. Students are given an opportunity to try similar problems to the one presented after completing each question (when not in Full test at once mode). Scores are cleared each time the test is regenerated, and scores are not shown by default in the gradebook. Answers can be shown after some number of attempts.
  - Homework: Like "Show as submitted", but students are given an opportunity to attempt a similar question if they miss a question. Doing so resets attempts for that question (reseting attempt penalty as well). Also, show answers (see below) can be set to show answers during the homework after a number of attempts. This is best used in conjunction with the attempt penalty.
- Show Answers: When (if ever) students should be able to see answers.
  - Practice Tests and Homework: For practice tests and homework, you can set this to never, after 0,1,3,4,or 5 attempts are made, or after last attempt. There is also an after last attempt option that will allow students to jump directly to the answer.
  - Other Tests: For other tests, you can set this to never, after the assessment due date, after the last last attempt (in Skip Around and Full test submitted one at time modes only), or immediately. Answers will be available in the gradebook review of a test. Note: Do not use the "Immediately" option if you are allowing multiple attempts per problem. Doing so would allow a student to complete the test, view the answers, then reenter the test (since more attempts are allowed) and put in the correct answers. Also be aware that if an assessment is set to allow review mode, that answers will be available to students in review mode.
- Show hints when available: Whether or not to show hints if the question has them defined
- Allow use of LatePasses: If you have granted LatePasses to students, this will allow use of them on this assessment
- Make hard to print: Makes the assessment harder to print, for in-class tests
- Shuffle item order: Randomizes the order in which questions are presented
- Gradebook Category: If you have created gradebook categories, you can assign the assessment to one of those categories.
- Count: Whether to count the assessment in the gradebook
- Allow tutors to edit: Whether tutors should be able to change students' scores on this assessment
- Minimum Score for Credit: A minimum score which must be acheived to receive credit for the assessment. Set to 0 to accept all scores. If set and score is not met, gradebook will display "NC" (No Credit).
- Show based on another assessment: Use this to hide this assessment until a specific score is acheived on another assessment. Provide a point value and select an assessment to use this feature. Set the assessment to "Don't Use" to not use this feature
- All questions same random seed: Usually not needed. This is only need for a set of questions designed to work together using the same random values
- All students receive same version of questions: All students receive the same first version of questions. If in practice test or homework mode, when students request a similar problem, different students will receive different versions of the questions.
- Penalty for questions done while in exception/LatePass: A percent penalty to take on all questions submitted after the original assignment due date while under a due date exception.
- Is group assessment?: Allows students to specify group members for the assignment. All group members will receive the same score for the assignment
- Show question categories?: If you plan to categorize questions and would like the categories displayed while the student is taking the test, you can select that option here
- LTI access secret: An access code to place this assessment in a BasicLTI-compliant consumer. More info

Qustion-specific instructions (deprecated)

Note: The following approach is deprecated, and no longer recommended. Using the [+Text] button on the Add/Remove Questions page instead to insert text between questions.

In the Intro/Instructions box, you can make question-specific instructions by putting a tag of the form [Q #] or [Q #-#] before the text specific to that question or range of questions. Here is an example:

This is the general info

[Q 1]

This text will display before question 1

[Q 3-4]

This text will display before questions 3 and 4. Since there was no tag for question 2, it will display directly after question 1, with no associated intro text. Likewise, if there was a question 5, it would display directly after question 4 with no associated intro text.

#### Adding Questions to an Assessment

You can add existing questions to an assessment by clicking the "Select Library" button to choose libraries to search, then the "Search" button to list potential questions. Leave the "Search" entry blank to list all questions in the libraries selected. The checkboxes can be used to search in all libraries (not just the selected ones), list only questions you own, or exclude questions you've already added to your assessment.

From this list you can:

- Use the checkboxes to select questions, then click the "Add (using defaults)" button to add the questions. Adding this way will use the assessment default settings for points, attempts allowed, and penalty per attempt. You can change these later by clicking the "Change Settings" link.
- Use the checkboxes to select questions, then click the "Add" button to add the questions. Adding this way will allow you to override the default settings for points, attempts allowed, and penalty per attempt if you wish, and add a question multiple times.
- Choose "Add" from the Action dropdown. This will allow you to change the default question settings
- Choose "Use as template for New Question" from the Action dropdown. This will create a new question based upon the existing question. This allows you to avoid rewriting a question from scratch if a similar question exists
- Click "Preview" to preview the question

Alternatively, you can click the "Select from Assessments" button to choose questions from existing assessments. In this mode, select the assessments you wish to pull questions from and click "Use these assessments". Then select the questions you wish to use.

Once added to the assessment you can:

- Reorder Questions: Using the number selectors next to each question will allow you to rearrange the order of the questions. This is only useful if you are not shuffling the question order
- Group Questions: Use the checkboxes to select questions, then press the "Group" button to group questions. Then you can specify how many questions from the group you want the system to randomly assign to students, and whether to make that selection with or without replacement.
- Change Settings: Override the default settings for points, attempts allowed, and penalty per attempt, if desired. When done for one question using the "Change Settings" option in the Action dropdown there are more settings you can edit than when using the checkboxes and the "Change Settings" button.
- Edit Code: In the Action Dropdown. Change the question code or wording, if it is your question
- View Code: In the Action Dropdown. View the question code, if it is not your question
- Edit Personal Copy: In the Action Dropdown, if it is not your question. Creates a copy of the question, and will trade out the original question for your personal copy.
- Template: In the Action Dropdown. Create a new question based on this one. The original will not be removed from the assessment.
- Remove from assessment: From the Action dropdown, or use the checkboxes and press the "Remove" button. Removes the question(s) from the assessment. This does not delete the question itself.

##### Icons used in question listing

- Has a video help (if is shown, the video has captions)
- Has help resource
- Has a written solution
- Has "show work" enabled
- Has a rubric associated

##### Adding an Introduction to a Question

In addition to the assignment Introduction, each question can have an individual introduction. A common example is to display a video and then a related question as part of a video assignment.

To add a question introduction, click on + Text below the last question. An editable text box will appear where you can write instuctions or drag in a video link. After you edit your text, click the Save All icon in the editor toolbar. You can expand/collapse each question intro by clicking the Expand and Edit or Collapse icons in the lower right of the question intro. Once you modify a question intro, you'll need to save it to collapse it.

When you click Save All, all changes you have made in any other question intros will also be saved. If you leave a question intro with unsaved changes, the Save All button will be highlighted.

A question intro can be displayed for multiple consecutive questions (except on Embedded assignments). In the Show for selector, select the number of questions that question intro should be used for.

Embedded assignments can include page titles. Check the New Page checkbox to add a page title. Then add your title in the editor and save it.

Below the last questions is an Expand All button which will expand all the question intros. Click on any one to edit it.

##### After the Assessment has been Taken

If students have taken the assessment, you will not be allowed to make as many changes to the assessment, as it will mess up existing student attempts. If you need to change the assessment a lot, you can clear all student attempts. Otherwise you can change individual question settings (be careful!) or edit the question if it's yours. If there is a problem with the question, you modify it, and want to give students another chance on that question, you can clear all attempts on a single question by clicking the "Clear Attempts" link here

#### Adding New Questions

Click the "Add New Question" to write a new question from scratch, then add it to the assessment. See the help section on Writing Questions for help on writing new questions

#### Categorizing Questions

After adding questions to an assessment, click the "Categorize Questions" button to categorize the questions in the assessment. Categorization allows you and students to see a score breakdown by question category.

In the question categorization page, you will see each question listed, followed by a category pull-down. By default, the list contains the names of all libraries containing the question. If you'd like to define a category not in the lists, type in the new category name in the box provided and click the "Add Category" button. The new category name will now appear in the pull-down lists next to each question, and can be selected to assign the question to that category. When you are done, click the "Record" button.

#### Making Print Copies

After adding questions to an assessment, click the "Create Print Version" to layout your assessment for printing.

On the first page, you will be asked what you would like to include in the test header. You will also be asked to enter your print margins setup. These can be found by choosing "Page Setup" from the "File" menu in your browser. In the Page Setup you may also wish to remove the default header and footer materials included in printouts by your browser.

On the next page, you will see alternating blue and green rectangles indicating the size of pages. Use the resizing buttons next to each question to increase or decrease the space after each question until the questions fall nicely onto the pages. You can use Print Preview in your browser to verify that the print layout looks correct. After you have completed the print layout, you will be given the chance to specify additional print options. Longer questions, such as those with graphs, may appear cut off in the print layout page. Be sure to resize those questions to show the entire question.

On the next page, select how many versions of the test you would like to generate, and whether you'd like to generate answer keys. After hitting continue, you print version of the test will be displayed. Choose Print in your browser to print your tests.

## Quick View

Quick view is a condensed view of the course page. You can use it to quickly look over your entire course. It is more useful for major editing

It allows easy drag-and-drop reordering of course items. Changes will not be recorded until the "Record Changes" button is pressed.

You can also quickly rename items by clicking on their titles and changing the text. Again, changes will not be recorded until the "Record Changes" button is pressed.

When done in quick view, click the "Return to regular view" link to get back to the regular course page

## Calendar

The calendar can be accessed from the course navigation bars, or by embedding the calendar on your course page. The calendar autopopulates with assessment item due dates, and discussion forum post-by and reply-by dates. Text items have options to place them on the calendar. The calendar displays with the current date on the top line; you can jump later in the future or look in the past using the "< <" and "> >" links above the calendar.

You can add additional items to the Calendar using the "Manage Events" link on the calendar. All items to be placed on the calendar need a date, a description, and a single letter or symbol tag that will show on the calendar

## Question Set Management

### Manage Question Set

Clicking the "Manage Question Set" link will allow you to search through the Question Set, modify questions, add questions, remove question, transfer ownership, or add a set of questions to a question library. Only administrators or question owners have the rights to remove a question. Be aware that if you remove a question that is currently being used in an assessment (as shown in the "Times Used" column), it will mess up that assessment.

The options available in the question set manager are:

- Modify: Change the source code of the question and make library assignments. You will only see this option for questions you own or when the owner has given permission for anyone to modify the question.
- View: View the source code of the question and make library assignements. You will only see this option for question you do not own.
- Template: Create a new question, using the code of an existing question as a starting point. When you template a question, the original question is not changed.
- Delete: Delete the question completely from the questionset and all libraries. You will only see this option for questions you own or when the owner has given permission for anyone to modify the question. You can delete many questions at once by selecting questions with the checkboxes, then clicking the Delete button near the top of the page.
- Transfer: Transfer ownership of the question to another user. You will only see this option for questions you own. You can transfer many questions at once by selecting questions with the checkboxes, then clicking the Transfer button near the top of the page.
- Library Assignment: The Library Assignment button near the top of the page can be used with the checkboxes to add or change your library assignments for the selected questions. This will not affect other people's assignments

Note that the assignment of questions into libraries can be done by anyone, but only the person who made the assignment is able to remove the question from the assigned library

### Export Question Set

Use the "Export Question Set" feature to export a portion of the Question Set for backup or sharing. Use the search feature with the checkboxes to select questions for inclusion in the export. Clicking the "Finalize" button, you will be asked for a Library Description.

### Import Question Set

Use the "Import Question Set" feature to import a Question Set that you or someone else had exported from IMathAS. Be sure to only import question sets from trusted sources. After specifying an import file, you will be given a chance to select specific questions from the set to be imported.

Imported questions will have ownership assigned to the importer. Select the userights you want to apply to all imported questions. You can import the questions directly into an existing library, or into the Unassigned library for later assignment.

If any questions (identified by a unique id) already exist in your system, you will be asked if you want to update the existing questions, or add as new questions. If you have modified questions previously imported, you may want to add as new.

## Library Management

### Manage Libraries

Use the library manager to remove, rename, change rights, change parent, or transfer ownership of question libraries. Be aware that if a library is deleted, the questions in that library will become unassigned; they are not deleted.

Libraries have a tree structure, where each library has a parent library. When you add or modify a library, you can change it's parent library. If you change a library's parent, all children library move with a library. You can only specify an empty library or existing parent library as a parent.

Libraries have use rights. Options are:

- Private: Only the owner or an administrator can list questions in these libraries
- Closed to group, private to others: Anyone in group can list and use questions, , but only the owner or an admin can add questions to the library. Hidden to anyone outside the group.
- Open to group, private to others: Anyone in group can list and use questions and add to the library. Hidden to anyone outside the group.
- Closed to all: Everyone can list and use questions, but only the owner or an admin can add questions to the library
- Open to group, close to others: Anyone in group can list and use questions and add to the library. Outside the group, users can only list and use questions; they cannot add questions to the library
- Open to all: Everyone can list and use questions and add to the library

With library rights, child rights take precedence over parent rights. For example, if an open library is a child to a private library, the parent will not be hidden from other users. However a private library as child to a private parent will be hidden from other users.

Depending upon the system configuration, non-admins may be limited to creating libraries that are private to others outside their group. If this is the case, a non-admin will need to contact an admin to create a library that is closed or open to all.

Library assignments are done in question management. Library assignments can be done by any user, but only the person who made the assignment can remove that assignment.

### Export Libraries

Use the "Export Libraries" feature to export an entire library or tree of libraries for backup or sharing. Use the tree to select libraries to export. Note that if a parent library is selected, it's children libraries are automatically included in the export, and heirarchy will be maintained. If libraries from different trees are selected, the topmost libraries in each branch selected will be exported at the same level.

### Import Libraries

Use the "Import Libraries" feature to import an entire library or tree of libraries. After selecting a file, the tree of libraries in the import file will be shown, and you can deselect libraries you do not want to import. Note that if a parent library is not selected, NONE of the children libraries will be added, regardless of whether they're checked or not.

You will be asked if you want to update existing questions/libraries, or add as new. If a library or question (identified by a unique id) in the import already exists on your system, this will tell the importer whether to update the existing libraries/questions, or import the libraries/questions as a new copy (a new unique id is assigned). If you have modified questions previously imported, you may want to add as new. Note that only the original importer can update questions they imported.

Imported libraries and questions will have ownership assigned to the importer. Select the userights you want to apply to all imported questions and libraries. You can select a parent in the library tree for all (top level) imported libraries

If you load a file that does not have a library tree embedded in the file, you will be told to use the Import Question Set feature instead. Even if a file has a library tree, you can use the Import Question Set feature to import specific questions from the file.

## List Students

Use the "List Students" link to list the students in your class. On this page you can import (register and enroll) students from a file, enroll a student (already registered) with a known username. This is the easiest way to add a guest user to your class. Note that the "Last Login" date shows the last time the student logged into IMathAS, not necessarily the last time they accessed your course.

The List Students page also gives you access to student email addresses, as well as a link to send out a mass email or message to all students

### Exceptions

Click the "Make Exception" link to change the Start or End date of an assessment for a single student. If you need to make exceptions for multiple students at once, or want to make exceptions for multiple assessments at once, use the "Make Exception" button in connection with the checkboxes in the Gradebook.

### Resetting Passwords / Changing Info

Use the "Chg Info" link to reset a student's password, update their email address, username or full name, or change their section or code. You can also lock the student out of the course on this page. Doing so will display a message to the student that they need to see their instructor to regain access to the course. On this page you can also set a time limit multiplier for students needing extra time on timed assessments. Setting the multiplier to 1.5 would give the student 1.5 times the usual timelimit for all assessments.

### Unenrolling

Use the "Unenroll" link to unenroll a student from the class, or the "Unenroll All" button to unenroll all students. This can be useful to clear out a classroom at the end of a term. Unenrolling all students will also delete all regular posts from the course's forums.

### Import Students from File

Use the Import Students from File feature to register and enroll a set of students automatically from a CSV (commas separated values) file. You can generate a CSV file using any spreadsheet program.

The form will guide you through specifying which columns of the CSV file contain First name, Last name, email address, and desired username. Once setting these options, the first five rows of the file will be displayed so you can verify that the import settings are correct. The students will be both registered and enrolled in the current class upon submission.

### Assigning Section and/or Code Numbers

Click the "Assign section and/or code numbers" link to assign section or code numbers to students. These only serve for identification purposes, the the gradebook will be sorted first by section, then by name. Section can be alphanumeric; code number must be numeric, up to 4 digits.

### Manage LatePasses

Click the "Manage LatePasses" link to give students LatePasses. Students can redeed a LatePass for an extension on an online assessment without your intervention, provided you have clicked the "Allow use of latepasses" option in that assessment.

On this page you can also define the number of hours extension a LatePass will grant

### Manage Tutors

Click the "Manage Tutors" link to manage tutors for your class. Tutors can have an instructor account or student account. Tutors will be able to view students' scores and online assessments. If given permission, tutors can edit or enter online or offline scores.

Add tutors by listing their usernames in the box provided. Remove tutors by clicking the "Remove" checkboxes next to tutors and clicking Update

Once tutors are added, you can limit them to a single section of the course. If selected, tutors will only be able to see scores for students in the section they're limited to. This can be used in conjunction with the diagnostic system, since second-level selections become the student's section identifier

## Gradebook

Click the "Gradebook" link to show the gradebook. The gradebook shows each student's score on each assessment and any offline grades you've entered. Click on a student's assessment score to show detail on their assessment attempt, or on a student's offline grade to change their grade. Click the Settings link in the table header if you need to change an assessment's settings. Click on an assessment's average score to view an breakdown showing the average score on each question. Click on an offline grade's average score or the Settings link in the table header to change the settings for that item or modify all students' grades at once.

By using checkboxes next to student's names, you can send messages or emails to multiple students, or make due date exceptions for multiple students at once

### Gradebook Settings and Categories

Click the "Gradebook Settings" to change Gradebook settings and create or modify categories. This allows you to create a grading scheme.

Your overall settings are:

- Calculate total using: Select "points earned" to use a points earned out of points possible grading scheme. Select "Category weights" to assign a percentage weight to each category in calculation of total grade.
- Gradebook display: Select whether to order the gradebook by item dates (Available until dates for assessments, Show After dates for offline grades) or if you want to group items by category

The next section lets you define categories. There is always the "Default" category, but it will not display if there are no items assigned to it. To add a new category, click the "Add Category" link to add a new line to the table, then fill in the name and other info, then click "Update"

For each category, you can specify:

- Name: The name of the category
- Scale (optional): Scale the category total by specifying a point value or percent value to be scaled up to 100%. For example, if the category point value was 80 points, and a student earned 50 points, their category total would be 50 points. If you specified a scale of 60 points, then the students grade would become 80*(50/60) = 66.7 points out of 80. You can specify whether grades that would end up over 100% should be chopped to 100%. You can specify no scale by leaving the Scale box blank.
- Drops (optional): You can specify whether to drop the lowest N scores, or keep the highest N scores from the category. Set the number to 0 to keep all scores.
- Weight/Fix Category Point Total: If you are using a "Category Weights" grading scheme, enter the percent weights for each category here. If the category percents don't add to 100%, they are all scaled equally so they do add to 100%. If you are using a "Points earned" grading scheme, you can fix the point value for the category here (optional). For example, if the current category total is 50 points and a student earns 40 points, if you specified a fixed point value of 100 points, the students score would become 80 points. Leave this blank to use the actual category point total.
- Remove: When you remove a category, any items currently assigned to that category will be assigned to the Default category

### Offline Grades

To add an offline grade, click the "Add Offline Grade" link on the gradebook page. You can specify:

- Name: The name to give the grade item
- Points: The number of points possible on the item
- Show to students after: The date after which to show the item to students
- Gradebook Category: The gradebook category you wish to assign the item to
- Count: Whether to count the score in the gradebook total, not count it, or count it as extra credit
- Allow tutors to edit: Whether tutors should be able to edit scores for this item

You can then enter grades for each student. If you leave a grade blank, no grade will be recorded for that student. You can edit these settings or edit all students' grades at a later time by clicking the "Average" in the gradebook for this item. You can edit an individual student's grade by clicking on their score in the gradebook for this item. You can leave feedback for students about their grade using the boxes provided.

You can manage offline grades by clicking the "Offline Grades: Manage" link on the gradebook page. This page allows you to delete, change the availability, or change the gradebook assignment of a set of offline grade items.

### Gradebook Detail

When you click on a student's score in the gradebook, you will see the specific assessment that they received and the last answer they provided, as well as their score on each question and the attempts used. You can override the scores they received on this page. You can also send a student a message about a question, quoting their version of the question in the message. At the bottom of the page is a box to leave the student feedback about the assessment.

If you wish to give a student another chance to take an assessment, click the "Clear Attempt" or "Clear Scores" link. Note: This will clear their current scores, answers, and attempts used. The "Clear Attempt" link will make it appear the student never started the assessment, and the student will receive a different version of the assessment when they access the assessment. The "Clear Scores" link will clear the student's scores and attempts to 0, but the student will receive the same version of the assessment when they access it.

If you categorized the questions in the assessment, you will also see a category breakdown at the bottom of the details page

## Student Groups

The Student Groups page allows you to manipulate student groups associated with assessments that you have designated as group assessments. When you first access this page, you will be presented with a list of group assessments. Select the assessment you want to modify groups for

You will be presented with a list of groups (the group number is arbitrary) with the students in each group. To separate a student from the group, click the "Break from Group" link.

At the bottom of the page is a list of students not assigned to a group. If you wish to assign students to groups, click the checkboxes next to the students' names. In the "add to group: " pulldown, select the group you want to add the students to, or select "New Group", and click Add

When students are broken from the group, they retain the version of the assessment and progress the group had acheived before you broke them from the group. If a student is added to a group, any work they've already done is lost and replaced with the group's version and progress. Any changes to an assessment made by one group member affects all group members.

## Messages

The message system allows you to send a message to students in the class. This is an internal message system; it is not emailed unless the student has requested email notification.

Click Send New Message to send a new message to a student. If you want to send a message to multiple students, use the "List Students" page. Select a student from the pull-down list, and type your message.

When viewing messages, you can either Reply to the message, or use the "Quote in Reply" option to quote the original message in your reply.

## Copy Course Items

Course Item Copy allows you to copy items in your course or an entire course structure, or copy items from another instructor's course. Note that item structure, items, and settings are exported, but not students, assessment attempts, or forum threads.

On the first page, select a course to copy from. If you select a course that is not one of your own courses, you must enter the course Enrollment Key as verification that you have received permission to copy from the course.

On the second page, select the items you wish to import. If you export an item currently contained in a block and do not export the block, the item will be exported as an item on the main course page.

You can optionally append words to the end of the title of each item, or place the copied items into an existing block.

You can optionally also specify to copy the course settings (the items you'd set under Modify on the Admin page), or copy the gradebook scheme and gradebook categories. Copying the gradebook scheme will overwrite the existing gradebook scheme in your course. Copying the gradebook scheme will also retain any category assignments for the assessments you're copying.

## Change Dates

The Change Dates page allows you to change the dates for all your course items on one page. On this page you will see a list of your course items, with inputs for start date, end date, and review date (for assessments). You can filter the list to only show one item type using the Filter selection at the top of the page, and you can change the sort order to sort by start date, end date, or name.

If you change dates on any line and click the "Send down list" button on that line, the date change will be made to all items below that item in the list. For example, if you add one day to an item and click "Send down list", one day will be added to all items lower in the list. By default the system only allows Monday-Friday dates; you can switch to a 7-day week by unchecking the "Shift by weekdays only" checkbox

## Change Assessments

The Change Assessments page allows you to change assessment settings for many assessments at the same time. Begin by selecting all the assessments you want to change settings for using the checkboxes next to each assessment's name

Select which options you want to change by clicking the checkbox in the "Change?" column, then adjust the setting in the "Option" column. When you are done, click "Submit"

## Import/Export Course Items (for another IMathAS system)

Course Item import/export allows you to share a course setup with other instructors, or copy a class for yourself. Note that item structure and questions are exported, but not students, assessment attempts, or forum threads.

On Export, start by selecting the items you wish to export. If you export an item currently contained in a block and do not export the block, the item will be exported as an item on the main course page. There are options on whether or not to include course and gradebook settings in the export.

On Import, first provide the import file. If there are assessment questions that do not already exist on your system, they will be added to the system. Select the library into which these questions should be imported. If a question already exists, you can select whether to update the existing question with the import question (if it is newer), or create a new copy of the question in the designated library. Select the items to import, and click "Import Items".

## LTI Integration

IMathAS can be used as a LTI tool using a course-level configuration or a global college-wide configuration.

Key Types

For a course-level configuration, your LTI key will take the form LTKkey_###_#. The first number, ###, is your course ID. The last number determines how authentication is handled. If that last digit is 0, then when the student accesses the LTI placement, the first time they will be asked to sign into their IMathAS account or create one, and that account will be linked with the account at the host LMS. From then on, when the same student accesses any LTI placement, they will not need to sign in again. They will be able to sign in directly to IMathAS as well.

If the last digit of your LTI key is 1, then a student account will automatically be created the first time a student accesses the LTI placement, and that account will be linked with the host LMS account. The student will not be provided an IMathAS username or password, so they will only be able to access IMathAS resources through the LMS LTI placements.

Note that grade return ONLY works reliably with the _1 type keys, so that type of key is recommended.

LTI Connection Options

IMathAS supports several types of LTI integration, including whole course single-signon, and new links created from the LMS.

The recommended integration technique is to setup individual LTI links for each assessment. This is necessary if you want the grade to be returned from IMathAS to your LMS. The easiest way to set up LTI links in the LMS is to use the Export feature in IMathAS to create links and import those into your LMS. To do this, go to Course Items -> Export, select the items you want to export, your LMS, and Download the CC Export. Then follow the appropriate instructions below.

Alternatively, you can manually create individual links to assignments, or you can create a single link that launches your entire IMathAS course. Be aware that in many LMSs, manually created links to assignments will lose their association with IMathAS assessments when the course is copied in the LMS, so using the Import process is recommened when supported by the LMS.

IMathAS can also be an LTI consumer, using the External Tool option for Link items.

### Canvas Integration - Using Import

Go to Course Items → Export, select the items you want to export, select your LMS, and Download the Export Cartridge

To import the cartridge in Canvas:

- Go to Settings, then Import Course Content
- For Content Type, select Canvas Course Export Package. Select the export file from your computer, and select All Content. Click Import.
- If you have a global college-wide key and secret, you do not need to set up a course-level configuration. If you need to set up a course level configuration, in your Canvas course:
  - Go to Settings, then Apps, then View App Configurations
  - Locate for the IMathAS App. Use the gear icon dropdown to select Edit
  - For the Consumer Key, enter: `LTIkey_####_1`, where #### is your Course ID
  - For Shared Secret enter the secret you set up in your Course Settings
  - Click Submit

Next you will need to establish the connection between your IMathAS course and Canvas course

- In Canvas, click one of the assessment links in your course.
- If this is your first time using this key and secret, IMathAS will ask you, the teacher, to sign into your IMathAS account. This is necessary to establish a connection between your LMS account and your IMathAS account. You will not need to do this step again, and students will not be asked to sign in and will not need a IMathAS account.
- Follow the prompts to associate the LMS course with your existing IMathAS course or create a copy.
- Once complete, all the LTI links in your LMS should work.
- Be aware:
  - Links, files, forums, and and text items were imported into your LMS. Changing them in IMathAS will not change them in your LMS
  - If you change assessment settings or the questions in an assessment in IMathAS, those changes will show up when the assessment is launched from the LMS
  - If you change due dates in IMathAS, they will be enforced by IMathAS, but the due dates in the LMS will not automatically be updated. However, there is a course setting to allow Canvas to set the due dates in IMathAS.
  - Any new items added in IMathAS, including new assessments, will not automatically show up in the LMS; you would need to repeat the export/import process.
  - If configured, grades will be sent from IMathAS to the LMS immediately every time the student completes a question, but the LMS may delay updating the grade.

Note: When configuring a course-level configuration, the use of a key in the form `LTIkey_###_1` is recommended. With this type of key, students will not have or need a username for IMathAS, and they must access assignments via the LMS. This is usually desired when doing integration, and is necessary to ensure grades are passed from IMathAS back to the LMS. If, however, you are not interested in grade return, and simply want to provide single-signon from your LMS into IMathAS while allowing direct login to IMathAS as well, then you can use a key of the form `LTIkey_###_0` instead. This will require students to have or create an account on IMathAS, which they'll have to log into once to establish the connection.

### Canvas Integration - Manual Process

If you have a global college-wide key and secret, you do not need to set up a course-level configuration. If you need to set up a course level configuration, in your Canvas course:

- Go to Settings, then click the Apps tab
- Click on View App Configurations, then the +App button
- For Configuration type, select "By URL"
- For Name, enter IMathAS, or whatever you'd like
- For Consumer Key, enter: `LTIkey_####_1`, where #### is your Course ID
- For Shared Secret enter the secret shown in your IMathAS Course Settings
- For the Config URL, enter `https://yourIMathASsite/canvas.php`
- Click Submit

To create a link to an individual assessment, in Canvas:

- Go to the Assignments page, and click +Assignment
- Under Submission Type, select "External Tool"
- Click on the "Find" button, then on the IMathAS tool (or whatever name you used when you created the tool)
- If this is your first time using this key and secret, IMathAS will ask you, the teacher, to sign into your IMathAS account. This is necessary to establish a connection between your LMS account and your IMathAS account. You will not need to do this step again, and students will not be asked to sign in and will not need a IMathAS account.
- If this is your first link from this course, IMathAS will ask you to select the IMathAS course you want to connect your LMS course with.
- Select the assignment you want to link to, and click Make Placement.
- Click the Select button
- Finish setting up the assignment in Canvas
- Assignments set up this way will receive grade return from IMathAS

To create a single link to your entire IMathAS course, in Canvas:

- On the Modules page, click on the + button inside a module
- In the "Add" dropdown, select "External Tool"
- Click on the IMathAS tool (or whatever name you used when you created the tool)
- If this is your first time using this key and secret, IMathAS will ask you, the teacher, to sign into your IMathAS account. This is necessary to establish a connection between your LMS account and your IMathAS account. You will not need to do this step again, and students will not be asked to sign in and will not need a IMathAS account.
- If this is your first link from this course, IMathAS will ask you to select the IMathAS course you want to connect your LMS course with.
- Select "Whole Course Placement" and click Make Placement.
- Click Add Item
- Note that there is no grade return from IMathAS from a whole course placement.

### Blackboard Integration - older Common Cartridge Instructions

Go to Course Items → Export, select the items you want to export, select your LMS, and Download the Export Cartridge

To import the cartridge in BlackBoard:

- Go to Packages and Utilities, then Import Package
- Click Import Package
- Select the export file from your computer, click Select All to select all course materials, then click Submit.
- If your school has a global key and secret setup, skip ahead. If you need to set up a course-level configuration, follow these steps.
  - To to Packages and Utilities, then Manage LTI Links
  - If the links are listed as Working, then you have an existing configuration, and do not need to continue.
  - For one of the links with status listed as Broken, use the drop-down menu that shows when hovering over the link name and select Edit Credentials.
  - For the Tool Provider Key, enter: `LTIkey_####_1`, where #### is your Course ID
  - For the Tool Provider Secret enter the secret you set up in your Course Settings
  - Check the box "Apply these credentials to all links"
  - Click Submit
- To enable grade return, Blackboard requires some additional steps:
  - Return to the main course page in Blackboard.
  - For each assessment link that was imported, use the drop-down menu and select Edit
  - Set the Enable Evaluation option to Yes, specify the points possible (it does not need to match the points possible in IMathAS), and set a Due Date if desired.

Next you will need to establish the connection between your IMathAS course and BlackBoard course

- In BlackBoard, click one of the assessment links in your course.
- If this is your first time using this key and secret, IMathAS will ask you, the teacher, to sign into your IMathAS account. This is necessary to establish a connection between your LMS account and your IMathAS account. You will not need to do this step again, and students will not be asked to sign in and will not need a IMathAS account.
- Follow the prompts to associate the LMS course with your existing IMathAS course or create a copy.
- Once complete, all the LTI links in your LMS should work.
- Be aware:
  - Links, files, forums, and and text items were imported into your LMS. Changing them in IMathAS will not change them in your LMS
  - If you change assessment settings or the questions in an assessment in IMathAS, those changes will show up when the assessment is launched from the LMS
  - If you change due dates in IMathAS, they will be enforced by IMathAS, but the due dates in the LMS will not automatically be updated.
  - Any new items added in IMathAS, including new assessments, will not automatically show up in the LMS; you would need to repeat the export/import process.
  - If configured, grades will be sent from IMathAS to the LMS immediately every time the student completes a question, but the LMS may delay updating the grade.

Note: When configuring a course-level configuration, the use of a key in the form `LTIkey_###_1` is recommended. With this type of key, students will not have or need a username for IMathAS, and they must access assignments via the LMS. This is usually desired when doing integration, and is necessary to ensure grades are passed from IMathAS back to the LMS. If, however, you are not interested in grade return, and simply want to provide single-signon from your LMS into IMathAS while allowing direct login to IMathAS as well, then you can use a key of the form `LTIkey_###_0` instead. This will require students to have or create an account on IMathAS, which they'll have to log into once to establish the connection.

### Blackboard Integration - Using Import

Go to Course Items → Export, select the items you want to export, select your LMS, and Download the Export Cartridge

To import the cartridge in BlackBoard:

- Go to Packages and Utilities, then Import Package
- Click Import Package
- Select the export file from your computer, click Select All to select all course materials, then click Submit.
- If your school has a global key and secret setup, skip ahead. If you need to set up a course-level configuration, follow these steps.
  - To to Packages and Utilities, then Manage LTI Links
  - If the links are listed as Working, then you have an existing configuration, and do not need to continue.
  - For one of the links with status listed as Broken, use the drop-down menu that shows when hovering over the link name and select Edit Credentials.
  - For the Tool Provider Key, enter: `LTIkey_####_1`, where #### is your Course ID
  - For the Tool Provider Secret enter the secret you set up in your Course Settings
  - Check the box "Apply these credentials to all links"
  - Click Submit
- If importing a Common Cartridge, to enable grade return Blackboard requires some additional steps:
  - Return to the main course page in Blackboard.
  - For each assessment link that was imported, use the drop-down menu and select Edit
  - Set the Enable Evaluation option to Yes, specify the points possible (it does not need to match the points possible in IMathAS), and set a Due Date if desired.

Next you will need to establish the connection between your IMathAS course and BlackBoard course

- In BlackBoard, click one of the assessment links in your course.
- If this is your first time using this key and secret, IMathAS will ask you, the teacher, to sign into your IMathAS account. This is necessary to establish a connection between your LMS account and your IMathAS account. You will not need to do this step again, and students will not be asked to sign in and will not need a IMathAS account.
- Follow the prompts to associate the LMS course with your existing IMathAS course or create a copy.
- Once complete, all the LTI links in your LMS should work.
- Be aware:
  - Links, files, forums, and and text items were imported into your LMS. Changing them in IMathAS will not change them in your LMS
  - If you change assessment settings or the questions in an assessment in IMathAS, those changes will show up when the assessment is launched from the LMS
  - If you change due dates in IMathAS, they will be enforced by IMathAS, but the due dates in the LMS will not automatically be updated.
  - Any new items added in IMathAS, including new assessments, will not automatically show up in the LMS; you would need to repeat the export/import process.
  - If configured, grades will be sent from IMathAS to the LMS immediately every time the student completes a question, but the LMS may delay updating the grade.

Note: When configuring a course-level configuration, the use of a key in the form `LTIkey_###_1` is recommended. With this type of key, students will not have or need a username for IMathAS, and they must access assignments via the LMS. This is usually desired when doing integration, and is necessary to ensure grades are passed from IMathAS back to the LMS. If, however, you are not interested in grade return, and simply want to provide single-signon from your LMS into IMathAS while allowing direct login to IMathAS as well, then you can use a key of the form `LTIkey_###_0` instead. This will require students to have or create an account on IMathAS, which they'll have to log into once to establish the connection.

### Blackboard Integration - Manual Process

To manually create a link to IMathAS, in Blackboard:

- Under the Build Content dropdown, select Web Link
- Give the link a Name
- For URL, enter `https://yourIMathASsite/bltilaunch.php`
- Click the checkbox for "This link is to a Tool Provider"
- If you have a global college-wide key and secret, you will not see or need to fill out the following two entries.
  - For Key, enter `LTIkey_####_1`, where #### is your Course ID
  - For Secret, enter the secret shown in your IMathAS Course Settings
- If you are setting up a link to an individual assessment, set "Enabled Evaluation" to Yes, and enter the points possible. Whole course links to not return grades, so there is no need to enabled evaluation for those.
- Click Submit
- If the link you just created shows "(invalid link)" next to the name, they you'll need to ask your BlackBoard administrator to approve LTI connections to IMathAS.
- Click on the link you just created.
- If this is your first time using this key and secret, IMathAS will ask you, the teacher, to sign into your IMathAS account. This is necessary to establish a connection between your LMS account and your IMathAS account. You will not need to do this step again, and students will not be asked to sign in and will not need a IMathAS account.
- If this is your first link from this course, IMathAS will ask you to select the IMathAS course you want to connect your LMS course with.
- Select the assignment you want to link with, or select "Whole Course Placement" if you want a single link to your entire IMathAS course, then click Make Placement.

Be aware assessment links created manually in this way will lose their association with IMathAS assessments when the course is copied in BlackBoard, so using the Export/Import process is recommened if you are creating individual assessment links.

### D2L Brightspace Integration

Go to Course Items → Export, select the items you want to export, select your LMS, and Download the Export Cartridge

To import the cartridge in Brightspace:

- Go to Course Admin, and select Import/Export/Copy Components.
- Select Import Components, and "from a course package"
- Choose the export file and click Import All Components.
- If you have a global key and secret, you can skip ahead. If you need to set up a course-level configuration, follow these steps.
  - Go to Course Admin, and click External Learning Tools
  - Click on Manage Tool Providers. If you do not see this link, then your LMS administrators have blocked your ability to self-configure the connection. You will need to ask for them to set up a global tool provider.
  - Click New Tool Provider
  - For the Launch Point enter the address shown on the Export page
  - For the Secret enter the secret you set up in your Course Settings
  - Click the "Use custom tool information" box if needed
  - For the Key, enter: `LTIkey_####_1`, where #### is your Course ID
  - For the name name, enter: `IMathAS`
  - Click the "Allow users to use this tool provider" if that option is available.
  - Under Security Settings, make sure the following options are checked (it is OK to check other ones as well):
    - Send tool consumer information to tool provider
    - Send context information to tool provider
    - Send course information to tool provider
    - Send LTI user ID and LTI role to tool provider
    - Send user name to tool provider
    - Send user email to tool provider (optional, but recommended)
  - Save

Next you will need to establish the connection between your IMathAS course and Brightspace course

- In Brightspace, click one of the assessment links in your course.
- If this is your first time using this key and secret, IMathAS will ask you, the teacher, to sign into your IMathAS account. This is necessary to establish a connection between your LMS account and your IMathAS account. You will not need to do this step again, and students will not be asked to sign in and will not need a IMathAS account.
- Follow the prompts to associate the LMS course with your existing IMathAS course or create a copy.
- Once complete, all the LTI links in your LMS should work.
- Be aware:
  - LTI assessments may not show in the gradebook columns until a student started working on an assignment.
  - Links, files, forums, and and text items were imported into your LMS. Changing them in IMathAS will not change them in your LMS
  - If you change assessment settings or the questions in an assessment in IMathAS, those changes will show up when the assessment is launched from the LMS
  - If you change due dates in IMathAS, they will be enforced by IMathAS, but the due dates in the LMS will not automatically be updated.
  - Any new items added in IMathAS, including new assessments, will not automatically show up in the LMS; you would need to repeat the export/import process.
  - If configured, grades will be sent from IMathAS to the LMS immediately every time the student completes a question, but the LMS may delay updating the grade.

Note: When configuring a course-level configuration, the use of a key in the form `LTIkey_###_1` is recommended. With this type of key, students will not have or need a username for IMathAS, and they must access assignments via the LMS. This is usually desired when doing integration, and is necessary to ensure grades are passed from IMathAS back to the LMS. If, however, you are not interested in grade return, and simply want to provide single-signon from your LMS into IMathAS while allowing direct login to IMathAS as well, then you can use a key of the form `LTIkey_###_0` instead. This will require students to have or create an account on IMathAS, which they'll have to log into once to establish the connection.

### Moodle Integration

Go to Course Items → Export, select the items you want to export, select your LMS, and Download the Export Cartridge

To import the cartridge in Moodle:

- Under Course Administration (in some versions, the big gear icon in the upper right), select Restore.
- Choose the export file and select Restore.
- Follow the prompts to import the content.
- Turn on editing for your course.
- For one of the assessment, use the Edit dropdown and select Edit Settings.
- If the Launch URL does not display the warning Tool configuration not found for this URL, then you must have an existing key and secret set up, and can skip ahead. If you do see that warning, then follow these steps.
  - Click the + sign located directly after the External tool type pulldown (in some versions, this is labeled Preconfigured Tool)
  - Give the tool a name, like IMathAS
  - For Tool base URL enter the address shown on the Export page
  - For Consumer Key, enter: `LTIkey_####_1`, where #### is your Course ID
  - For Shared Secret enter the secret you set up in your Course Settings
  - Under Privacy, it is recommended to set all options to Always, but it is fine to leave it as Delegate to teacher instead.
  - Save changes
  - The Launch URL should now indicate Using tool configuration IMathAS. Click Save.

Next you will need to establish the connection between your IMathAS course and Moodle course

- In Moodle, click one of the assessment links in your course.
- If this is your first time using this key and secret, IMathAS will ask you, the teacher, to sign into your IMathAS account. This is necessary to establish a connection between your LMS account and your IMathAS account. You will not need to do this step again, and students will not be asked to sign in and will not need a IMathAS account.
- Follow the prompts to associate the LMS course with your existing IMathAS course or create a copy.
- Once complete, all the LTI links in your LMS should work.
- Be aware:
  - LTI assessments may not show in the gradebook columns until a student started working on an assignment.
  - Links, files, forums, and and text items were imported into your LMS. Changing them in IMathAS will not change them in your LMS
  - If you change assessment settings or the questions in an assessment in IMathAS, those changes will show up when the assessment is launched from the LMS
  - If you change due dates in IMathAS, they will be enforced by IMathAS, but the due dates in the LMS will not automatically be updated.
  - Any new items added in IMathAS, including new assessments, will not automatically show up in the LMS; you would need to repeat the export/import process.
  - If configured, grades will be sent from IMathAS to the LMS immediately every time the student completes a question, but the LMS may delay updating the grade.

Note: When configuring a course-level configuration, the use of a key in the form `LTIkey_###_1` is recommended. With this type of key, students will not have or need a username for IMathAS, and they must access assignments via the LMS. This is usually desired when doing integration, and is necessary to ensure grades are passed from IMathAS back to the LMS. If, however, you are not interested in grade return, and simply want to provide single-signon from your LMS into IMathAS while allowing direct login to IMathAS as well, then you can use a key of the form `LTIkey_###_0` instead. This will require students to have or create an account on IMathAS, which they'll have to log into once to establish the connection.

### LTI Integration for Other LMSs - Using Import

Go to Course Items → Export, select the items you want to export, select your LMS, and Download the Export Cartridge. The cartridge is an IMS Common Cartridge format.

Import the cartridge into your LMS. If your school has a global key and secret setup, skip ahead. Otherwise, you'll likely need to configure the LTI connection by providing the key and secret, which can be found on the Course Settings page.

Next you will need to establish the connection between your IMathAS course and LMS course

- In your LMS, click one of the assessment links in your course.
- If this is your first time using this key and secret, IMathAS will ask you, the teacher, to sign into your IMathAS account. This is necessary to establish a connection between your LMS account and your IMathAS account. You will not need to do this step again, and students will not be asked to sign in and will not need a IMathAS account.
- Follow the prompts to associate the LMS course with your existing IMathAS course or create a copy.
- Once complete, all the LTI links in your LMS should work.
- Be aware:
  - Links, files, forums, and and text items were imported into your LMS. Changing them in IMathAS will not change them in your LMS
  - If you change assessment settings or the questions in an assessment in IMathAS, those changes will show up when the assessment is launched from the LMS
  - If you change due dates in IMathAS, they will be enforced by IMathAS, but the due dates in the LMS will not automatically be updated.
  - Any new items added in IMathAS, including new assessments, will not automatically show up in the LMS; you would need to repeat the export/import process.
  - If configured, grades will be sent from IMathAS to the LMS immediately every time the student completes a question, but the LMS may delay updating the grade.

Note: When configuring a course-level configuration, the use of a key in the form `LTIkey_###_1` is recommended. With this type of key, students will not have or need a username for IMathAS, and they must access assignments via the LMS. This is usually desired when doing integration, and is necessary to ensure grades are passed from IMathAS back to the LMS. If, however, you are not interested in grade return, and simply want to provide single-signon from your LMS into IMathAS while allowing direct login to IMathAS as well, then you can use a key of the form `LTIkey_###_0` instead. This will require students to have or create an account on IMathAS, which they'll have to log into once to establish the connection.

### LTI Integration for Other LMSs - Manual Process

If you have a global college-wide key and secret, you do not need to set up a course-level configuration. Otherwise, you will need to set up a course-level LTI configuration. Consult your LMS's help for how to do this; some LMSs configure an LTI took at the course settings level, while some have you enter the credentials with each link.

If you need to set up a course-level LTI configuration, you will need:

- A Consumer/Tool Key: `LTIkey_####_1`, where #### is your Course ID
- A Secret: use the LTI secret shown in your IMathAS Course Settings
- Launch/Tool URL: `https://yourIMathASsite/bltilaunch.php`

The process to set up LTI links varies by LMS, so consult your LMS for details.

Be aware assessment links created manually in this way will lose their association with IMathAS assessments when the course is copied in the LMS, so using the Export/Import process is recommened if you are creating individual assessment links and your LMS supports it.

# Writing Questions

The IMathAS question format is based on PHP.

## Question Parts

A question is formed in several parts:

- Description: A description of the question. This is not shown to students
- Use Rights: The rights you wish to grant other people (you always have full rights). Options are:
  - Private: Only you can use the question
  - Use, no modification: Anyone can use the problem, but only you can modify the problem. Anyone can add library assignments, but cannot remove assignments.
  - Use, allow modification: Anyone can use or modify the problem.
- Libraries: The question libraries you wish to include this question in
- Question type: The type of question.
- Common control: General definitions needed for both display and scoring
- Question control: Definitions only needed for question display
- Question text: The actual question display. This section should be HTML based, but can include variables defined in the common or question control. For convenience, a blank line is automatically interpreted to be a paragraph break. Use of < and > signs are usually handled ok, but use of the HTML &lt; and &gt; are recommended in their place.
- Answer: Code defining the answer

Note: All control code can be placed in the "Common Control" box; the Question Control and Answer sections do not have to be used.

## Basic Control Syntax

Lines of the common control, question control, and answer sections usually take the form of variable definition. In IMathAS, variables are identified with a dollarsign ($) prefix. For example, $a is the variable a. Most lines will take one of these forms:

- $var = number. Example: $a = 3
- $var = calculation. Example: $a = 3*$b*$c
- $var = function. Example: $a = showplot("sin(x)")
- $var = randomizer. Example: $a = rand(-5,5)

Variable Types

There are a few types of variables:

- A number: $a = 15. A calculation like $a = 3^2 will also result in a number
- An array: $a = array(6,8,10). This is a collection of variables. You can reference the parts using an index (note that arrays are zero-indexed), so $a[0] = 6.
- A string: $a = "hi there".
- Boolean: $a = true

Note that numbers are not in quotes, and strings are in quotes. When you use the double-quote mark (") to define a string, you can interpolate variables into the string. Example:

    $a = 3
    $b = 5
    $str = "What is $a/$b"

In this example, $str now contains "What is 3/5".

Note that strings in single quotes will not interpolate variables

As a warning, strings are interpolated literally, so if you had $a = -4 and then defined $b = "$a^2" you would end up with "-4^2", which may not be what you intended. Use explicit parentheses in these cases.

Array assignment

In some cases you want to define several variables at once. There are two ways to do this:

- $var1,$var2 = arrayfunction. Example: $a,$b = diffrands(-5,5,2)
- $ar = arrayfunction. Example: $ar = diffrands(-5,5,2)

In the first example, variables $a and $b each take on a single value. In the second example, the variable $ar is an array; the elements can be accessed as $ar[0] and $ar[1] (note that arrays are zero-indexed). If you use this approach, enclose the variable reference in parenthesis in calculations, like $new = ($ar[0])^2, and in curly brackets inside strings, like $string = "there were {$ar[0]} people".

You can also literally define an array using the "array" function. Examples: $ar = array(2,3,4,5), or $ar = array("red","green","blue")

You can also use a shorthand notation for an array, using square brackets. Example: $ar = [2,3,4,5].

Working with Strings

If needed, you can concatenate (combine) two strings using the . operator. Example:

    $a = "string one "
    $b = "string two"
    $both = $a . $b

Here, $both now contains the string "string one string two"

If you have a long command to type, you can put a "&" at the end of a line to specify it continues on the next line. Example:

    $questions = array("this is choice 1",&
    "this is choice 2")

If defining a string for display, you can put a "&&" at the end of a line to specify it continues on the next line and insert an HTML line break. Example:

    $showanswer = "Do this first. &&
    Then do this."

will be interpreted as:

    $showanswer = "Do this first. <br/>Then do this."

Comments

You can insert comments in your code by starting the comment with two forward slashes: //this is a comment. Typically it's best to put comments on their own line, but they can also be placed after a line of code.

### Conditionals

Any assignment line can be followed by one of two conditional: "where" or "if".

"where" is used to repeat the previous assignment if the condition provided is not met. The "where" condition is almost exclusively used with array randomizers. Example: to select two different numbers that are not opposites:

    $a,$b = diffrands(-5,5,2) where ($a+$b!=0)

"if" is used to make an assignment conditional. For example:

    $a = rand(0,1)
    $b = "sin(x)" if ($a==0)
    $b = "cos(x)" if ($a==1)

Note the use of double equal signs (==) for testing equality. A single equal sign (=) will make an assignment (change the value of $a in this example) and return "true", which is probably not what you intended to do.

Comparison operators available for "if" and "where" statements:

- == Equal to
- != Not equal to
- > Greater than
- < Less than
- >= Greater than or equal to
- <= Less than or equal to

To do compound conditionals, use || for "or", and && for "and". For example:

    $a = nonzerorand(-9,9) where ($a!=1 && $a!=-1)

The "if" condition can also be used before or after a code block like this:

    $a = rand(0,1)
    if ($a==0) {
       $b = 1
       $c = 2
    }

or

    $a = rand(0,1)
    {
       $b = 1
       $c = 2
    } if ($a==0)

When "if" is used before a block of code, it can optionally be followed with "elseif" and/or an "else" statement, like this:

    $a = rand(0,5)
    if ($a==0) {
       $b = 1
    } elseif ($a==2) {
       $b = 3
    } else {
       $b = 2
    }

"where" can also be applied to a block of code:

    {
      $a = rand(-5,-1)
      $b = rand(1,5)
    } where ($a+$b !==0)

### Loops

There are several looping macros (such as calconarray) that can meet most needs. For more general use there is a "for" loop:

    for ($i=a..b) { action }

Here a and b represent whole numbers or variables. Expressions are not allowed.

Examples:

    $f = 0
    for ($i=1..5) { $f = $f + $i }

    $a = rands(1,5,5)
    $b = rands(1,5,5)
    for ($i=0..4) {
      $c[$i] = $a[$i]*$b[$i]
    }

Conditions can be used inside a for loop, but not outside without explicit blocking

    for ($i=1..5) {$a = $a+$i if ($i>2) }     WORKS
    for ($i=1..5) {$a = $a+$i} if ($a>2)     DOES NOT WORK
    {for ($i=1..5) {$a = $a+$i} } if ($a>2)    WORKS

## Randomizers

Note on macros: The descriptions below explain macros available and the arguments the functions should be called with. Arguments in [square brackets] are optional arguments, and can be omitted.

For all randomizers, all bounds (min,max) are inclusive.

Single result randomizers:

- rand(min,max): Returns an integer between min and max
- rrand(min,max,p): Returns a number between min and max in steps of p. Example: rrand(2,5,.1) might return 3.4. rrand(2,5,.01) might return 3.27. rrand(2,8,2) might return 6
- nonzerorand(min,max): Returns a nonzero integer between min and max
- nonzerorrand(min,max,p): Returns a nonzero real number between min and max in steps of p
- randfrom(list or array): Return an element of the list/array. Examples of lists: "2,4,6,8", or "red,green,blue"
- randname(),randmalename(),randfemalename(): Returns a random first name
- randnamewpronouns([option]): Returns a random first name with pronouns in the order: subjective, objective, possessive (singular), possessive (plural), reflexive. Can set option to 'neutral' for they/them/their/theirs/themself pronouns. Use: $name,$heshe,$himher,$hisher,$hishers,$himherself = randnamewpronouns()

Array randomizers (return multiple results):

- rands(min,max,n,[order]): Returns n integers between min and max. Can set order to 'inc' or 'dec' to sort the values, but be aware there may still be duplicate values.
- rrands(min,max,p,n,[order]): Returns n real numbers between min and max in steps of p. Can set order to 'inc' or 'dec' to sort the values.
- nonzerorands(min,max,n,[order]): Returns n nonzero integers between min and max. Can set order to 'inc' or 'dec' to sort the values.
- nonzerorrands(min,max,p,n,[order]): Returns n nonzero real numbers between min and max in steps of p. Can set order to 'inc' or 'dec' to sort the values.
- randsfrom(list/array,n,[order]): Return n elements of the list/array. Can set order to 'inc' or 'dec' to sort the values.
- jointrandfrom(list/array,list/array,[list/array,...]): Returns one element from each list, where the location used in each list is the same
- diffrands(min,max,n,[order]): Returns n different integers between min and max. Can set order to 'inc' or 'dec' to sort the values.
- diffrrands(min,max,p,n,[order]): Returns n different real numbers between min and max in steps of p. Can set order to 'inc' or 'dec' to sort the values.
- diffrandsfrom(list/array,n,[order]): Return n different elements of the list/array. Can set order to 'inc' or 'dec' to sort the values.
- nonzerodiffrands(min,max,n,[order]): Returns n different nonzero integers between min and max. Can set order to 'inc' or 'dec' to sort the values.
- nonzerodiffrrands(min,max,p,n,[order]): Returns n different nonzero real numbers between min and max in steps of p. Can set order to 'inc' or 'dec' to sort the values.
- jointshuffle(list/array1,list/array2,[n1,n2]): Shuffles two lists/arrays in a way that retains respective order. In n1 is provided, n1 elements from each shuffled array will be returned (like a joint version of diffrandsfrom). If n2 is also provided, n1 elements of list/array1 and n2 elements of list/array2 will be returned.
- singleshuffle(list/array,[n]): returns a shuffled version of a list/array. If n is provided, it behaves identically to diffrandsfrom
- randnames(n),randmalenames(n),randfemalenames(n): Returns n random first names
- randcity([country]),randcities(n, [country]): Returns one or n random US or Canadian city names. Argument country can be set to "USA" or "Canada". The default is "USA".
- randstate([country]),randstates(n, [country]): Returns one or n random US state or Canadian province names. Argument country can be set to "USA" or "Canada". The default is "USA".
- randcountry(),randcountries(n): Returns one or n random country names
- randpythag([min,max]): Return a Pythagorean triple. min/max default to 1 to 100

## Graph/Table Macros

The following macros create graphs or tables:

- showarrays(string,array,[string,array]...,[options]): Creates a tabular display of the data in the array(s) as column(s), with the strings as column headers. Alternatively you can call this function with arguments showarrays(array of column headers, array of data arrays, [options]). Options can be a string = "c", "r", or "l" to center, left-align, or right align data, or can be an array with $opts["align"] for alignment, $opts["tablealign"]="center" to center the whole table, and $opts["caption"] to add a caption to the table. To align each column differently, provide a a string with a character for each column, like "rcc"
- showdataarray(array,[columns]): Creates a tabular display of the data in the array with no headers. Data is presented in one column unless second argument is provided, in which case the data will be distributed over the specified number of columns.
- horizshowarrays(string,array,[string,array]...): Creates a tabular display of the data in the array(s) as row(s), with the strings as row labels. Does not text wrap, so only use for small data sets.
- showrecttable(data array of arrays,columnlabels,rowlabels,[format]): Creates a tabular display of a 2x2 data table, where $data[0] is the first row of the table. The rowlabels and columnlabels are arrays of labels. format = "c", "r", or "l" to center, left-align, or right align data.
- showplot(funcstrings,[xmin,xmax,ymin,ymax,labels,grid,width,height])
  - funcstrings is a single string or an array of strings each having at least the first of the following list:
    "function,color,min,max,startmarker,endmarker,width,dash"
    - Function: a single function of x, like cos(x), or a parametric function of t, entered like [sin(t),cos(t)], or x=c for a vertical line, entered like x=1
    - color: a color designator: black,red,orange,yellow,green,blue,purple
    - min,max: the min and max values for the input variable for which you wish to see this graph. You can also exclude point discontinuities; for example -5,5!0!2 for min,max would include all values from -5 to 5, excluding 0 and 2.
    - startmarker,endmarker: can be "open" or "closed" (dots), "arrow", or anything else for none
    - width: a pixel width for the line
    - dash: enter "dash" if you want a dashed line, otherwise the line is solid
    - Examples: "cos(x),red" or "x^2,,-2,2,open,closed" or "[t^2,t/3],blue,0,5,,,2,dash" or "1/x,black,-5,5!0" or "x=1,red,,,,,,dash"
    - Dots and Labels: There are two alternate funcstrings formats:
      - dots: For drawing dots. A string containing at least the first three of: "dot,x,y,style,color,label,labelloc"
        - dot: the literal word dot
        - x,y: the coordinates of the dot
        - style: open or closed
        - color: a color designator: black,red,orange,yellow,green,blue,purple
        - label: a text string to put as a label on the dot
        - labelloc: label location: above, left, right, below, aboveleft, etc.
        - Examples:: "dot,3,4", "dot,1,1,open", "dot,3,3,,blue,A"
      - text: For placing text labels. A string containing at least the first four of: "text,x,y,label,color,location,angle"
        - text: the literal word text
        - x,y: the coordinates of the label
        - label: the text string to display
        - color: a color designator: black,red,orange,yellow,green,blue,purple
        - location: label location: above, left, right, below, aboveleft, etc.
        - angle: a rotation angle in degrees for the label (0,90,180,270)
        - Examples:: "text,2,4,Cars", "text,4,0,Hours,below"
  - xmin,xmax,ymin,ymax: Graphing window. Defaults to -5 to 5 for both. Use "0:-n" (for some value of n) for xmin or ymin to only have gridlines and labels after 0, while still using -n to adjust spacing. This is an alternative to using addplotborder to create first quadrant graphs.
  - labels: spacing of axes labels. Defaults to 1. Set to "off" or 0 for none. Use "xlbl:ylbl" for different spacing on each axis.
  - grid: spacing of grid lines. Defaults to 1. Set to "off" or 0 for none. Use "xgrid:ygrid" for different spacing on each axis.
  - width,height: The width and height (in pixels) of the graph. Defaults to 200x200
- mergeplots($plot1, $plot2, [$plot3, $plot4, ...]): Merges multiple plots into one. Usually not necessary, since showplot can accept an array of funcstrings, but occasionally useful when adding to a graph generated by another function. The grid and border from the first graph is used. To avoid weird behavior, try to ensure all plots were drawn using the same grid.
- addfractionaxislabels(plot,step): Adds labels along the horizontal axis in steps of step to a plot created with showplot. Step is a fraction like "1/4", or a pi multiple, like "pi/4" or "2pi". When using this, make sure to set the showplot x-axis label spacing larger than the domain to prevent the default labels from showing.
- addlabel(plot,x,y,label,[color,loc,angle]): Adds a label to a plot created with showplot.
  - plot: The plot created with showplot
  - x,y: The coordinates for the label
  - label: The string label itself. MathML cannot currently be displayed in labels
  - color: Label color. Defaults to black.
  - loc: By default, the label is centered at the x,y coordinates. Use "left" to display the string to the left of the point, "right" to the right, "below" for below the point, "above" for above the point.
  - angle: Angle to rotate text.
- addlabelabs(plot,x,y,label,[color,loc,angle]): Adds a label to a plot created with showplot. Parameters are the same as with addlabel, except x and y here are pixel values on the picture rather than values relative to the axes.
- addplotborder(plot,left,[bottom,right,top]): Changes the pixel width of border (default 5) around a plot. Labels will show within the border. Typically used to add room for labels to show.
- adddrawcommand(plot,commands): Inserts arbitrary asciisvg drawing commands into an existing plot created with showplot or other drawing tools.
- showasciisvg(string,[width,height,alttext]): If you know the ASCIIsvg language, this will set up an svg with "string" as the script. optionally you can specify the width and height (in pixels) for the svg. For accessibility, you should always try to include alttext, which is text that displays to people requesting non-visual alternatives.
- replacealttext(image or graph, alttext): Replaces the alt text (alt tag) in the image or graph with the specified text. This alt text will replace the autogenerated textual description for graphs produced by showplot.
- changeimagesize(image or graph, width, [height]): Changes the display width for an image. Note this doesn't resize the file itself, just changes the display size - it's always better to resize the original image file.
- textonimage(img,text,left,top[text,left,top,left,...]): Overlays text over an image. Image can be a URL or the variable for an uploaded image. Specify the text string, and offset in pixels from the top left corner. Can specify multiple strings to overlay. textonimage is not screenreader-friendly, so it's recommended you provide an alt text on the image, which will be read to the screenreader instead of the image and any layered text.
- addimageborder(image, [border width, margin]): Adds a border to an image uploaded in the question editor. Border width (default 1) and whitespace margin (default 0) can be specified.
- arraystodoteqns(xarray,yarray,[color]): Converts an array of x-values and y-values into a form that can be used in showplot.
- connectthedots(xarray,yarray,[color,thickness,startmarker,endmarker]): Converts an array of x-values and y-values into a form that can be used in showplot to create a series of lines connecting the (x,y) pairs
- arraystodots(xarray,yarray): Converts an array of x-values and y-values into a form that can be used in the Drawing answer type
- gettwopointlinedata(stuans, [xmin, xmax, ymin, ymax, drawing width, drawing height]) or gettwopointlinedata(stuans, [grid, snaptogrid]): Takes a $stuanswers from a drawing question and pulls out the two-point line data. Returns an array of lines, each of form array(x1,y1,x2,y2) giving the coordinates of the two points used.
- gettwopointdata(stuans, type, [xmin, xmax, ymin, ymax, drawing width, drawing height]) or gettwopointdata(stuans, type, [grid, snaptogrid]): Takes a $stuanswers from a drawing question and pulls out the two-point data for the given curve type. Type should be one of 'line', 'lineseg', 'ray', 'parab', 'horizparab', 'sqrt', 'cubic', 'cuberoot', 'rational', 'exp', 'genexp', 'log', 'genlog', 'sin', 'cos', 'abs', 'vector', 'circle','ellipse'. Returns an array of curve data, each of form array(x1,y1,x2,y2) giving the coordinates of the two points used. They are returned in the order clicked. For example, with 'parab' type, the first point is the vertex and the second point is an arbitrary point. Using 'genexp' or 'genlog' will return a 5th entry which is the value of the asymptote. Can use type 'circlerad' to return array(x-center,y-center,radius) or 'ellipserad' to return array(x-center,y-center,x-radius,y-radius).
- gettwopointformulas(stuans, type, [xmin, xmax, ymin, ymax, drawing width, drawing height]) or gettwopointformulas(stuans, type, [grid, snaptogrid]): Takes a $stuanswers from a drawing question and returns formulas for curves drawn by the student. Type should be one of 'line', 'lineseg', 'ray', 'parab', 'horizparab', 'sqrt', 'cubic', 'cuberoot', 'rational', 'exp', 'genexp', 'log', 'genlog', 'sin', 'cos', 'abs', 'circle','ellipse'. Returns an array of expressions, each a function of x, for the curves drawn. They are returned in the order clicked. For 'horizparab', output will be in terms of y. For 'circle' and 'ellipse', output will be expression in x and y equaling 1. Can give a final optional argument 'showequation,[xvar,yvar]' to output implicit equations with optional custom x and y variables.
- getdotsdata(stuans, [xmin, xmax, ymin, ymax, drawing width, drawing height]) or getdotsdata(stuans, [grid, snaptogrid]): Takes a $stuanswers from a drawing question and pulls out the closed dots data. Returns an array of dots, each of form array(x1,y1) giving the coordinates of the dot.
- getopendotsdata(stuans, [xmin, xmax, ymin, ymax, drawing width, drawing height]) or getopendotsdata(stuans, [grid, snaptogrid]): Takes a $stuanswers from a drawing question and pulls out the open dots data. Returns an array of dots, each of form array(x1,y1) giving the coordinates of the dot.
- getlinesdata(stuans, [xmin, xmax, ymin, ymax, drawing width, drawing height]) or getlinesdata(stuans, [grid, snaptogrid]): Takes a $stuanswers from a drawing question and pulls out the lines data, which includes polygons. Returns an array, with an element for each line/curve draw. Each of those elements will be an array of points on that line/curve. Each of those points is array (x,y).
- getineqdata(stuans, [type, xmin, xmax, ymin, ymax, drawing width, drawing height]) or getineqdata(stuans, [grid, snaptogrid]): Takes a $stuanswers from a drawing question and pulls out the inequalities data for the given curve type. Type should be one of 'linear' or 'quadratic'. Returns an array of curve data, each of form array(style,x1,y1,x2,y2,x3,y3) giving the coordinates of the three points used. They are returned in the order clicked. style will be either 'ne' for strict inequality (dashed line), or 'eq' for inequality with equality (solid line).
- getsnapwidthheight(xmin, xmax, ymin, ymax, drawing width, drawing height, snaptogrid): Takes drawing grid info and a snaptogrid value or string, and returns an array(width,height) giving a closeby drawing width and height that will guarantee that the snaptogrid values fall on exact drawing pixel locations.

## Format Macros

The following macros help with formatting values for display:

- makepretty(string or array of strings): Changes double add/subtract signs to a single sign.
- makeprettydisp(string or array of strings): Does makepretty (see above) and backquotes the string for math display
- polymakepretty and polymakeprettydisp: Like makepretty, but for polynomials. Cleans up 0*, 1*, ^1, and ^0 to make the polynomial look nicer. This function can do weird things for equations that are not simple polynomials, so test well
- makexpretty and makexprettydisp: (deprecated - use makexxpretty instead) Like makepretty, but the X-tra version - attempts to clean up things like 1*, 0*, etc. This function will often cause weird things to happen, so test well
- makexxpretty and makexxprettydisp: Like makepretty, but the X-tra version - attempts to clean up things like 1*, 0*, x^1, x^0, etc. Can occasionally cause strange output, so be sure to test. Handles things better than the older makexpretty, but does not always produce 100% identical output. This function cannot handle |x| notation; use abs(x) instead.
- numtowords(number,[addth, numwithTh, addcommas): Creates a string containing number written out in words.
  numtowords(1203) returns "one thousand two hundred three"
  numtowords(1203,true) returns "one thousand two hundred third"
  numtowords(1203,false,true) returns "1023rd"
  numtowords(1203,false,false,true) returns "one thousand, two hundred three"
- fractowords(numerator,denominator,[options]): Creates a string containing fraction numerator/denominator written out in words. By default, fractions will be reduced to integers if possible, and pos/neg signs will be reduced. Options is a string that can include combinations of 'mixed' or 'literal', and 'over' or 'by'. Using 'over' or 'by' will connect numerator and denominator with that word. Using 'mixed' will output a mixed number, and 'literal' overrides the default simplifications. Does not allow division by zero. If 'over' and 'by' both used, defaults to 'over'. If 'mixed' and 'literal' both used, defaults to 'mixed'.
  fractowords(5,-2) returns "negative five halves"
  fractowords(6,3) returns "two"
  fractowords(-7,4,'mixed') returns "negative one and three fourths"
  fractowords(-7,4,'mixed over') returns "negative one and three over four"
  fractowords(6,3,'literal') returns "six thirds"
  fractowords(6,3,'literal over') returns "six over three"
- numtoroman(number,[uppercase]): Converts a number 0.5-3999.5 to a roman numeral string. Defaults to uppercase; set second parameter to false to produce lowercase
- prettyint(number): Adds commas in thousands spaces of integers. Example: prettyint(1234) will return "1,234". The result is a string, which can only be used for display, not in calculations
- prettyreal(number,decimals,[comma]): Adds commas in thousands spaces of number, and displays the value to a fixed number of decimals places (rounding if needed). Example: prettyreal(1234.567,2) will return "1,234.57", and prettyreal(1.8,3) will return "1.800". The result is a string, which can only be used for display, not in calculations. By default adds a comma as a thousands separator; set comma to "" to override.
- prettysmallnumber(number, [space]): Prevents very small numbers from being displayed as scientific notation. Set space to true to add space in groups of 3, like 0.000 000 02
- prettysigfig(number,sigfigs,[comma,choptrailingzeros,scinot,sigfigbar]): Rounds number to sigfigs significant figures. By default it adds commas in thousands spaces; set comma to "" to override. Set choptrailingzeros to true to chop trailing zeros from the decimal part, even if significant. Set scinot to true to display in scientific notation. Set sigfigbar to true to put line over last significant, non-terminating zero, such as 4200 having three sig figs (use only in math display). This is for display; to round a number for calculations, use roundsigfig.
- makescinot(number,[decimals,format]): Converts number to scientific notation. If provided, rounds mantissa to decimals places. Can specify format: "*" "E" as alternative to default cross.
- prettytime(value,informat,outformat): Creates a nice representation of a time. Informat can be 'h', 'm', or 's' designating whether value is hours, minutes, or seconds. Outformat can be any combination of these to specify output. For example, 'hm' will return "__ hours and __ minutes". Outformat can also be 'clock' which returns 3:42pm, or 'sclock' which returns 3:42:15pm
- dispreducedfraction(numerator,denominator,[doubleslash,variable in numerator]): Takes two numbers as numerator and denominator of a fraction, returning a display form of the fraction, reduced to lowest terms. Suitable for $showanswer. Set doubleslash to true to produced "3//4" rather than "3/4". Set variable in numerator to put a variable in the numerator, such as pi.
- makereducedfraction(numerator,denominator,[doubleslash,variable in numerator]): Same as dispreducefraction, but not already in display form
- decimaltofraction(decimal,[format,maxden]): Converts a decimal to a fraction. Can use format="mixednumber" to get a mixed number rather than improper fraction. Only works for denominators up to maxden (default 5000)
- htmldisp(string,[variables]): Uses HTML instead of the math typesetter to display simple exponents and subscripts, and to italicize variables
- formatcomplex(real,imag): Creates a string like "2+i" from the real and imaginary parts.

## String Macros

These macros help with working with strings:

- stringappend(value,string): Appends string to value. If value is an array, string is appended to each element of the array
- stringprepend(value,string): Same as stringappend, but prepends string to value
- today([string]): Returns today's date, like "July 3, 2008". Can change format using string (see http://us2.php.net/manual/en/function.date.php for formats)
- stringpos(needle,haystack): Finds the position of the string needle in the string haystack. Returns -1 if needle is not found
- stringlen(string): returns the character count in the provided string
- stringclean(string,mode): mode 0: trims leading and trailing whitespace. mode 1: removes all whitespace. mode 2: removes all non-alphanumeric characters.
- substr(string,start,[length]): grabs the part of the string from the start index with given length. If length is not specified, it cuts from the start index to the end of the string.
- strtoupper(string): make all characters in the string upper case
- ucfirst(string): makes the first character in the string upper case
- strtolower(string): make all characters in the string lower case
- substr_count(haystack,needle): Find the number of occurrences of needle in the string haystack
- str_replace(search,replace,string): Replace all occurrences of search in the string with replace. Search and replace can be arrays.
- preg_match(pattern,subject,[matches]): Searches subject for a match using the regular expression in pattern.

## Array Macros

These macros are for working with arrays:

- listtoarray(list): Converts a list, like "1,2,3,4" or "cat,dog,rabbit" to an array
- explode(symbol, string): Converts a string to an array, breaking it apart on the given symbol.
- arraytolist(array): Converts an array to a list
- calclisttoarray(list): Converts a list of calculations, like "2^2,3^5,7/2" to an array, evaluating the calculations along the way.
- stringtoarray(string): Converts a text string to an array of characters
- fillarray(value,num,[start]): Creates an array with num entries, all of which are the same given value. Array indexing starts at 0 unless specified
- sortarray(list/array,[dir]): Sorts an array from lowest to highest value. To sort in reverse order, give the option second parameter as "rev"
- jointsort(array,array,[array,...]): Jointly reorders two or more arrays based on a lowest-to-highest sort of values in the first array
- consecutive(min,max,[step]): Creates an array of consecutive numbers, starting at min and ending at max, in increments of step. Step is optional; it defaults to 1.
- calconarray(array,calculation): Returns an array, performing the given calculation on each element of the given array. Use "x" as the variable to represent each element of the array. Example: $b = calconarray($a,"x^2") will create an array that is the square each element of the array $a.
- multicalconarray(calculation,varslist,var1array,var2array,etc.) Returns an array, performing the given calculation on each set of elements from the given arrays. Allows multivariable calculations. Example: $z= multicalconarray("x*y^2","x,y",$xs,$ys)
- calconarrayif(array,calculation,ifcondition): Like calconarray, but allows you to specify a condition for each element for whether to do the calculation. Example: $b = calconarrayif($a,"x+.1","floor(x)==x") will add .1 to add whole numbers in the array, and leave the other elements unchanged.
- keepif(array,condition) Filters an array, only keeping values that meet the supplied condition. Example: keepif($a,"x%3==0").
- subarray(array,params): Creates a new array as a subset of the specified array. The params can take several forms:
  - subarray($a,2,4,6): creates an array from $a[2], $a[4], and $a[6]
  - subarray($a,"1:3","6:8"): create an array from $a[1] through $a[3], and $a[6] through $a[8]
  - subarray($a,$b): creates an array from entries in $a with indexes specified in $b. So if $b = array(2,4,6), this would return $a[2], $a[4], and $a[6]
- joinarray(array,symbol): Convert an array to a string, joining elements with the given symbol
- mergearrays(array,array,[array,...]): Combines two or more arrays into one long array
- unionarrays(array,array): Unions two arrays, preventing duplicates, into a new array
- intersectarrays(array,array): Finds the intersection of two arrays
- diffarrays(array1,array2): Returns all elements in array1 that are not also in array2
- array_unique(array): Returns the array, stripping duplicate values
- array_values(array): Returns the values of an array, reindexing with consecutive numeric indices.
- count(array): Counts the number of entries in the array
- is_array(variable): Determines if the variable is an array
- sumarray(array): Adds the entries in an array
- in_array(needle,haystack): Checks if value needle is in array haystack. Returns true or false
- arrayfindindex(needle,haystack): Returns the index in the array haystack of the value needle. If there are multiple matches, it only returns the first.
- arrayfindindices(needle,haystack): Returns an array of indices in the array haystack of the value needle.
- array_flip(array): Reverses a one-to-one array, so indexes become values and values become indexes

## General Macros

These macros are fairly general purpose:

- ifthen(condition,trueval,falseval): Takes a comparison condition, and returns the trueval if the condition is true and the falseval otherwise.
- formhoverover(label,tip): Creates a hover-over definition or other tip
- formpopup(label,content,[width,height,style,scrollbars]): Creates a link or button leading to a popup window. Content can be a web address, or HTML content to put directly into the popup. Style can be "link" or "button". Scrollbars defaults to false - set true for scrollbars.
- forminlinebutton(lable,content,[style,outputstyle]): Creates a link or button that when clicked will reveal hidden content. Content can be any valid HTML. Style can be "link" or "button". Outputstyle can be "inline" or "block". Block will allow any HTML, but will be displayed on a new line. Use "inline" to have text stay on the same line.
- makenumberrequiretimes(array/list): Takes an array or list of numbers and generates a string suitable for use as a $requiretimes. Writes the string so that every number in the array must show up in the student answer. Automatically detects and adjusts for number overlaps (like 2 appearing in 32).
- ABarray(start, num): Produces an array of strings of the form [AB#] which will get replaced with answerboxes if placed in the question text. start is the first value used, and num indicates the number of entries to create. ABarray(5,2) will output array("[AB5]","[AB6]"). This macro is often used in conjunction with the showarrays macro.
- scoremultiorder(stua, answer, swap, type, [weights]): In a multipart question, allows questions or groups of questions to be scored in any order. Works for types 'number', 'string', 'calculated', 'numfunc', 'complex', 'calccomplex', 'ntuple', and 'calcntuple'. Note: Use of the "list" option for individual question types is strongly recommended over using this function if you're just asking for multiple answers.
  - Use like `$answer=scoremultiorder($stuanswers[$thisq],$answer,'0;1','number')`
  - stua: For numeric types, `$stuanswers[$thisq]` should be the first argument. For calculated types, `$stuanswersval[$thisq]` should be the first argument.
  - answer: The second argument is always `$answer`. This function must be used after $answer is already defined.
  - swap: The third argument shows what entries should be swappable. It can be a string or array of strings. Examples:
    - `'0;1'` would say answers index 0 and 1 should be swappable
    - `'0;1;2'` would say answers index 0,1,and 2 should be swappable
    - `['0;1','2;3']` would say answers index 0 and 1 should be swappable, and 2 and 3 should be swappable
    - `'0,1,2;3,4,5'` would say answers with indices 0,1,2 should be swappable as a group with the answers with indices 3,4,5. Comparison is only made on the first entry to decide whether to swap the groups.
  - type: should be the question part short name, like 'number' or 'calccomplex', for the entries that can be swapped.
  - weights: optionally, you can include your answeights to have them swapped to. In that case, use the form `$answer,$answeights=scoremultiorder($stuanswers[$thisq],$answer,'0;1','number',$answeights)`

## Math Macros

These macros are used for mathematical calculations:

- sin(t), cos(t), tan(t), sec(t), csc(t), cot(t): The usual trig functions
- arcsin(v), arccos(v), arctan(v), atan2(y,x): The inverse trig functions
- abs(v): Absolute value
- gcd(a,b): Greatest common divisor of a and b
- lcm(a,b): Least common multiple of a and b
- sign(a,[option]): Returns the sign of a, as 1 or -1. If option is set to true, returns a string "+" or "-" instead. If option is set to "onlyneg", it returns the string "-" if a is negative, or "" otherwise.
- sgn(a): Returns the sign of a, as -1, 0, or 1.
- v!: Factorial, like $a = $b!
- evalfunc(func,vars,val1,val2,..): Evaluates a function given the variables and values for each variable. for example evalfunc("x^2*y","x,y",2,3) will evaluate x^2*y with x=2, y=3
- evalnumstr(expr): Evaluates a string representation of a numerical expression, like "(2pi)/3", to a decimal. Avoid using this in place of direct calculation in most cases, but it can be handy if you already have generated the string for display but then need to do a calculation with it.
- See also: calconarray and multicalconarray in the Array Macros section

## Conditional Test Macros

These macros are used to test various conditions. They typically return true or false, depending on whether the desired condition is met.

- getstuans($stuanswers, $thisq, [part number]): Pass this function the $stuanswers or $sutanswersval arrays, $thisq for the question number, and a part number (omit if it's a single part question) and this will return the corresponding value. Use of this function is recommended over directly accessing the array, as this function accounts for undefined values in a way that won't trigger errors.
- stuansready($stuanswers, $thisq, array of part numbers, [anstypes, answerformat]): Before using student answers, you need to check to make sure the student has actually answered them. Pass this function the $stuanswers or $sutanswersval arrays, $thisq for the question number, and an array of part numbers, and it will check to make sure a non-blank answer has been provided for all of the part numbers. A part number can also be given as "1 or 2" if answering either part is sufficient. To allow a blank answer, prefix a part number with a tilde. It is good to wrap any multipart or conditional code using student answers in an "if" block using stuansready as the condition. It is advisable to pass $anstypes as a 4th input, which allows the function to handle special cases like matrices better. $answerformat can be added as an optional 5th input, which will check the student answer meets the answerformat (currently only checks Calculated questions, and no lists).
- comparenumbers(a,b,[tol]): Compares numbers or numerical expressions a and b to see if there are equivalent to the specified tolerance. Set tol to specify the relative tolerance (defaults to .001), or prefix with | for an absolute tolerance.
- comparenumberswithunits(a,b,[tol]): Compares numbers-with-units a and b to see if they are equivalent to the specified tolerance. Set tol to specify the relative tolerance (defaults to .001), or prefix with | for an absolute tolerance. Each of a and b must be of the form: `[decimal number]*[unit]^[power]*[unit]^[power].../[unit]^[power]*[unit]^[power]...`, though 'per' may be used for division of units, and 'unit squared', 'square unit', 'unit cubed' and 'cubic unit' may be used. Examples: `4 cm`, and `3.5E4 feet per second squared`
- comparentuples(a,b,[tol],[option]): Compares ntuples or calcntuples a and b to see if they are equivalent to the specified tolerance. Set a single tol to specify the relative tolerance for all entries in ntuple (defaults to .001), or prefix with | for an absolute tolerance, such as "|0.5". Can make tol an array (or list) to apply by element to the ntuple. By default, function compares the parentheses/brackets containing the ntuple. Can give option "ignoreparens" to only compare the entries in the ntuple, so (a,b) would be considered equivalent to [a,b].
- comparefunctions(a,b,[vars,tol,domain]): Compares functions a and b to see if they are algebraically equivalent. Set vars to a list of variables (defaults to 'x'). Set tol to specify the relative tolerance (defaults to .001), or prefix with | for an absolute tolerance. Set domain to "xmin,xmax" to specify a domain for comparison, or "xmin,xmax,integers" to restrict domain to integer values.
- comparesameform(a,b,[vars]): Compares expresions a and b to see if they are in the "same form". This means exactly the same, except for commutation of addition and multiplication, multiplication by 1, implicit multiplication, and extra parentheses. This is picky, so use with caution. Set vars to a list of variables (defaults to 'x').
- comparelogic(a,b,vars): Compares two logical statements, written using ^^ for and, vv for or, ~ for not, -> or => for conditional, and <-> or <=> for biconditional. vars should be a list or array of variables in the statements.
- is_numeric(str): Checks if the string represents an integer or decimal number.
- is_nan(val): Checks if the value is NAN (not a number), which results from things like sqrt(-1). Only works on calculated values, not string expressions.
- scorestring($answer,$showanswer,words,$stuanswers,$thisq,[partn, highlight]): This function checks to see if the words in the list/array "words" appear in the student's answer. If they all appear, it redefines $answer so the student's answer is marked correct. $showanswer is also redefined to show the original $answer with all the required words highlighted. You can turn off the highlighting by setting the optional highlight parameters to false.
  For multipart questions, include the part number as an additional parameter. Usage for single part questions (where $words is predefined earlier in the code):
  $answer,$showanswer = scorestring($answer,"",$words,$stuanswers,$thisq)
  Usage for multipart questions (again where $words is predefined). This is example is for part 2:
  $answer,$showanswer = scorestring($answer,$showanswer,$words,$stuanswers,$thisq,2)
- checkanswerformat(string, answerformat): Checks a single numerical expression string, like "3/2" for whether it meets the answerformat listed.

## Feedback Macros

These macros are used to select and format feedback messages to students. They return a string which can be placed in the question text.

- getfeedbackbasic(correct msg, incorrect msg, $thisq, [partnum]): Generates a feedback string based solely on whether the question was scored correct or not. Provide the correct and incorrect messages to display, and provide $thisq. Give a part number for multipart questions to get part-based feedback. Can give an array of part-numbers, in which case the correct message only shows if all parts are correct.
- getfeedbacktxt(stuans, feedbacktxt, ans): Gives feedback on multiple choice questions.
  stuans should be the student answer, obtained from $stuanswers[$thisq] for single part questions, or using the getstuans macro for multipart.
  feedbacktxt is an array of feedback responses, corresponding in array order to the $questions, so feedbacktxt[1] is the feedback if the student selections $questions[1] as their answer.
  ans is the correct answer; you can usually pass $answer if it's been defined already.
- getfeedbacktxtessay(stuans, feedbacktxt): Gives feedback on essay questions. stuans should be the student answer, obtained from $stuanswers[$thisq] for single part questions, or using the getstuans macro for multipart. It is not actually evaluated or compared - it is only needed to see if the student has entered a response or not. Once the student has entered any response, feedbacktxt will be returned.
- getfeedbacktxtnumber(stuans, partialcredit, feedbacktxt, defaultfeedback, [tol]): Gives feedback on number questions.
  stuans should be the student answer, obtained from $stuanswers[$thisq] for single part questions, or using the getstuans macro for multipart. For Calculated type questions, be sure to use $stuanswersval.
  partialcredit is an array or list of form array(number, score, number, score, ... ) where the scores are in the range [0,1].
  feedbacktxt is an array of feedback messages, corresponding in array order to the order of the numbers in the partialcredit list.
  defaultfeedback is the default incorrect response feedback
  Set tol to specify the relative tolerance (defaults to .001), or prefix with | for an absolute tolerance.
- getfeedbacktxtcalculated(stuans, stuansval, partialcredit, feedbacktxt, defaultfeedback, [answerformat, requiretimes, tol]): Gives feedback on calculated number questions.
  stuans should be the student answer, obtained from $stuanswers[$thisq] for single part questions, or using the getstuans macro for multipart.
  stuansval should be the numerical value of the student answer, obtained from $stuanswersval[$thisq].
  partialcredit is an array or list of form array(number, score, number, score, ... ) where the scores are in the range [0,1].
  feedbacktxt is an array of feedback messages, corresponding in array order to the order of the numbers in the partialcredit list.
  defaultfeedback is the default incorrect response feedback
  answerformat can be a single answerformat to apply to all expressions, or an array with each element applied to the corresponding expression
  requiretimes can be a single requiretimes to apply to all expressions, or an array with each element applied to the corresponding expression
  Set tol to specify the relative tolerance (defaults to .001), or prefix with | for an absolute tolerance.
  Example: `getfeedbacktxtcalculated($stuanswers[$thisq], $stuanswersval[$thisq], array("1/2",1,"1/2",.5), array("Correct", "Right value, but give your answer as a fraction"), "Incorrect", array("fraction",""))` will check the students answer against the answer "1/2" twice, the first time applying the "fraction" answerformat, and the second time not.
- getfeedbacktxtnumfunc(stuans, partialcredit, feedbacktxt, defaultfeedback, [vars, requiretimes, tol, domain]): Gives feedback on numfunc (algebraic expression/equation) questions.
  stuans should be the student answer, obtained from $stuanswers[$thisq] for single part questions, or using the getstuans macro for multipart.
  partialcredit is an array or list of form array(expression, score, expression, score, ... ) where the scores are in the range [0,1].
  feedbacktxt is an array of feedback messages, corresponding in array order to the order of the numbers in the partialcredit list.
  defaultfeedback is the default incorrect response feedback
  vars should be a list of variables used in the expression. Defaults to "x"
  requiretimes can be a single requiretimes to apply to all expressions, or an array with each element applied to the corresponding expression
  Set tol to specify the relative tolerance (defaults to .001), or prefix with | for an absolute tolerance.
  Set domain to limit the test domain. Defaults to "-10,10"

## Using Other Macros

If an IMathAS administrator has installed other Macro Libraries, you can load a macro library by entering the line `loadlibrary("list of library names")` at the beginning of the Common Control section.

Examples: `loadlibrary("stats")` or `loadlibrary("stats,misc")`

Click on the "Macro Library Help" link in the question editor to get a list of installed macro libraries and the macros available in each library

## Math Entry

IMathAS uses ASCIIMath for math entry. In question text or inside strings that will be displayed in the question text, wrap expressions to be rendered in the backtick/grave symbol, like ``x^2``. That key is usually located on the same keyboard button as the tilde.

For calculations, a limited subset is available:

Symbol | Meaning
--- | ---
* / + - | Multiply, divide, add, subtract
^ | Powers. 2^3 = 8.
e, pi | The standard constants
% | Modulus (remainder after division. 5%2 = 1)
mod(p,n) | Modulus. This version gives positive results for modulus of negative numbers.
! | Factorial
sqrt | Square root
sin,cos,tan,cot,sinh,cosh | Standard trig function. Be sure to enter as sin(2), not sin 2
arcsin,arccos,arctan,arcsinh,arccosh | Inverse trig functions.
sin^-1, cos^-1, tan^-1 | Alternative entry for inverse trig functions. Use like sin^-1(0.5)
ln | Natural Logarithm base e
log | Common Logarithm base 10
abs | Absolute Value. Note that while abs() is used for calculations, you may prefer to use | brackets for display
round(n,d) | round number n to d decimal places
roundsigfig(n,s) | round number n to s significant digits. This is for calculations; if you need a value for display and want to ensure trailing 0's display, use prettysigfig
floor,ceil | floor/ceiling: integer below/above given number
min,max | min or max of the passed values. Can be used as min($a,$b,$c) or min($arrayvariable).

For display only, the full ASCIIMath language is available (which includes support for a limited subset of LaTeX). For more info, see the ASCIIMath syntax.

## Solver

While writing a question, it can be handy to quickly solve a formula for a variable. For example, if you're writing a question that asks students to solve y=($a x + $b)/($b x - $a) for x, where $a and $b are randomized variables. You might need to calculate the correct answer. The Solver tool can help solve or check the solution.

### Solver Input

Tips:

- Select your code from the Common Control box, then either drag-drop or copy-paste it to the box below, or
- Highlight an expression in Common Control and press `Ctrl-M` to update the Solver code, or
- Highlight an expression in your code before clicking Solver.
- Select an operation to perform: Solve, Differentiate, Integrate, Plot.
- You may need to change the colored Sage code below to solve for the correct variable or to adjust the plot window etc. See the help icon below for examples.

### Solver: Sage Syntax

SageMath examples:

> `#create symbolic variables
> x,y,a,b,c,d = var('x,y,a,b,c,d')
> # solve the equation for x
> solve( y==(a*x+b)/(c*x-d) , x )
> x = var('x')
> #Differentiate
> diff( 3*x^4 , x )
> x = var('x')
> #Plot in a standard window
> plot( -x^2+4 , (x,-10,10) )
> x = var('x')
> #Simplify
> simplify( 5*x+7*(-3*x-4) )
> `

Tips:

- Declare any variables using `var()` as above. By default, x is a variable.
- Use two equal signs for math equations.
- With `solve() diff() integral()` give the independent variable after a comma.
- With `plot()` a range for the independent variable must be specified, e.g. `(x, -10, 10)`.
- Select a new operation or click Go to calculate.

### Solver Output

Tips:

- Drag the result above to the Common Control box where you define the $answer or any other location, or
- Click Insert in Common Control to append the result to the end of the Common Control, or
- Click Insert as $answer to append `$answer = result` to the Common Control (not available if `$answer` is already defined).
- Note: Touchscreens might not be supported by the drag operation.

## Common options to all types

All question types can support these options:

### Hints

For a single question (not multipart), to use hints, in the common control (or question control) section define the array $hints where:

    $hints[attempt number] = "hint text"

For example:

    $hints[0] = "This will show on first display"
    $hints[1] = "This will show on second attempt (after 1 missed attempt)"
    $hints[2] = "This will show on third and subsequent attempts, since no later values have been defined"

It is fine, for example, to not define $hints[0] if you want nothing to display initially.

Then in the question text, place the location of the hint using the variable $hintloc.

In multipart questions, you can follow the process above if you just want a single strand of hints for the entire problem. If you want per-part hints, define the $hints array as:

    $hints[question part number][attempt number] = "hint text"

Then in question text, place each hint using $hintloc[question part number]

To have the hint to display based on a set of previous answers, you can use:

    $hints[question part number][attempt number] = array("hint text", [part num1, part num 2])

This will display the hint after all the parts listed have had the required attempts or are correct.

To override the default Hint: text, set $hintlabel.

### Help references

To provide help of some sort for a question (typically, links to videos, book references, etc), define $helptext in the common control section. Any text assigned to this variable will show at the bottom of the question. The display of this text is controlled by the same "show hints?" option that controls the display of hints described above.

### Referencing Student Answers

To create multipart questions that are graded on consistency, or to create a set of lab-type problems that rely on student-provided data, you can reference students' previous answers in your question code. You will only be able to reference the student answer to some question types

- $stuanswers[N] will refer to the student's answer on question N (not zero-indexed: N=1 is question 1)
- $stuanswers[N][P] will refer to the student's answer on question N, part P (if multipart)
- $stuanswers[$thisq][P] will refer to the student's answer on the current question, part P
- $stuanswers[$thisq-1] will refer to the student's answer on the previous question
- $stuanswersval[$thisq] or $stuanswersval[$thisq][P] will contain the numerical value of Calculated question types.

Notes (important!):

1) If the student has not answered the question, then $stuanswers[N] === null, with the exception of drop-down select questions, where $stuanswers[N] == "NA" if no selection is made. If used in an equation, it will take on the value 0. To prevent divide-by-zero errors and to prevent students from exploiting this, it is highly recommended that you do something like:

    $a = $stuanswers[$thisq][0]
    $a = rand(1,100) if ($a===null)

Perhaps also include: $warning = "You MUST answer question 1 before this question" if ($a===null), then put $warning in the question text.

2) If you use $stuanswers in your $answer, $showanswer will generally not be defined. If you follow the advice in #1 above, then your $showanswer will reflect the random number assigned to $a. For this reason, it is highly recommended that you custom define the $showanswer.

3) If using the $stuanswers array in a string or in the Question Text, you must enclose it with curly brackets: Your answer was {$stuanswers[0][0]}. If using it directly in a calculation, enclose it in parentheses just to be safe.

4) $stuanswers[$thisq] is defined for question scoring, but may not be for question display.

5) You can use the function getstuans($stuanswers,N,P) to retrieve a student answer value. This method bypasses some strange things that happen when there is a multipart question with only one part, so is recommended.

6) You can use the function stuansready($stuanswers,$thisq,[p1,p2,...]) to determine if the parts have been answered, instead of checking for null.

### Other Reference Variables

A few other special purpose variables can be referenced:

- $scorenonzero: This variable is only available on display, not during scoring. $scorenonzero[$thisq] (or $scorenonzero[$thisq][partindex] for multipart) will be -1 if the question is unanswered, 0 if the score is zero, and 1 if the score is anything above 0.
- $scoreiscorrect: This variable is only available on display, not during scoring. $scoreiscorrect[$thisq] (or $scoreiscorrect[$thisq][partindex] for multipart) will be -1 if the question is unanswered, 1 if the score (before any penalties) is perfect, and 0 otherwise.
- $attemptn: This variable holds the attempt number of the current attempt. 0 is the initial attempt, 1 is the next attempt, etc.
- $partattemptn[part number]: For multipart questions, this holds the attempt number on each part.
- $requestclearla: If you set $requestclearla=true in your code, it will request the display to clear out the student's last answer. This might be useful if your question branches based on attempt count. Example: `$requestclearla = true if ($attemptn==2 && !$scoreiscorrect[$thisq])`

### Reusing Code

You can import in the Common Control code from another question using

    includecodefrom(questionid)

where questionid is the ID number of the question you want to import the code of. In the source question, the variable $included will automatically be set to true when the question has been included, so it can be used to determine if the question has been imported into another question, or is running independently.

For example, in the master/source question, you might use the code:

    if (!$included) {
     $type = rand(0,4)
    }
    do stuff here

In a question using this code, you could limit to a specific type using:

    $type = 0
    includecodefrom(1234)

Question text can be also brought in from another question by using

    includeqtextfrom(questionid)

somewhere in the Question Text portion of the question.

### Teacher Notes

In the question text, you can add a note that will only be viewable by the teacher while grading. Do this by wrapping the teacher note in the [teachernote] shortcode like this: `[teachernote]This is the note[/teachernote]`

## Question Types

The question types available are:

### Number

The student is asked to enter a number (integer, decimal, or scientific notation). The answer is compared to a given tolerance. Can also accept DNE, oo (Infinity), and -oo (Negative Infinity) as answers.

Required Variables

$answer = a number or calculation resulting in a number, like $answer = 5
  Defines the answer. Define multiple acceptable answers in a string separated by or: $answer = "3 or 5 or 7". Alternatively, you can provide an interval notation range of acceptable answers, like $answer = "(2,5]". Providing a range will override any tolerances set. If $answerformat is set for list answers, then this should provide a list of correct answers, like $answer = "1,2,3".

Optional Variables

$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$reqdecimals = a number
  Defines the minimum decimal accuracy required (ie 2 for two decimal places). This will put a message in the answer tips stating the decimals required. If neither $abstolerance or $reltolerance is set, this will set the tolerance, otherwise the provided tolerance will be used (even if it doesn't agree with the $reqdecimal setting).
  $reqdecimals = "=2" can be used to require exactly 2 decimal places in the answer, regardless of how the value rounds (so 3.5 would get marked wrong when the answer is 3.50 if "=2" is used). If you use the "=2" form, it will also round your $answer if needed for the $showanswer.
  When the "=2" form is used, it overrides both $reltolerance and $abstolerance, and by default tests that the student answer exactly matches the correct answer ($abstolerance=0). To override the tolerance use +- in the setting, like this:
  $reqdecimals = "=2+-.01" checks for exactly 2 decimals, but allows the answer to have an absolute error of .01
  $reqdecimals = "=2+-1%" checks for exactly 2 decimals, but allows the answer to have an relative error of 1% (equivalent to $reltolerance = .01)
$reqsigfigs = a number
  Defines the significant figure accuracy required. Use $reqsigfigs = 2 for at least 2 sig fig accuracy, or $reqsigfigs = "=2" to require exactly 2 sig figs in the answer, or $reqsigfigs = "[2,3]" to require 2 or 3 sigfigs. This will put also a message in the answer tips stating the significant figures required. If you use the "=2" form, it will also round your $answer if needed for the $showanswer.
  This setting overrides both $reltolerance and $abstolerance, and by default tests that the student answer rounded to the specified sigfigs matches the correct answer. To override the tolerance use +- in the setting, like this:
  $reqsigfigs = "=2+-.01" checks for exactly 2 sigfigs, but allows the answer to have an absolute error of .01
  $reqsigfigs = "=2+-1%" checks for exactly 2 sigfigs, but allows the answer to have an relative error of 1% (equivalent to $reltolerance = .01)
$answerformat = "list", "exactlist", "orderedlist", "integer, "units", "nosoln", or "nosolninf"
  - Answerformats can be combined, like $answerformat = "nosoln,list"
  - $answerformat = "list", "exactlist", or "orderedlist" specifies that a list of answers is expected.
  - If $answerformat="list", then duplicate values are ignored.
  - If $answerformat="exactlist", then duplicate values are not ignored.
  - If $answerformat="orderedlist", the list must be in the same order and contain identical counts of values.
  - $answerformat = "integer" changes the entry hint to only indicate integers, and rejects answers that contain decimals (except it does allow 2.0 instead of 2)
  - $answerformat = "units" adds unit checking. Supply the answer like `$answer = "3 kg/m^2"`. The student's answer can be in other equivalent units, so "300 cm" is considered equivalent to "3 m". The answer must be in the format `[decimal number]*[unit]^[power]*[unit]^[power].../[unit]^[power]*[unit]^[power]...`, though multiplication can be implied. Also, 'per' may be used for division of units, and 'unit squared', 'square unit', 'unit cubed' and 'cubic unit' may be used. Note that the units do not require mathematically-proper parens around the denominator. The decimal number can include basic scientific notation in 3E5 or 3*10^5 formats. Examples: `4 cm`, and `3.5E4 feet per second squared` Note that tolerances are scaled to the unit, so $answer = "3m" with $abstolerance = .1 would mean .1 meters, so "310cm" would still be within tolerance. If $reqsigfigs is set, the specified number of sigfigs will need to be present in the student's answer, regardless of units.
  - $answerformat = "nosoln" or "nosolninf" adds a list radio buttons for "no solutions" and optionally "infinite solutions". $ansprompt can override the default statements like this: $ansprompt = "One value, x=;No values;Many values"
$partialcredit = array(number,score,[number,score,...])
  Allows you to specify partial credit for other answers. The array should be given in the form array(number,score,number,score,...), where number is the value to compare to the student answer, and score is a proportion between 0 and 1 to award as partial credit. Note this currently only works for single number answers; "or" and list answers are not supported.
$ansprompt = string
  A string that will be displayed in front of the input box. Example: $ansprompt="y="
$displayformat = "alignright"
  Aligns the text in the answer box to the right side
$answerboxsize = number
  Determines the number of characters space provided for entry of an answer. Defaults to 20.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to $answer. Use this to give a detailed answer, or a rounded off answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Calculated

A student is asked to enter a number or a calculation, like 2/3, 5^2, or sin(2). Can also accept DNE, oo (Infinity), and -oo (Negative Infinity) as answers.

Required Variables

$answer = a number or calculation resulting in a number
  Defines the answer. Define multiple acceptable answers in a string separated by or: $answer = "3 or 5 or 7". Alternatively, you can provide an interval notation range of acceptable answers, like $answer = "(2,5]". Providing a range will override any tolerances set
  To have the answer display as a rendered expression, provide the answer as a string. For example, if you want the answer to show as 24 then you'd specify $answer = "2^4". If you specified $answer = 2^4, the answer would display as 16.

Optional Variables

$answerformat = "fraction", or one of the other options below.
  Specifies answer format options. Some can be combined in a list, like this: $answerformat="nodecimal,notrig".
  - Base format types: only use at most one of these at a time
    - fraction: requires the answer to be a single fraction (like 10/6, 1/3, or 5)
    - reducedfraction: a reduced fraction (like 5/3 or 5)
    - mixednumber: a reduced mixed number (like 2 1/2 or 2_1/2, or 2/3 or 5)
    - mixednumberorimproper: a reduced mixed number or improper fraction (like 2 1/2 or 5/2)
    - sloppymixednumber: a mixed number (will take 5/2, 2 1/2, even 1 3/2)
    - scinot: scientific notation (like 2.3*10^4)
    - scinotordec: scientific notation (like 2.3*10^4) or decimal value
    - fracordec: a single fraction or decimal value. Can be combined with "allowmixed" to also allow mixed numbers.
    - decimal: requires the answer to be an integer or decimal value
  - Mix-ins: You can add these as needed to modify what's allowed
    - allowunreduced: can be combined with "mixednumber" or "mixednumberorimproper" to allow unreduced fractional parts
    - allowxtimes: allows the use of x for multiplication (like 23x10^2 for 23*10^2), typically in combo with the "scinot" format
    - allowplusminus: allow use of +- in the answer. Will enable the 'list' option if not already included.
    - nodecimal: require an answer without decimals (also disallows 10^-2 and 3E-2)
    - notrig: require an answer without trig functions (sin,cos,tan,sec,csc,cot)
    - allowmixed: will enable support for mixed numbers (like 2 1/2) in answers
    - allowdegrees: will enable the use of the degree symbol to designate degrees, so sin(30degree)=1/2.
    - noval: tells the answer preview to not compute a decimal equivalent (deprecated - this option is now enabled by default)
    - showval: tells the answer preview to display a decimal equivalent
    - sameform: requires the student's answer be in the "same form" as the correct answer. This means exactly the same, except for commutation of addition and multiplication, multiplication by 1, implicit multiplication, and extra parentheses. Use with caution.
  - List options: only use at most one of these at a time
    - list: a list of answers is expected - ignores duplicate values (1,1,2 is equivalent to 1,2)
    - exactlist: a list of answers is expected - does not ignore duplicates
    - orderedlist: a list of answers is expected - order is important, and duplicates are not ignored
  - Special options:
    - nosoln: adds radio buttons for "no solutions". Use $answer="DNE" if the answer is no solutions.
    - nosolninf: adds radio buttons for "no solutions" and "infinite solutions". Use $answer="DNE" or $answer="oo" respectively if needed.
    - To override the default "no solutions" and "infinite solutions" wording, you can define $ansprompt as a list of semicolon-delimited strings to override the default wording. For example,
      `$ansprompt = "One value, x=;No values;Many values"`
$formatfeedbackon = true
  Turns on "right answer, wrong format" feedback on the question
$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$reqdecimals = a number
  Defines the decimal accuracy required (ie 2 for two decimal places). This will put a message in the answer tips stating the decimals required. If neither $abstolerance or $reltolerance is set, this will set the tolerance, otherwise the provided tolerance will be used (even if it doesn't agree with the $reqdecimal setting).
$reqsigfigs = a number
  Defines the significant figure accuracy required. Only valid for "decimal", "scinot", and "scinotordec" $answerformat options. Use $reqsigfigs = 2 for at least 2 sig fig accuracy, or $reqsigfigs = "=2" to require exactly 2 sig figs in the answer, or $reqsigfigs = "[2,3]" to require 2 or 3 sigfigs. This will put also a message in the answer tips stating the significant figures required. If you use the "=2" form, it will also round your $answer if needed for the $showanswer.
  This setting overrides both $reltolerance and $abstolerance, and by default tests that the student answer rounded to the specified sigfigs matches the correct answer. To override the tolerance use +- in the setting, like this:
  $reqsigfigs = "=2+-.01" checks for exactly 2 sigfigs, but allows the answer to have an absolute error of .01
  $reqsigfigs = "=2+-1%" checks for exactly 2 sigfigs, but allows the answer to have an relative error of 1% (equivalent to $reltolerance = .01)
$requiretimes = a list, like "^,=3,cos,<2"
  Adds format checking to the student's answer. The list can include multiple checks, which come in pairs. The first is the symbol to look for. The second describes what is acceptable. For example, in the string shown above, the symbol "^" would be required to show up exactly 3 times, and "cos" would be required to show up less than 2 times.
  Be aware that if you search for "5,=1", it will match both 5 and 15 and 2.5, since all three strings contain a 5. When searching for numbers, you can avoid this by putting a "#" before the number, like "#5,=1", which would match the 5 but not 15 or 0.5. Beware this type of search ignores signs.
  You can use just "#" in the symbol location to match any number (including decimal values); 3.2^5 would match twice.
  You can match either of two symbols by putting || between them, like ".5||1/2,>0"
  You can use a regular expression by putting in the symbol location "regex:expression"
  You can put "ignore_commas,true" at the beginning of the $requiretimes to ignore commas in the answer
  You can put "ignore_spaces,true" at the beginning of the $requiretimes to ignore spaces in the answer
  You can put "ignore_symbol,$" (or some symbol other than $) at the beginning of the $requiretimes to ignore that symbol in the answer
$requiretimeslistpart = a list, in the same format as $requiretimes
  Similar to $requiretimes, but this check is applied to each element of the answer list when a list $answerformat is used, where $requiretimes would be applied to the entire list of answers. To apply different $requiretimes to each element of the $answer list, separate them with semicolons, like "pi,=1;/,=1;;"
$ansprompt = string
  A string that will be displayed in front of the input box. Example: $ansprompt="y="
$answerboxsize = number
  Determines the number of characters space provided for entry of an answer. Defaults to 20.
$hidepreview = true
  Hides the Preview button. Could be useful in multipart questions, or if you're only asking for a simple response, like a fraction
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to $answer. Use this to give a detailed answer, or a rounded off answer.
$previewloc (In Question Text)
  Where you want the preview button to be located. Defaults to after the entry box if not placed in question text.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Multiple-Choice

A student is asked to select the correct answer from those given. The order of choices is automatically randomized.

Required Variables

$questions (or $choices) = an array of choices
  Defines the choices. If you use $choices, don't define $questions
$answer = the index into $questions that contains the correct answer
  Defines the answer. Remember that arrays are zero-indexed, so if $questions = array("correct","wrong","wrong"), then $answer=0. Define multiple acceptable answer indices in a string separated by or: $answer = "0 or 1".

Optional Variables

$displayformat = "horiz", "select", "2column, "3column", or "inline"
  Will lay out the choices horizontally, as a select box, in multiple columns, or inline with text rather than using the default vertical layout
$noshuffle = "all" or "last" or "last2"
  If $noshuffle="all", then the $questions array will not be randomized (shuffled). If $noshuffle = "last", then the $questions array will be randomized, except for the last element. This is for options like "None of the above". You can use "last2" or "last3" to randomize all but the last 2 or 3 elements.
$partialcredit = array(index,score,[index,score,...])
  Allows you to specify partial credit for other answers. The array should be given in the form array(index,score,index,score,...), where index is the index in $questions, and score is a proportion between 0 and 1 to award as partial credit. For example, if $answer = 0 and $partialcredit = array(2,.3), then the student would get full credit for selecting the item corresponding with $questions[0], and 30% credit for selecting the item corresponding with $questions[2]. All other answers would receive 0 credit.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$ansprompt = string
  When $displayformat = "select" is used, this allows you to override the default "Select an answer" text that displays. Do not use this unless there's a really strong reason to.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the choice list in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Multiple-Answer

A student is asked to select all the choices given that are correct. The order of choices is automatically randomized.

Required Variables

$questions (or $choices)= an array of questions
  Defines the choices. If you use $choices, don't define $questions
$answers = a list of the indexes into $questions that contain the correct answer
  Defines the answers. Remember that arrays are zero-indexed, if $questions = array("correct","correct","wrong"), then $answers="0,1". Or there are more than one correct combination, separate with or, like $answers = "0,1 or 0,3"

Optional Variables

$scoremethod = "answers" or "allornothing" or "takeanything"
  By default, the total points possible are divided by the number of questions, and partial credit is lost for each correct answer missed and each wrong answer selected. If $scoremethod="answers" is set, then the total points possible are divided by the number of answers (tougher grading scheme). If $scoremethod="allornothing", then the student will only get credit if every piece is correct (no partial credit). if $scoremethod="takeanything", full credit will be given for any response.
$displayformat = "horiz", "2column, "3column", or "inline"
  Will lay out the choices horizontally, in multiple columns, or inline with text rather than using the default vertical layout
$noshuffle = "all"
  If $noshuffle="all", then the $questions array will not be randomized (shuffled)
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the choice list in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answers. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Matching

A student is asked to match answers with questions

Required Variables

$questions = an array of questions
  Defines the questions - these will be on the left with entry boxes
$answers = an array of answers
  Defines the answers - these will be on the right and lettered

Optional Variables

$matchlist = a list of the indexes into $answers that contain the match to each question.
  Defines correct matches. By default, it is assumed that each element of $questions is matched one-to-one with the corresponding element of $answers (in other words, that $answers[0] is the answer to $questions[0]).
  $matchlist allows you to define one-to-many matches. Example: if $questions=array("cat","dog","quartz") and $answers=array("animal","mineral"), then $matchlist = "0,0,1"
$questiontitle = string
  Displays a title above the list of questions. For example, if $questions was a list of states, then $questiontitle="States" would be appropriate
$answertitle = string
  Displays a title above the list of answers
$noshuffle = "questions" or "answers"
  Retains original order of questions or answers, and only shuffles the other. By default, both lists are shuffled
$displayformat = "select" or "2columnselect"
  Only displays the $answers, with select boxes next to each containing the $questions. This should only be used with pure text $questions.
$scoremethod = "allornothing"
  Setting "allornothing" will mean no partial credit is given, and the student must match all parts correctly to get credit.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place matching questions and answers in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the list of correct matches. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Function

A student is asked to enter a function

Required Variables

$answer = string
  Defines the answer function, entered as a string. For example, $answer="2sin(x)". You can specify multiple acceptable answers by separating with "or", like $answer="x^2 or x^4"
  Note: The system will accept any algebraically equivalent answer. To only allow answers of a specific format, you'll also need to define $requiretimes (see below).

Optional Variables

$variables = string
  A list of all variables in the function (including letters representing constants). Defaults to "x". Can use "f()" to indicate a symbol represents a function.
$domain = "inputmin,inputmax"
  Defines the domain on which to compare the given answer and correct answer functions. The same domain applies to all variables. An option third list element "integers" can be given, which limits the domain to integer values. The domain defaults to real numbers from -10 to 10. If using multiple variables, can extend domain to define domain for each variable separately. Example: $variables = "x,y"; $domain = "0,5,20,25"
$requiretimes = a list, like "^,=3,cos,<2"
  Adds format checking to the student's answer. The list can include multiple checks, which come in pairs. The first is the symbol to look for. The second describes what is acceptable. For example, in the string shown above, the symbol "^" would be required to show up exactly 3 times, and "cos" would be required to show up less than 2 times. You can use "#" in the symbol location to match any number (including decimal values); 3.2x+42y would match twice.
  You can use a regular expression by putting in the symbol location "regex:expression"
  You can match either of two symbols by putting || between them, like "x^-3||/x^3,>0"
  Include "ignore_case,false" to make the search case sensitive.
  You can put "ignore_spaces,true" at the beginning of the $requiretimes to ignore spaces in the answer
  Include "ignore_symbol,$" (or some symbol other than $) at the beginning of the $requiretimes to ignore that symbol in the answer
  Note that commas are ignored by default with Function type, and a basic exponent like x^(-3) is converted to x^-3 before the check.
$answerformat = "equation" or "inequality" or "toconst" or "scalarmult" or "nosoln" or "nosolninf" or "sameform" or "list" (can combine, like "equation,nosoln")
  By default, the student answer is expected to be an expression, and be equivalent (at points) to the specified answer. This option changes this behavior.
  "equation": Specifies that the answer expected is an equation rather than an expression. The given answer should also be an equation. Be sure to specify all variables in the equation in $variables. This may fail on equations that are near zero for most values of the input; this can often be overcome by changing the $domain
  "inequality": Specifies that the answer is expected to be an inequality rather than an expression. The given answers should also be an inequality. Be sure to specify all variables in the equation in $variables. This may fail on equations that are near zero for most values of the input; this can often be overcome by changing the $domain
  "list": Allow a list of expressions or equations to be entered. Does not ignore duplicates. You cannot use this in combination with $partialcredit. $requiretimes will apply to each element of the list.
  "toconst": Specifies that the answer provided by the student is allowed to differ from the specified answer by a constant for all inputs. Appropriate for comparing antiderivatives. This may fail on expressions that evaluate to very large values or raise numbers to very large powers.
  "scalarmult": Specifies that the answer provided by the student is allowed to differ from the specified answer by a scalar multiple.
  "allowplusminus": allow use of +- in the answer. Will enable the 'list' option if not already included.
  "nosoln" or "nosolninf" adds a list radio buttons for "no solutions" and optionally "infinite solutions". $ansprompt can override the default statements like this: $ansprompt = "One function, f(x)=;No such function exists"
  "sameform": requires the student's answer be in the "same form" as the correct answer. This means exactly the same, except for commutation of addition and multiplication, multiplication by 1, implicit multiplication, and extra parentheses. (2x-3)(5-x) would be "sameform" as (-1x+5)(2*x-3), but 2/4x and 1/2x and 0.5x would not be "sameform". Use with caution.
$partialcredit = array(string,score,[string,score,...])
  Allows you to specify partial credit for other answers. The array should be given in the form array(string,score,string,score,...), where string is the expression to compare to the student answer, and score is a proportion between 0 and 1 to award as partial credit. Note this currently only works for single expression answers; "or" answers are not supported.
$formatfeedbackon = true
  Turns on "right answer, wrong format" feedback on the question
$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$ansprompt = string
  A string that will be displayed in front of the input box. Example: $ansprompt="y="
$answerboxsize = number
  Determines the number of characters space provided for entry of an answer. Defaults to 20.
$hidepreview = true
  Hides the Preview button. Could be useful in multipart questions, but generally not recommended
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to makeprettydisp($answer).
$previewloc (In Question Text)
  Where you want the preview button to be located. Defaults to after the entry box if not placed in question text.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### String

A student is asked to enter a string (a word or list of letters).

Required Variables

$answer = a string
  Defines the answer. Multiple acceptable answers can be entered using "or". Example: $answer = "dog or cat"

Optional Variables

$strflags = string of flags, like "ignore_case=1,trim_whitespace=0"
  Determines how the string will be compared. Set to 1 to turn on, 0 for off. Flags are:
  - ignore_case: ignores capitol/lowercase differences
  - trim_whitespace: trims leading and ending whitespace (spaces)
  - compress_whitespace: compresses multiple spaces to one space and trims
  - remove_whitespace: removes all whitespace (spaces)
  - ignore_order: treats ABC and CBA as equivalent
  - ignore_commas: removes commas
  - partial_credit: awards partial credit based on Levenshtein distance between strings
  - allow_diff=n: gives full credit for answers with Levenshtein distance between strings ≤ n
  - in_answer: gives credit if $answer is contained anywhere in the student answer
  - regex: interprets $answer as a regular expression (pattern) to evaluate the student's answer. For example, $answer="cost.*increas" will give credit if the word cost appears before increas in the student's answer. $answer="increas|ris" will accept any of the following: increasing, increases, rising, or risen etc.
  - special_or: use *or* for separating answers rather than or.
  - ignore_symbol=sym: Unlike the other flags, this is not an on/off flag. Set this equal to a symbol to ignore that symbol in student answers. This flag can be used multiple times with different symbols.
  By default, compress_whitespace and ignore_case are On. Only one of partial_credit, allow_diff, in_answer or regex may be used at a time.
$scoremethod = "takeanything" or "takeanythingorblank" or "submitblank"
  "takeanything" or "takeanythingorblank" sets the problem to give full credit for any answer. "takeanythingorblank" also counts blank answers as correct. "submitblank" will cause blank answers to get submitted for scoring (new system only).
$answerformat = "list" or "logic" or "setexp"
  "list" specifies that a list of answers is expected. Renders ignore_commas unnecessary. Cannot be used with partial_credit flag. Duplicates are not ignored.
  "logic" enables a separate grading algorithm for logic statements, ignoring $strflags. The $answer should be given using vv for or, ^^ for and, neg for not, xor for exclusive or, => for conditional, and <=> for biconditional. Parens are supported, but no other symbols. The variables used in the logic expression must be declared by defining $variables.
  "setexp" enables a separate grading algorithm for set expression statements, ignoring $strflags. The $answer should be given using 'nn' for intersection, 'uu' for union, '-' for set difference, '^c' for set complement, and 'oplus' for symmetric difference.
$displayformat = "usepreview" or "typeahead" or "usepreviewnomq"
  "usepreview" enables mathquill entry for mathematical answers.
  "usepreviewnomq" adds a preview button for previewing mathematical answers in asciimath.
  "typeahead" will enable an auto-suggest list of options once the student has typed at least two letters of the word. Provide the auto-suggest list in the variable $questions.
$variables
  When $answerformat="logic" or "setexp" is used, define the $variables in the logic statement, like "p,q"
$requiretimes = a list, like "^,=3,cos,<2"
  Adds format checking to the student's answer. Usually not needed for string questions, but can be useful when the "logic" or "setexp" answerformat is used. The list can include multiple checks, which come in pairs. The first is the symbol to look for. The second describes what is acceptable. For example, in the string shown above, the symbol "^" would be required to show up exactly 3 times, and "cos" would be required to show up less than 2 times.
$ansprompt = string
  A string that will be displayed in front of the input box. Example: $ansprompt="type: "
$answerboxsize = number
  Determines the number of characters space provided for entry of an answer. Defaults to 20.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the answer entry box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Essay

A student is asked to enter a free-response answer. The essay type is not automatically graded.

Required Variables

None - the essay type is not computer graded.

Optional Variables

$answerboxsize = "rows" or $answerboxsize = "rows,columns"
  Determines size of space provided for entry of an answer. Defaults to 5 rows, 50 columns.
$displayformat = "editor"
  Use the rich text editor for the essay answer box.
$scoremethod = "takeanything" or "takeanythingorblank" or "nomanual"
  The first two sets the problem to give full credit for any answer. The second also counts blank answers as correct. The "nomanual" option will give no credit for any answer, but doesn't mark the question as needing manual grading.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the essay box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Drawing

Drawing questions require the student to draw one or more lines/curves or dots. Dots are graded right/wrong. Lines/curves are graded based on the deviation of the drawn line from the correct line.

Required Variables

$answers = a string or array of strings describing the points or curves to be drawn
  Curves: "f(x)" like "x^2+3".
  Line segments or rays: "f(x),xmin,xmax", like "x+1,-3,2" or "x+1,-oo,3"
  Dots: "x,y" for closed dots, "x,y,open" for open dots, like "2,3"
  See below for additional entry formats for other curves when using "twopoint" drawing.
  When using twopoint drawing, you can preface an answer with "optional", like "optional,2,3", to indicate that drawing element is not required, but shouldn't mark down the score if present.

Recommended Variables

$answerformat = "twopoint", "polygon", "inequality", "numberline", "freehand", or (for the older tools), "line,lineseg,dot,opendot"
  Limits the drawing tools available to students. Defaults to the older drawing tools "line,dot,opendot".

  $answerformat="twopoint" will use a different set of drawing tools for specific shapes that all use two control points to define the shape. It is strongly recommended you use these instead of the older tools.

  - $answerformat="twopoint" will use a default tool set of line, parabola, absolute value, circle, and dot tools
  - You can limit or expand the tools by specifying them: e.g. $answerformat = "twopoint,line,parab". Valid values are:
    - line (lines)
    - lineseg (line segment)
    - ray (rays)
    - parab (vertical parabolas)
    - horizparab (horizontal parabolas)
    - halfparab (half a vertical parabola)
    - cubic (a(x-h)^3+k style cubics)
    - abs (absolute value)
    - circle (circles)
    - dot (open and closed dots)
    - sqrt (square root)
    - cuberoot (cube root)
    - trig (sin and cos)
    - vector (position or displacement vectors)
    - exp (exponential with horizontal asymptote at y=0)
    - genexp (exponential with any horizontal asymptote)
    - log (logarithm with vertical asymptote at x=0)
    - genlog (logarithm with any vertical asymptote)
    - rational (linear/linear rational)
    - ellipse (ellipses)
    - hyperbola (vertical or horizontal hyperbolas)
  - For lines, vertical parabolas, absolute values, square roots, cubics, cuberoots, sines, cosines, exponentials, logs, and rationals (linear/linear only) give $answers as a function of x, like "2(x-1)^2+3"
  - For line segments and rays, given $answers as a function with domain, like "2x+4,-oo,3", or for vertical line segments use x= and give the range, like "x=4,-2,3"
  - For dots give $answers as "x,y", or "x,y,open" for open dots
  - For circles, give $answers as "circle,x,y,radius", like "circle,2,-1,3"
  - For ellipses, give $answers as "ellipse,x,y,x_radius,y_radius", like "ellipse,1,2,4,2"
  - For hyperbolas of form (x-h)^2/a^2-(y-k)^2/b^2=1, give $answers as "horizhyperbola,h,k,a,b"
  - For hyperbolas of form (y-k)^2/a^2-(x-h)^2/b^2=1, give $answers as "verthyperbola,h,k,a,b"
  - For horizontal parabolas give $answers as "x=equation", like "x=2(y-1)^2-3".
  - For half parabolas give $answers as "equation,>xvertex", like "(x-1)^2-3,>1". Note only half parabolas are supported, not arbitrary segments.
  - For vertical lines give $answers as "x=number", like "x=3".
  - For vectors, give $answers as "vector, x_start, y_start, x_end, y_end" for position vectors, or "vector, dx, dy" for displacement vectors

  $answerformat = "polygon" can be used for drawing a single polygon; give $answer as array of points in order joined with edges.

  $answerformat = "closedpolygon" can be used for drawing a single polygon that is closed; the enclosed area will be shaded and the drawing terminate when the shape is closed. The format is the same as "polygon", except make sure the first and last entry of your $answers array are identical.

  $answerformat="inequality" will use a set of drawing tools for graphing linear inequalities in two variables. Give $answers for non-vertical lines in form like ">=3x+4", "<5x+4", and "x<=3" for vertical lines.

  $answerformat="inequality,parab" will use a set of drawing tools for graphing quadratic inequalities in two variables. Give $answers in form like ">=x^2-4", "<x^2+1". Use $answerformat="inequality,both" to turn on lines and parabolas.

  $answerformat="inequality,abs" will use a set of drawing tools for graphing absolute value inequalities in two variables. Give $answers in form like ">=abs(x-3)+4", "<3abs(x)". Use $answerformat="inequality,line,abs,parab" or some combo to turn on multiple tools.

  $answerformat="numberline" will use a set of drawing tools for graphing inequalities or points in one variable on a number line. Give $answers as dots and line segments, or use the intervalstodraw function from the interval macro library to form the $answers array.

  $answerformat="freehand" will allow freehand drawing without any drawing tools. This mode can NOT be autograded, and should only be used for manually graded answers.

  $answerformat can also be used to limit the older tools: $answerformat = "line", or $answerformat = "line,dot"

$snaptogrid = spacing
  Turns on snapping, where points will jump to a grid. $snaptogrid = 1 will jump to the nearest integer. $snaptogrid = 0.5 will jump to the nearest .5. $snaptogrid = "2:4" will jump to the nearest 2 in the x and 4 in the y. Does not have to match the actual grid line spacing. Be aware that due to pixelation, the snapping may not land on exact values correctly. This is usually corrected for automatically, but it sometimes fails if the correction would be too large. In that case, use the getsnapwidthheight macro to compute an imagewidth and imageheight that will be pixel accurate.

Optional Variables

$grid = "xmin,xmax,ymin,ymax,xscl,yscl,imagewidth,imageheight"
  Defines the grid to be drawn on. Defaults to "-5,5,-5,5,1,1,300,300". You can set all or just some of the values. For example, to just set the window, you could use "0,10,0,10"
  If using $answerformat="numberline", set ymin and ymax to 0.
  If desired, you can set separate label and grid spacing using "xmin,xmax,ymin,ymax,xlabelspacing:xgridspacing,ylabelspacing:ygridspacing,imagewidth,imageheight". You can specify axis labels using "xmin,xmax,ymin,ymax,xlabelspacing:xgridspacing:xaxislabel,ylabelspacing:ygridspacing:yaxislabel,imagewidth,imageheight". To create first quadrant graphs, use "0:-n" (for some value of n) for xmin and/or ymin to only have gridlines and labels after 0, while still using -n to adjust spacing.
$background = equation or array of equations, using the showplot macro format
  Define a graph to display in the background, to be drawn on top of. Example: $background = "x^2,red".
  You can also set $background a string of asciisvg commands prefaced with "draw:", like "draw:line([1,1],[3,3]);". Note that initPicture and axes will already have been called, so do not include them.
  You can also set $background to "none" to remove axes and the grid.
$partweights = array or list of weights
  Defines grading weight for each line or dot in $answers. Example: $partweights = ".5,.25,.25". Defaults to equal weights on each line or dot.
$reltolerance = tolerance scaling factor
  Scales the grading tolerance. Defaults to 1. Set $reltolerance = 2 to make the grading twice as tolerant; $reltolerance = 0.5 to make grading half as forgiving
$abstolerance = grading cutoff
  Sets all-or-nothing grading. If score < $abstolerance, the student receives 0 for the question (note: score is between 0 and 1). Otherwise the student will receive full credit. Not set by default.
$scoremethod = "takeanything", "direction", "relativelength"
  When "takeanything" is used, this will give full credit for any non-blank answer. This might be of use with the freehand drawing option.
  "direction" and "relativelength" are only used for vectors. "direction" will score the initial point and direction for position vectors, but not length, and will only score direction for displacement vectors. "relativelength" will score like "direction", but will also check that the drawn vectors have correct lengths relative to each other.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### N-Tuple

N-Tuple questions require the student to enter an n-tuple or list of n-tuples. This can be used for coordinate points, vectors, or any other n-tuple of numbers.

Required Variables

$answer = a string containing an n-tuple or list of n-tuples
  Defines the answer n-tuple or list of n-tuples. N-tuples can be any dimension, but must be surrounded by any of: (), [], {}, <>. Examples: $answer = "(1,2)", $answer = "<2,3,4>,<1,5,7>", $answer = "(1,2) or (1,3)"

Optional Variables

$displayformat = "point", "pointlist", "vector", "vectorlist", "list", "set", "setlist"
  Changes the answer entry tips (does NOT change how the question is graded). For points, entry like (2,3) is specified. For vectors, entry like <2,3> is specified.
$answerformat = "scalarmult", "anyorder", "nosoln", "nosolninf"
  "scalarmult" will accept any answer that is a scalar multiple of the correct answer.
  "anyorder" will accept elements in any order, so (2,1) would be treated equivalent to (1,2)
  $answerformat = "nosoln" or "nosolninf" adds a list radio buttons for "no solutions" and optionally "infinite solutions". $ansprompt can override the default statements like this: $ansprompt = "One value, x=;No values;Many values"
$scoremethod = "byelement"
  By default, the whole n-tuple must be correct to receive any credit. Set $scoremethod = "byelement" to give partial credit if only some elements of the n-tuple are correct.
$partweights = ".2,.8"
  Can be used with $scoremethod = "byelement" to change the value of each part of the ntuple
$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Calculated N-Tuple

Calculated N-Tuple questions require the student to enter an n-tuple or list of n-tuples. This can be used for coordinate points, vectors, or any other n-tuple of numbers. This is identical the the N-tuple answer type, but allows students to enter mathematical expressions rather than just numbers, such as (5/3, 2/3).

Required Variables

$answer = a string containing an n-tuple or list of n-tuples
  Defines the answer n-tuple or list of n-tuples. N-tuples can be any dimension, but must be surrounded by any of: (), [], {}, <>. Examples: $answer = "(1/3,2)", $answer = "<2,3,4>,<1,5,7>", $answer = "(1,2) or (1,3)"

Optional Variables

$displayformat = "point", "pointlist", "vector", "vectorlist", "list", "set", "setlist"
  Changes the answer entry tips (does NOT change how the question is graded). For points, entry like (2,3) is specified. For vectors, entry like <2,3> is specified.
$answerformat = "scalarmult", "anyorder", "fraction", "reducedfraction", "mixednumber", "scinot", "fracordec", "nodecimal", "notrig", "nosoln", "nosolninf", "sameform"
  "scalarmult" will accept any answer that is a scalar multiple of the correct answer.
  "anyorder" will accept elements in any order, so (2,1) would be treated equivalent to (1,2)
  The other options require each component of the answer to be a single fraction (like 10/6), a reduced fraction (like 5/3), a reduced mixed number (like 2_1/2), scientific notation (like 2.3*10^4), a single fraction or decimal, an answer without decimals (also disallows 10^-2 and 3E-2), or an answer without trig functions (sin,cos,tan,sec,csc,cot). Multiple options can be specified like $answerformat="nodecimal,notrig".
  $answerformat = "nosoln" or "nosolninf" adds a list radio buttons for "no solutions" and optionally "infinite solutions". $ansprompt can override the default statements like this: $ansprompt = "One value, x=;No values;Many values"
$scoremethod = "byelement"
  By default, the whole n-tuple must be correct to receive any credit. Set $scoremethod = "byelement" to give partial credit if only some elements of the n-tuple are correct.
$partweights = ".2,.8"
  Can be used with $scoremethod = "byelement" to change the value of each part of the ntuple
$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Complex

Complex questions require the student to enter a complex number in a+bi form.

Required Variables

$answer = a string containing a complex number or list of complex numbers
  Defines the answer. Example: $answer="3+2i"

Optional Variables

$answerformat = "list"
  Specifies that the answer will be a list of complex numbers.
$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Calculated Complex

Calculated Complex questions require the student to enter a complex number in a+bi form. This is identical to the Complex answer type, but allows students to enter mathematical expressions rather than just numbers, such as 1/3+sqrt(2)i.

Required Variables

$answer = a string containing a complex number or list of complex numbers
  Defines the answer. Example: $answer="3+2i", $answer="2/3+1/3i". The answer must be given in a + bi format (so 2+3isqrt(2) or 5/2+i/3 will not work) unless $answerformat="sloppycomplex" is used.

Optional Variables

$answerformat = "sloppycomplex", "fraction", "reducedfraction", "mixednumber", "scinot", "fracordec", "nodecimal", "notrig", or "sameform"
  Use "sloppycomplex" to allow the student to enter complex numbers in forms other than a+bi (allows 2+3isqrt(2) for example). Student answer must still only contain one i.
  The other options requires the real and imaginary parts of the answer to be a single fraction (like 10/6), a reduced fraction (like 5/3), a reduced mixed number (like 2_1/2), scientific notation (like 2.3*10^4), a single fraction or decimal, an answer without decimals (also disallows 10^-2 and 3E-2), or an answer without trig functions (sin,cos,tan,sec,csc,cot). Multiple options can be specified like $answerformat="nodecimal,notrig".
  $answerformat = "list" specifies that the answer will be a list of complex numbers.
  allowplusminus allow use of +- in the answer. Will enable the 'list' option if not already included.
  $answerformat = "nosoln" or "nosolninf" adds a list radio buttons for "no solutions" and optionally "infinite solutions". $ansprompt can override the default statements like this: $ansprompt = "One value, x=;No values;Many values"
$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Numerical Matrix

The student is asked to enter a matrix of numbers (integer, decimal, or scientific notation). The entries are compared to a given tolerance.

Required Variables

$answer = string describing a matrix of numbers, or calculations leading to numbers
  Defines the answer. Example: $answer = "[(1,2,3),(8/2,5,6)]" is a 2x3 matrix with first row: 1,2,3

Optional Variables

$answersize = "rows,cols"
  Defines the size of the answer matrix. If this is supplied, the student will be provided with a grid of entry boxes in which to input the matrix. If this is not supplied, they will be required to enter the matrix using the ASCIIMath notation, like "[(1,2,3),(4,5,6)]"
$answerformat = "scalarmult" or "ref"
  If "scalarmult" used, any scalar multiple of the correct matrix will be accepted.
  If "ref" is used, any row echelon form matrix that is row equivalent will be accepted.
$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$scoremethod = "byelement"
  By default, the whole matrix must be correct to receive any credit. Set $scoremethod = "byelement" to give partial credit if only some elements of the matrix are correct.
$displayformat = "det"
  When $answersize is used, by default square brackets are used around the entry array. Set $displayformat = "det" to use vertical bars instead.
$ansprompt = string
  A string that will be displayed in front of the input box. Example: $ansprompt="y="
$answerboxsize = number
  Determines the number of characters space provided for entry of an answer. Defaults to 20. Will only be used if $answersize is not supplied.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to $answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Calculated Matrix

The student is asked to enter a matrix of numbers or calculations, like 2/3 or 5^2. The entries are compared to a given tolerance.

Required Variables

$answer = string describing a matrix of numbers, or calculations leading to numbers
  Defines the answer. Example: $answer = "[(1,2,3),(8/2,5,6)]" is a 2x3 matrix with first row: 1,2,3

Optional Variables

$answersize = "rows,cols"
  Defines the size of the answer matrix. If this is supplied, the student will be provided with a grid of entry boxes in which to input the matrix. If this is not supplied, they will be required to enter the matrix using the ASCIIMath notation, like "[(1,2,3),(4,5,6)]"
$answerformat = "scalarmult","ref","fraction", "reducedfraction", "mixednumber", "scinot", "fracordec", "nodecimal", or "notrig"
  Requires the entries of the answer to be a single fraction (like 10/6), a reduced fraction (like 5/3), a reduced mixed number (like 2_1/2), scientific notation (like 2.3*10^4), a single fraction or decimal, an answer without decimals (also disallows 10^-2 and 3E-2), or an answer without trig functions (sin,cos,tan,sec,csc,cot). Multiple options can be specified like $answerformat="nodecimal,notrig".
  If "scalarmult" used, any scalar multiple of the correct matrix will be accepted.
  If "ref" is used, any row echelon form matrix that is row equivalent will be accepted.
$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$scoremethod = "byelement"
  By default, the whole matrix must be correct to receive any credit. Set $scoremethod = "byelement" to give partial credit if only some elements of the matrix are correct.
$displayformat = "det"
  When $answersize is used, by default square brackets are used around the entry array. Set $displayformat = "det" to use vertical bars instead.
$ansprompt = string
  A string that will be displayed in front of the input box. Example: $ansprompt="y="
$answerboxsize = number
  Determines the number of characters space provided for entry of an answer. Defaults to 20. Will only be used if $answersize is not supplied.
$hidepreview = true
  Hides the Preview button. Could be useful in multipart questions, but generally not recommended
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the question input box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to $answer. Use this to substitute a detailed answer.
$previewloc (In Question Text)
  Where you want the preview button to be located. Defaults to after the entry box if not placed in question text.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Interval

A student is asked to enter an interval notation answer. Example: (2,5]U(7,oo)

Required Variables

$answer = a string with the answer in interval notation
  Defines the answer. Join multiple intervals with U for union. Example: $answer = "(-oo,4]U(3,oo)". Use DNE for empty set. Multiple acceptable answers can be entered using "or". Example: $answer = "(3,3) or [3,3]"

Optional Variables

$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$reqdecimals = a number
  Defines the decimal accuracy required (ie 2 for two decimal places). This will put a message in the answer tips stating the decimals required. If neither $abstolerance or $reltolerance is set, this will set the tolerance, otherwise the provided tolerance will be used (even if it doesn't agree with the $reqdecimal setting).
$answerformat = "normalcurve" or "list"
  "normalcurve" Changes the question to use a "shade the area under the normal curve" widget. Define $answer using the interval that should be shaded. Note that the shading tool only allows selection of z-values to 1 decimal place.
  "list" will accept a list of comma-separated intervals like $answer="[2,3),(5,7)"
$scoremethod = "partialcredit"
  By default, interval answers will be marked all right or all wrong. Setting $scoremethod = "partialcredit" will changing the scoring mode to give partial credit. (new assessment system only).
$ansprompt = string
  A string that will be displayed in front of the input box. Example: $ansprompt="`x in`"
$answerboxsize = number
  Determines the number of characters space provided for entry of an answer. Defaults to 20.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the entry box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Calculated Interval

A student is asked to enter an interval notation answer. Example: (2,5]U(7,oo). Values can be entered as calculations rather than numbers, like [2/5,sqrt(8)]. Can use $answerformat="inequality" to require the student to use inequalities rather than interval notation.

Required Variables

$answer = a string with the answer in interval notation
  Defines the answer. Join multiple intervals with U for union, and oo for infinity. Example: $answer = "(-oo,4]U(9/2,oo)". Use DNE for empty set. Multiple acceptable answers can be entered using "or". Example: $answer = "(3,3) or [3,3]".

Optional Variables

$answerformat = "fraction", "reducedfraction", "mixednumber", "scinot", "fracordec", "nodecimal", "notrig", "list", or "inequality"
  Requires the each value in the answer to be a single fraction (like 10/6), a reduced fraction (like 5/3), a reduced mixed number (like 2_1/2), scientific notation (like 2.3*10^4), a single fraction or decimal, an answer without decimals (also disallows 10^-2 and 3E-2), or an answer without trig functions (sin,cos,tan,sec,csc,cot). Multiple options can be specified like $answerformat="nodecimal,notrig".
  $answerformat = "inequality" will require the student to enter an inequality rather than an interval. The instructor answer must still be given in interval notation (it will be reformatted to an inequality automatically for the Show Answer). Use $variables="y" to change the variable of the inequality.
  "list" will accept a list of comma-separated intervals like $answer="[2,3),(5,7)". Does not work with "inequality".
$reltolerance = a decimal value
  Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is used by default.
$abstolerance = a number
  Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
$reqdecimals = a number
  Defines the decimal accuracy required (ie 2 for two decimal places). This will put a message in the answer tips stating the decimals required. If neither $abstolerance or $reltolerance is set, this will set the tolerance, otherwise the provided tolerance will be used (even if it doesn't agree with the $reqdecimal setting).
$scoremethod = "partialcredit"
  By default, interval answers will be marked all right or all wrong. Setting $scoremethod = "partialcredit" will changing the scoring mode to give partial credit. Note that answers not meeting $answerformat requirements will have deductions in addition to correctness checks. (new assessment system only).
$ansprompt = string
  A string that will be displayed in front of the input box. Example: $ansprompt="`x in`"
$answerboxsize = number
  Determines the number of characters space provided for entry of an answer. Defaults to 20.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the entry box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.
$previewloc (In Question Text)
  Where you want the preview button to be located. Defaults to after the entry box if not placed in question text.
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Chemical Equation

A student is asked to enter a chemical formula, or use $answerformat="reaction" to ask for a reaction equation.

Required Variables

$answer = a string with the answer
  Defines the answer, like "H_2O". Spaces are ignored. For reactions, use `->` for a right arrow, and `<->` for an equilibrium arrow, like "2H+O->H_2O".

Optional Variables

$answerformat = "reaction"
  Use "reaction" if you're asking for a reaction equation.
$variables = a list of atoms
  Define this to populate the equation editor with the specified atoms.
$answerboxsize = number
  Determines the number of characters space provided for entry of an answer. Defaults to 20.
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the entry box in that location
$showanswer
  The answer to show to students (if option if available). Defaults to the text of the correct answer. Use this to substitute a detailed answer.

### File Upload

A student is asked to upload a file. The file upload type is not automatically graded.

Required Variables

None - the file upload type is not computer graded.

Optional Variables

$scoremethod = "takeanything" or "takeanythingorblank"
  Sets the problem to give full credit for any answer. The latter also counts blank answers as correct.
$answerformat = "images", "canpreview", or a list of file extensions
  Set a list of preferred file formats for the file selector. "images" is a shorthand for .jpg,.gif,.png,.jpeg. "canpreview" is a shorthand for image files, office files, and pdfs, which can be previewed inline. If listing file extensions, provide a comma separated list with leading periods, like ".pdf,.docx,.doc"
$readerlabel = string
  A string that will be used as a visually hidden label on the input box for screenreaders.
$answerbox (In Question Text)
  Using the variable $answerbox in the Question Text will place the file upload box in that location
$showanswer
  The answer to show to students (if option if available).
$hidetips = true
  Hides the question entry tips that display by default. This should only be used when a question type is being used in an unintentional way, or if the question type gives away critical info to the student.

### Multipart

This type of question can contain multiple parts, where each part is one of the previous question types.

Required Variables

$anstypes = an array or list of answer types
  Defines the answer type for each part. Example: $anstypes = array("number","number","choices")
  Refer to this list for the short names of each question type:
  - Number: "number"
  - Calculated: "calculated"
  - Multiple Choice: "choices"
  - Multiple Answer: "multans"
  - Matching: "matching"
  - Function/expression: "numfunc"
  - Drawing: "draw"
  - N-tuple: "ntuple"
  - Calculated N-tuple: "calcntuple"
  - Matrix: "matrix"
  - Calculated Matrix: "calcmatrix"
  - Complex: "complex"
  - Calculated Complex: "calccomplex"
  - Interval: "interval"
  - Calculated Interval: "calcinterval"
  - Chemical Equation: "chemeqn"
  - Essay: "essay"
  - File Upload: "file"
  - String: "string"
Question part variables
  For each question part, you will need to define the variables (like $answer, $questions, etc.) you would normally need to define. However, you will need to suffix the variable with a part designator. For example, based on $anstypes above, the first answer is a number. Instead of $answer = 5, enter $answer[0] = 5. This designates that this answer belongs to the first element of $anstypes. Likewise, to set the variables for the "numfunc" type, you'd set $variables[5] = "x".
$answerbox[partnum] (In Question Text)
  The array $answerbox will contain the entry boxes for each answer type. In the question text, you will need to position these boxes within the question. For example: "Enter a number: $answerbox[0]. Now a function: $answerbox[1]". Alternatively, you can use [AB#]: "Enter a number: [AB0]. Now a function: [AB1]"

Optional Variables

$answeights = an array or list of weights for each question
  By default the points for a problem are divided evenly over the parts. Use this option if you wish to weight parts differently. Example: $answeights = array(.2,.3,.5). Best practice is to use percents, but if other values are used, they will be converted to percents.
$scoremethod = "singlescore" or "allornothing"
  Instead of recording individual scores for each question part, these will cause a single score to be recorded for the question. "singlescore" totals the individual part scores, while "allornothing" will only give full credit or no credit. If you need to specify per-part indexed scoremethod values as well, you can define this as the array value $scoremethod['whole'] instead.
Question part options
  You can define any optional variable for each question part. Like above, suffix the variable with the part designator.
$showanswer
  You can either define $showanswer for individual question parts (ie, $showanswer[1]="`x^2`"), or you can set one $showanswer, which will be the only answer shown for the problem (ie, $showanswer = "x=$answer[0], y=$answer[1]")
$showanswerloc (In Question Text)
  Optionally, you can use $showanswerloc to place a single $showanswer "Show Answer" button, or $showanswerloc[part] to place "Show Answer" buttons for each part. You can also use short tags of the form [SAB] or [SABn] (like [SAB2]). Note that if you use this to place one Show Answer button, you must place all of them, or else the remainder will not show. Use $showanswerstyle = 'inline' to allow Show Answer to be placed inline with text rather than on its own line.

Scaffolding

Scaffolded questions, also know as Sequential Multipart questions, allow you to break a question up into chunks, where the second chunk only shows after the first chunk is correctly answered or the student runs out of tries. This allows you to use the answer to the first chunk in the second without "giving away" the answer, and allows a student who gets stuck on the first chunk to move on to the rest of the question.

Note: scaffolding is only available in the new assessment interface. If you are using the old interface, the question will behave like a regular multipart question.

Scaffolded questions are an extension of Multipart questions. To turn a multipart question into a scaffolded question, just add an isolated line with three or more slashes in the Question Text where you want the chunks broken apart.

An example: (in the Question Text)

    To simplify $a(x+$b) + $c, first we need to distribute:

    $a(x+$b) = $answerbox[0]

    ///

    Next, combine like terms:

    $a x + $ab + $c = $answerbox[1]

### Conditional

A variation on multipart questions, a conditional question can include multiple answer boxes, but assigns a single score. The score is based on applying some comparison or conditional test to the student answers, referenced through the $stuanswers array. This allows the question writer to essentially create their own question type.

Required Variables

$anstypes = an array or list of answer types
  Defines the answer type for each part. Example: $anstypes = "number,number". See the Multipart help above for the list of short names
$answer = any of these:
  - A boolean (true/false) expression: Something that evaluates to true or false.
    Example: $answer = ($a>3)
    Example: $answer = comparefunctions($f,'x^2') && ($a!=0)
  - A single numerical value in the interval [0,1]: will award that percentage of the total possible points.
  - array('function',$a,$b): Will compare the functions $a and $b and mark the question correct if they are equivalent. Can set $variables, $reltolerance, $abstolerance, and $domain as needed, like with Function type questions
  - array('number',$a,$b): Will compare the numbers or numerical expressions $a and $b and mark the question correct if they are equivalent. Can set $reltolerance or $abstolerance as needed, like with Number/Calculated type questions
  - Multiple comparisons: You can mix the two types above by creating an array of comparisons. All must be true for the question to be marked correct.
    Example: $answer = array($a>3, array('function',$b,c), array('number',evalfunc($b,$a),5))
Question part variables
  For each question part, you will need to define the variables (like $questions, etc.) you would normally need to define, except you should not define an $answer. However, you will need to suffix the variable with a part designator. For example, based on $anstypes above, the first answer is a number. Instead of $displayformat = "select", enter $displayformat[0] = "select". This designates that this setting belongs to the first element of $anstypes.
$answerbox[partnum] (In Question Text)
  The array $answerbox will contain the entry boxes for each answer type. In the question text, you will need to position these boxes within the question. For example: "Enter a number: $answerbox[0]. Now a function: $answerbox[5]"

Optional Variables

Question part options
  You can define any optional variable for each question part. Like above, suffix the variable with the part designator. Note that $variables, $domain, $reltolerance, and $abstolerance may be used for the comparison, and should not be set for individual parts.
$showanswer
  By default the $showanswer for conditional types is "Answers may vary". Set $showanswer to override this.

Scaffolding

While not as simple as scaffolding multipart questions, you can add scaffolding to a Conditional question. As with multipart, put an isolated line with three slashes in the question text to indicate where the breaks occur. Then you will need to set `$seqPartDone[pn]` to `true` for each part index once that part should be considered completed. The scaffolding will move onto the next chunk when all parts in the previous chunk have `$seqPartDone` set to `true`.

# Using the System

## Registering

At the Login page, if you are not currently registered as a student, click the "Register as a New Student" link. You will be asked to provide:

- A username. Your school may require something specific, like your student ID number.
- A password. You're asked to enter this twice.
- Your Firstname (Given name) and Lastname (Surname)
- Your email address
- You'll have the option to request an email notification when you recieve a new message in the system.
- If your teacher provided you a Course ID and Enrollment Key, you can enter them now to enroll in your course. If you don't have this information yet, you can enter it later.

When you click "Sign Up", you will be taken back to the Login page so you can log in

## Logging In

At the Login page, you will be asked to supply your login credidentials (username and password).

If you forget your password, click the "Forgot Password" link and enter your username. The system will send you an email with a link to click to reset your password. Check your email's spam filter if you don't receive the email in a few minutes.

If you forget your username, click the "Forgot Username" link and enter your email address. The system will send you an email with your username. Check your email's spam filter if you don't receive the email in a few minutes.

If you still having trouble logging in, or never receive the "Forgot Password" or "Forgot Username" emails, contact your instructor. They can help you check that your email address is correct, look up your username, and reset your password.

## Home Page

The home page lists the classes you're currently taking, and also has options for enrolling in a course, changing your password, changing your user profile, or logging out of the system.

### Changing Your User Profile

To modify your user profile, click the "Change User Info" link in the top right corner.

Your profile allows you correct errors in your name, update your email address, and change your password. You can also upload a picture of yourself or an avatar that your instructor and other students will see with your forum posts and messages.

You can also adjust settings for whether or not to show a list of new messages and forum posts on the home page.

#### Accessibility and Display Preferences

The Accessibility and Display Preferences in the user profile allow you to personalize how you interact with the system, and allow you to work around technical issues.

- Math Display: This option allows you to customize how math equations are displayed in the system.
  - MathJax: The recommended default is MathJax, which generates high quality display of math and provides the best compatibility with screenreaders and other assistive technology.
  - Katex: provides faster math display with good quality, but not quite as nice as MathJax.
  - Image-based: this uses images to display math. The quality is not as good, but this option can help workaround issue if the browser is having trouble using MathJax.
  - Calculator-style: this uses an inline, text-based, calculator style display, like `x^2+4sqrt(x)`.
- Graph Display: This option allows you to customize how graphs are displayed in the system.
  - SVG: The recommended default, this is the highest quality display, which will look clear and sharp even when zoomed in.
  - Image-based: this option uses images to display graphs. The quality is not as high and will look fuzzy if zoomed in.
  - Text alternatives: this option will replace auto-generated graphs with a text alternative, typically a table of values for the equations or a text description of a chart.
- Drawing Entry: This option controls how answers to drawing questions are entered.
  - Mouse-based: The default, a mouse or touch device is used to plot points on a graph to create the drawing.
  - Keyboard and text alternative: this option provides a text-based alternative for drawing entry, which can also be controlled entirely using the keyboard.
- Text Editor: This option controls how large text entry is done.
  - Rich text editor: The default, this option provides an editor with formatting buttons and "what you see is what you get" editing.
  - Plain text entry: this option provides a basic text entry box with no buttons or other clutter.
- Course styling and contrast: This option allows you to customize the contrast styling of the course.
  - Instructor chosen theme: The default, this option uses the instructor chosen styles for the course.
  - High contrast, dark on light: this option overrides the course styles with extra-high-contrast styles, featuring dark text on a light background.
  - High contrast, light on dark: this option overrides the course styles with extra-high-contrast styles, featuring white text on a dark background.
- Live preview: This option controls how the preview of your answers updates as you type.
  - Show as I type: This default option will auto-update a preview of your answer as you type it out. This can help you catch entry mistakes early.
  - Only show a preview when I click: this option will stop the auto-update of a preview, and only display the preview when you request it. This option can reduce the distraction and flicker of the auto-update.
- Time Zone: This option allows you to control the time zone that due dates and other times are displayed based on.
  - Use timezone reported by browser: When you log in, the system asks your computer what time zone you're in. By default, this timezone is the one used when displaying dates. You can check the listed timezone to make sure it's the correct one. If it is wrong, you can either adjust your computer's timezone then log out and back in, or override the detected time zone.
  - Use a specific timezone for this session: this option allows you to override the detected timezone for this one login session. The next time you log in, the system will again detect your currect timezone. This option can be helpful if you don't want to change your computer's clock, but want to adjust the timezone temorarily.
  - Always show times based on specific timezone: this option allows you to override the detected timezone every time you log in. This can be helpful if you travel a lot, but always want the times to display based on your home timezone.

### Enrolling in a Course

At your home page, click the "Enroll in a New Class" button to sign up for a new course. You'll need to enter the Course ID number and Enrollment Key in the box provided. If you do not know these, ask your instructor.

## Course Page

The course page consists of a list of items. There are several types of items:

- Blocks and Folders: Groupings of items. If you see a folder icon, click the folder to open it and view the contents. If you see a triangle icon, click the title to expand the contents.
- Text Items: Text that displays on the course page
- Links: A summary displays on the course page. A link is provided that may display text, a file, or take you to a weblink
- Forums: Discussion forums
- Assessments: Homework, Quizzes, Tests, or Practice questions
- Drills: Repeated practice with a particular skill
- Wikis: Collaborative text editing

## Calendar

Many courses will have a Calendar link which will display a calendar showing upcoming due dates and other special events. You can click on a specific day to view a more detailed listing of the events for that day. You can use that list to access assignments and other items.

Keep in mind that not everything from the course will display on the calendar, so be sure to actually look at the course page, not just rely on the calendar.

The color of the items on the calendar will change based on how far away the due date is; items in green are futher away, items in yellow are closer, and items in red are approaching the due date.

## Course Map

The course page will have a link to the Course Map, a condensed list view of everything in the course. The Course Map can help you locate items in the course that are buried in folders.

## Taking Assessments

When you take an assessment, it will be displayed to you in one of several ways:

- Full Test: You may see the entire test at once
- One at a time: You may have to answer one question before proceeding to the next
- Full test, submit one at a time: The full test is displayed, but you only answer one question at a time
- Skip Around: You may see a list of questions. You can skip around between questions by clicking on these links, and answer the questions in any order.

There are several question types. When you click on the answer box, a hint will typically display below it telling you what kind of answer is expected. Some of the types:

- Number: You will be asked to enter a number, like 3, 5.5, or -6
- Calculated: You will be asked to enter a number, or a calculation, like 2/3, 5^2, or sin(2). You can press the "Preview" button to ensure that the system is interpreting your answer the way you intended.
- Multiple-Choice: You will be given a set of choices, and asked to select the correct choice
- Multiple-Answer: You will be given a set of choices, and asked to select all the correct choices
- Matching: You will be given a list of items with input boxes in front of them. In each box, enter the letter of the item in the right-hand column that matches that item
- Expression: You will be asked to enter an algebraic expression, like "sin(x)" or "3x^2-5" or "x^2/5". Make sure you use the same variables in your answer than were specified in the question. You can press the "Preview" button to ensure the system is interpreting your answer the way you intended. It will also check to make sure that it understands your answer, and will tell if you if the syntax is ok.
- String: You will be asked to enter a word or list of letters
- Numerical Matrix: You will asked to enter a matrix of numbers. In some case, a grid of input boxes will be provided for you to enter the values. If not, you will need to enter the matrix in ASCIIMath notation, like [(1,2,3),(4,5,6)] for the 2x3 matrix with first row: 1,2,3
- Calculated Matrix: Like a numerical matrix, but each entry can be a calculation, like 2/3 or 5^2 or sin(2).

### Entering Math

For some types of questions, you need to enter a mathematical expression. The system follows order of operations, so use grouping symbols as much as necessary.

Many times, you can click a yellow arrow that displays next to the answer box when you click in it, which will open up the MathQuill equation editor, which you can use to help enter your answers.

Alternatively, you can enter your answer using calculator-style notation. Here is some help on how to enter expressions:

Symbol | Meaning
--- | ---
* / + - | Multiply, divide, add, subtract
^ | Powers. 2^3 = 8.
sqrt | Square root. sqrt(4) = 2
( ) | Parentheses, for grouping. (2+6)/2 = 4, while 2+6/2 = 5.
e, pi | The standard constants
abs | Absolute Value. abs(-4) = 4
sin,cos,tan,sec,csc,cot,sinh,cosh | Standard trig function. Be sure to enter as sin(2), not sin 2
arcsin,arccos,arctan,arcsinh,arccosh | Inverse trig functions. Note arcsec, arccsc, and arccot are not defined
sin^-1, cos^-1, tan^-1 | Alternative entry for inverse trig functions. Use like sin^-1(0.5)
ln | Natural Logarithm base e
log | Common Logarithm base 10
! | Factorial
DNE | Does Not Exist. This is also often used for "no solutions".
oo | Infinity. Those are two lowercase o's, like the middle of the word "look"