55 results in How-tos - search across all projects.

### Refine by Refine by

• #### Topics

• Question

The student is asked to find the square root of an integer of the form $\pm n^2$. If the root is not real, they should enter "nan".

A custom marking algorithm extends the built-in one to deal with "nan".

There's some custom javascript to set the expected answer correctly. In the future this will be possible in the marking algorithm - see https://github.com/numbas/Numbas/issues/856

• Question

The answer to this question is a differential equation involving $y''$, $y'$ and $y$.

A variable value generator for $y$ ensures that the right values are tested to check that the student's answer is equivalent to the expected equation.

• 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.

• Question

Because JavaScript numbers lose precision as they get bigger, you get some unexpected results.

See the variable "two" - the difference should be 2, but because the JavaScript representation of each of the two numbers is the same, it thinks the difference is 0.

Using the decimal data type, there's no loss of precision, so the correct value is produced.

• Question

Pick from the range -5..5, but make 0 more likely.

• Question

Demonstrates how to set up a "choose one from a list" part where the number of choices is randomised.

The part is given a list of labels for the choices as well as a list specifying the marks to award for each choice.

• Question
This question shows that you can set the number of marks available for a part to a fraction. The total available for the question is 1 mark.
• 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 plain-text font, not the LaTeX one. Useful for displaying units of measurement and English words inside equations.

• Question

This question includes a JavaScript preamble which defines 'hbar' as a special variable name to be rendered in LaTeX as \hbar.

• Question
The statement of this question demonstrates how you can control the \simplify command's behaviour by specifying the rules to use.
• Question

A diagram showing the difference between lines, rays and segments in Eukleides.

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 (1 question)

This exam uses a custom theme which provides a new logo image.

• Question
Shows how to use the sqrtSquare simplification rule to display a randomly-chosen fraction involving surds on either the top or bottom.
• Question

This shows how to use variable name annotations inside \simplify to display a 3D vector in terms of the standard unit vectors $\boldsymbol{i}$, $\boldsymbol{j}$, $\boldsymbol{k}$

• Question

The student is asked to write a number with a certain property, or tick a box labelled "this is impossible" if it can't be done.

A custom marking algorithm on the gap-fill part first checks if the student ticked the box. If they did, their answer is marked correct if it really is impossible. If they didn't tick it, their number is checked against the required property.

• Question

Demo showing how to write a custom function in javascript.

• On HTML attached
Question

This question shows how to run some JavaScript code when the question's HTML is displayed on the page.

• Question

This question shows how to use the 'adviceDisplayed' signal to run some javascript when the question's advice is revealed to the student.

• Recursive JS function
Question

This shows how to implement a recursive function in JavaScript with a nested function definition.

• Mark a percentage
Question

The student must write a percentage, using the % symbol. An alternative answer checks the cases where they forgot the percent sign (e.g. 55), or entered the corresponding scalar (e.g. 0.55).

• Question

This demonstrates how to render a set of tuples such as $\{(1,2),(3,4)\}$ in LaTeX, starting with a list of pairs of numbers.

• Question

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

• Question

Ask for the squares of five randomly-chosen numbers between 0 and 15.

The shuffle function puts a list in random order.

• 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

Demonstrates how to create variables containing LaTeX commands, and how to use them in the question text.

• Question

This question shows how to use the currency function to display amounts of currency with the correct symbols.

• Question

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

• 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)