52 results in Howtos  search across all projects.

QuestionThis question generates two variables, a and b. They're chosen to be distinct, and neither takes the value zero.

Question
The student must enter a number in scientific notation, with separate boxes for significand and exponent. They only get the marks if both elements are correct.

Exam (3 questions)
These questions show how to use JSON data to represent structured information.

Question
A short demonstration of when the basic simplification rules are turned on, or off.

Question
Shows how the \text command is rendered using the plaintext font, not the LaTeX one. Useful for displaying units of measurement and English words inside equations.

Question
This question shows how to display a number like "1234" as "1,234", or "1 234", using the formatNumber function.

Question
Create a list of records for randomlygenerated people. Each record contains the person's name, age, and list of hobbies.
The names and hobbies are generated from JSON data.

Question
Choose from one of several predefined scenarios, and set variables to the corresponding values.
This question has three variables:
city
,population
, andpercent_like_chocolate
. These differ for each city. 
Question
Defines a custom function sort_by to sort a list of lists by the elements at the given index.
You could do a similar thing to sort lists of dictionaries.

Question
Demo showing how to write a custom function in javascript.

Question
This question is out of date: use the currency function instead.

Question
Choose from one of several predefined scenarios, and set variables to the corresponding values, defined in lists.
This question has three variables:
city
,population
, andpercent_like_chocolate
. These differ for each city. We've defined a list for each variable, with the corresponding values. A variable calledscenario
picks a random position in the list, so the value ofcity
, for example, iscities[scenario]
. 
Question
Use attributes of the form
eval<name>
to dynamically set an attribute on an element based on question variables. 
Question
A couple of different ways of showing the correct answer to a single part as soon as the student submits an answer. One way allows the student to change their answer, while the other locks the part.
A third part includes a "reveal answers to this part" button, which allows the student to choose to reveal the answer to the part.
Think very carefully before using this: by revealing the answer, you are removing the opportunity for the student to later on realise they've got that step wrong, as a consequence of some further work. It's often possible to use adaptive marking to use the student's answer in place of the correct answer in later parts.

Question
Give the student a larger area to write some freeform text, which isn't marked.

Question
Ask for the squares of five randomlychosen numbers between 0 and 15.
The shuffle function puts a list in random order.

Question
A method of randomly choosing variable names  use the
expression()
JME function to create a variable name from a randomly chosen string.(This question also uses a custom marking script to check that the student has simplified the expression)

Question
One method of randomly choosing names for variables. For each variable, we have 4 options. Create a list of 4 numbers, which is 1 for the name we want to use, and 0 otherwise.
Then, whenever we use that variable, multiply each of the possible names by the corresponding number in the list. When the expression is simplified, the unwanted names will cancel to 0, leaving only the name we want.
This is quite clunky!
(This question also uses a custom marking script to check that the student has simplified the expression)

Question
Shows how to use the JME function lpad to add zeros to the beginning of a number so it's always displayed using two digits.

Exam (5 questions)
This exam uses a custom theme to provide no feedback about scores to the student.
The idea is to provide a version of the test compiled with this theme to the students as they attempt it. Once the test has closed, update with a version of the same test compiled with the default theme, so students can go back in and get feedback.

Question
Shows how to enter a logarithm to an arbitrary base, in a mathematical expression part.

Question
Load data about members of the Scottish parliament from a JSON object, and display a table of 5 randomly picked MSPs.

Question
Load data on some items held in the Cooper Hewitt collection, and show a table of 5 randomly picked items.

QuestionShows how to safely include LaTeX in a string variable.

Question
You can use LaTeX in marking comments, but remember to escape backslashes!

Question
A table showing how to substitute raw LaTeX code into question text.
NOTE: You probably don't want to do this! There's usually a more robust way, where you get Numbas to make the expression for you.

Question
This question adds a CSS rule to hide the brackets around the matrix input.

Question
Lay out gapfills so the student has to enter either the numerator or denominator of a fraction.

Question
Some custom CSS restyles the matrix input so it looks like a fraction, with input boxes on top and bottom.
Ideally, there should be a fraction input part type, or an option for the number entry part to display a fraction input.

Question
Given an ascending sequence of numbers, finds the index in the sequence of the first number greater than or equal to a given value.