Skip to main content

Preface Entering WeBWorK Answers

This preface offers some guidance with syntax for WeBWorK answers. WeBWorK answer blanks appear in the active reading examples (called “checkpoints”) in the HTML version of the book. If you are using WeBWorK for online homework, then you will also enter answers into WeBWorK answer blanks there.

Basic Arithemtic

The five basic arithmetic operations are: addition, subtraction, multiplication, and raising to a power. The symbols for addition and subtraction are \(+\) and \(-\text{,}\) and both of these are directly avialable on most keyboards as + and -.

On paper, multiplication is sometimes written using \(\times\) and sometimes written using \(\cdot\) (a centered dot). Since these symbols are not available on most keyboards, WeBWorK uses * instead, which is often shift-8 on a full keyboard.

On paper, division is sometimes written using \(\div\text{,}\) sometimes written using a fraction layout like \(\frac{4}{2}\text{,}\) and sometimes written just using a slash, \(/\text{.}\) The slash is available on most full keyboards, near the question mark. WeBWorK uses / to indicate division.

On paper, raising to a power is written using a two-dimensional layout like \(4^2\text{.}\) Since we don't have a way to directly type that with a simple keyboard, calculators and computers use the caret character, ^, as in 4^2. The character is usually shift-6.

Roots and Radicals

On paper, a square root is represented with a radical symbol like \(\sqrt{\phantom{x}}\text{.}\) Since a keyboard does not usually have this symbol, WeBWorK and many computer applications use sqrt( ) instead. For example, to enter \(\sqrt{17}\text{,}\) type sqrt(17).

Higher-index radicals are written on paper like \(\sqrt[4]{12}\text{.}\) Again we have no direct way to write this using most keyboards. In some WeBWorK problems it is possible to type something like root(4, 12) for the fourth root of twelve. However this is not enabled for all WeBWorK problems.

As an alternative that you may learn about in a later chapter, \(\sqrt[4]{12}\) is mathematically equal to \(12^{1/4}\text{,}\) so it can be typed as 12^(1/4). Take note of the parentheses, which very much matter.

Common Hiccups with Grouping Symbols

Suppose you wanted to enter \(\frac{x+1}{2}\text{.}\) You might type x+1/2, but this is not right. The computer will use the order of operations (see Section 1.4) and do your division first, dividing \(1\) by \(2\text{.}\) So the computer will see \(x+\frac{1}{2}\text{.}\) To address this, you would need to use grouping symbols like parentheses, and type something like (x+1)/2.

Suppose you wanted to enter \(6^{1/4}\text{,}\) and you typed 6^1/4. This is not right. The order of operations places a higher priority on exponentiation than division, so it calculates \(6^1\) first and then divides the result by \(4\text{.}\) That is simply not the same as raising \(6\) to the \(\frac{1}{4}\) power. Again the way to address this is to use grouping symbols, like 6^(1/4).

Entering Decimal Answers

Often you will find a decimal answer with decimal places that go on and on. You are allowed to round, but not by too much. WeBWorK generally looks at how many significant digits you use, and generally expects you to use four or more correct significant digits.

“Significant digits” and “places past the decimal” are not the same thing. To count significant digits, read the number left to right and look for the first nonzero digit. Then count all the digits to the right including that first one.

The number \(102.3\) has four significant digits, but only one place past the decimal. This number could be a correct answer to a WeBWorK question. The number \(0.0003\) has one significant digit and four places past the decimal. This number might cause you trouble if you enter it, because maybe the “real” answer was \(0.0003091\text{,}\) and rounding to \(0.0003\) was too much rounding.

Special Symbols

There are a handful of special symbols that are easy to write on paper, but it's not clear how to type them. Here are WeBWorK's expectations.

Symbol Name How to Type
\(\infty\) infinity infinity or inf
\(\pi\) pi pi
\(\cup\) union U
\(\mathbb{R}\) the real numbers R
\(\mid\) such that | (shift-\, where \ is above the enter key)
\(\leq\) less than or equal to <=
\(\geq\) greater than or equal to >=
\(\neq\) not equal to !=