Available Functions
From WeBWorK
(Difference between revisions)
m (→Syntax for entering expressions) |
(Information about P(n,k) and C(n,k) added.) |
||
(17 intermediate revisions by 5 users not shown) | |||
Line 7: | Line 7: | ||
* ^ or ** You can use either ^ or ** for exponentiation, e.g. 3^2 or 3**2 | * ^ or ** You can use either ^ or ** for exponentiation, e.g. 3^2 or 3**2 | ||
* Parentheses: () - You can also use square brackets, [ ], and braces, { }, for grouping, e.g. [1+2]/[3(4+5)] | * Parentheses: () - You can also use square brackets, [ ], and braces, { }, for grouping, e.g. [1+2]/[3(4+5)] | ||
+ | * Note: 1/2x is evaluated from left to right and means <math>\frac{1}{2}x</math> which might not have been what you meant. | ||
====Syntax for entering expressions==== | ====Syntax for entering expressions==== | ||
* Be careful entering expressions just as you would be careful entering expressions in a calculator. | * Be careful entering expressions just as you would be careful entering expressions in a calculator. | ||
− | * '''Use the "Preview Button" to see exactly how your entry looks. E.g. to tell the difference between 1+2/3 | + | * '''Use the "Preview Button" to see exactly how your entry looks. E.g. to tell the difference between 1+2/3*4 and [1+2]/[3*4] click the "Preview Button".''' |
− | * Sometimes using the * symbol to indicate mutiplication makes things easier to read. For example (1+2)*(3+4) and (1+2)(3+4) are both valid. So are 3*4 and | + | * Sometimes using the * symbol to indicate mutiplication makes things easier to read. For example (1+2)*(3+4) and (1+2)(3+4) are both valid. So are 3*4 and 3 4 (3 space 4, not 34) but using a * makes things clearer. |
− | * Use ('s and )'s to make your meaning clear. You can also use ['s and ]'s and {'s and }'s. | + | * Use ('s and )'s to make your meaning clear. You can also use ['s and ]'s and {'s and }'s (except in contexts where those have special meanings, like creating intervals or sets). |
* Don't enter 2/4+5 (which is 5.5) when you really want 2/(4+5) (which is 2/9). | * Don't enter 2/4+5 (which is 5.5) when you really want 2/(4+5) (which is 2/9). | ||
* Don't enter 2/3*4 (which is 8/3) when you really want 2/(3*4) (which is 2/12). | * Don't enter 2/3*4 (which is 8/3) when you really want 2/(3*4) (which is 2/12). | ||
* Entering big quotients with square brackets, e.g. [1+2+3+4]/[5+6+7+8], is a good practice. | * Entering big quotients with square brackets, e.g. [1+2+3+4]/[5+6+7+8], is a good practice. | ||
* Be careful when entering functions. It's always good practice to use parentheses when entering functions. Write sin(t) instead of sint or sin t even though WeBWorK is smart enough to '''usually''' accept sin t or even sint. For example, sin 2t is interpreted as sin(2)t, i.e. (sin(2))*t so be careful. | * Be careful when entering functions. It's always good practice to use parentheses when entering functions. Write sin(t) instead of sint or sin t even though WeBWorK is smart enough to '''usually''' accept sin t or even sint. For example, sin 2t is interpreted as sin(2)t, i.e. (sin(2))*t so be careful. | ||
− | * You can enter sin^2(t) as a short cut although mathematically speaking sin^2(t) is shorthand for (sin(t))^2(the square of sin of t). (You can enter it as sin(t)^2 or even sint^2, but don't try such things unless you '''really''' understand the precedence of operations. The "sin" operation has highest precedence, so it is performed first, using the next token (i.e. t) as an argument. Then the result is squared.) You can always use the Preview button to see a typeset version of what you entered and check whether what you wrote was what you meant. :-) | + | * You can enter sin^2(t) as a short cut although mathematically speaking sin^2(t) is shorthand for (sin(t))^2 (the square of sin of t). (You can enter it as sin(t)^2 or even sint^2, but don't try such things unless you '''really''' understand the precedence of operations. The "sin" operation has highest precedence, so it is performed first, using the next token (i.e. t) as an argument. Then the result is squared.) You can always use the Preview button to see a typeset version of what you entered and check whether what you wrote was what you meant. :-) |
* For example 2+3sin^2(4x) will work and is equivalent to 2+3(sin(4x))^2 or 2+3sin(4x)^2. Why does the last expression work? Because things in parentheses are always done first [ i.e. (4x)], next all functions, such as sin, are evaluated [giving sin(4x)], next all exponents are taken [giving sin(4x)^2], next all multiplications and divisions are performed in order from left to right [giving 3sin(4x)^2], and finally all additions and subtractions are performed [giving 2+3sin(4x)^2]. | * For example 2+3sin^2(4x) will work and is equivalent to 2+3(sin(4x))^2 or 2+3sin(4x)^2. Why does the last expression work? Because things in parentheses are always done first [ i.e. (4x)], next all functions, such as sin, are evaluated [giving sin(4x)], next all exponents are taken [giving sin(4x)^2], next all multiplications and divisions are performed in order from left to right [giving 3sin(4x)^2], and finally all additions and subtractions are performed [giving 2+3sin(4x)^2]. | ||
* Is -5^2 positive or negative? It's negative. This is because the square operation is done before the negative sign is applied. Use (-5)^2 if you want to square negative 5. | * Is -5^2 positive or negative? It's negative. This is because the square operation is done before the negative sign is applied. Use (-5)^2 if you want to square negative 5. | ||
* When in doubt use parentheses!!! :-) | * When in doubt use parentheses!!! :-) | ||
* The complete rules for the precedence of operations, in addition to the above, are | * The complete rules for the precedence of operations, in addition to the above, are | ||
− | |||
** Additions and subtractions are performed left to right: 1-2+3 = (1-2)+3 = 2. | ** Additions and subtractions are performed left to right: 1-2+3 = (1-2)+3 = 2. | ||
+ | ** Multiplications and divisions are performed left to right: 2/3*4 = (2/3)*4 = 8/3. | ||
** Exponents are taken right to left: 2^3^4 = 2^(3^4) = 2^81 = a big number. | ** Exponents are taken right to left: 2^3^4 = 2^(3^4) = 2^81 = a big number. | ||
− | * '''Use the "Preview Button" to see exactly how your entry looks. E.g. to tell the difference between 1+2/3 | + | * '''Use the "Preview Button" to see exactly how your entry looks. E.g. to tell the difference between 1+2/3*4 and [1+2]/[3*4] click the "Preview Button".''' |
====Mathematical Constants Available In WeBWorK==== | ====Mathematical Constants Available In WeBWorK==== | ||
Line 35: | Line 36: | ||
====Scientific Notation Available In WeBWorK==== | ====Scientific Notation Available In WeBWorK==== | ||
− | * 2.1E2 | + | * 2.1E2 is the same as 210 |
− | * 2.1E-2 | + | * 2.1E-2 is the same as .021 |
====Mathematical Functions Available In WeBWorK==== | ====Mathematical Functions Available In WeBWorK==== | ||
− | + | Unless otherwise specified, all of the functions listed below are enabled by default. However, sometimes one or more of these functions is disabled for | |
− | instructor wants you to calculate the answer by some means other than just using the function. | + | a particular WeBWorK problem because the instructor wants you to calculate the answer by some means other than just using the function. |
+ | |||
+ | * sqrt(x) -- The square root of x. Also can be written x^(1/2). | ||
+ | * abs(x) -- The absolute value of x. Also can be written |x|. | ||
+ | |||
+ | =====Exponential and Logarithmic Functions===== | ||
+ | |||
+ | |||
+ | * exp(x) -- The same function as e^x | ||
+ | * log(x) -- This is usually the natural log but your professor may have redined this as log to the base 10 | ||
+ | * ln(x) -- The natural log | ||
+ | * logten(x) -- The log to the base 10 | ||
+ | |||
+ | =====Trigonometric Functions===== | ||
+ | |||
+ | '''Note''': All of the trigonometric functions use '''radian''' measure. | ||
+ | |||
+ | * cos(x) | ||
+ | * sin(x) | ||
+ | * tan(x) | ||
+ | * sec(x) | ||
+ | * cot(x) | ||
+ | * csc(x) | ||
+ | |||
+ | * arcsin(x), asin(x), or sin^-1(x) | ||
+ | * arccos(x), acos(x), or cos^-1(x) | ||
+ | * arctan(x), atan(x), or tan^-1(x) | ||
+ | * arccot(x), acot(x), or cot^-1(x) | ||
+ | * arcsec(x), asec(x), or sec^-1(x) | ||
+ | * arccsc(x), acsc(x), or csc^-1(x) | ||
+ | |||
+ | =====Hyperbolic Trig Functions===== | ||
+ | |||
+ | * sinh(x) | ||
+ | * cosh(x) | ||
+ | * tanh(x) | ||
+ | * sech(x) | ||
+ | * csch(x) | ||
+ | * coth(x) | ||
+ | |||
+ | * arcsinh(x), asinh(x), or sinh^-1(x) | ||
+ | * arccosh(x), acosh(x), or cosh^-1(x) | ||
+ | * arctanh(x), atanh(x), or tanh^-1(x) | ||
+ | * arcsech(x), asech(x), or sech^-1(x) | ||
+ | * arccsch(x), acsch(x), or csch^-1(x) | ||
+ | * arccoth(x), acoth(x), or coth^-1(x) | ||
+ | |||
+ | =====Other Functions===== | ||
+ | |||
+ | * n! -- n factorial (defined for nonnegative integers) | ||
+ | * sgn(x) -- the sign function, either -1 (if x < 0), 0 (if x = 0), or 1 (if x > 0) | ||
+ | |||
+ | These functions are available for some problems, but may not be enabled for others (for authoring information see [http://webwork.maa.org/wiki/StepFunctions step functions]): | ||
+ | |||
+ | * step(x) -- the step function (1 if x > 0, 0 otherwise.) | ||
+ | * fact(n) -- another name for n!, | ||
+ | |||
+ | The following functions are not enabled in student answers by default: | ||
+ | |||
+ | * P(n,k) = n*(n-1)*(n-2)...(n-k+1) the number of ordered sequences of k elements chosen from n elements | ||
+ | * C(n,k) = "n choose k" the number of unordered sets of k elements chosen from n elements | ||
+ | * ceil(x) The ceiling function that rounds up to the nearest integer | ||
+ | * floor(x) The floor function that rounds down to the nearest integer | ||
+ | * max(x,y) The max function | ||
+ | * min(x,y) The min function | ||
+ | |||
+ | These can be used in authoring problems if <code>PGauxiliaryFunctions.pl</code> is included in the problem. In order to use P(n,k) and C(n,k), you must be in the [http://webwork.maa.org/wiki/Specialized_contexts IntegerFunctions context]. | ||
− | + | [[Category:HelpFiles]] | |
− | + | [[Category:Students]] | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 18:56, 22 December 2016
Contents |
Mathematical Symbols Available In WeBWorK
- + Addition
- - Subtraction
- * Multiplication can also be indicated by a space or juxtaposition, e.g. 2x, 2 x or 2*x, also 2(3+4).
- / Division
- ^ or ** You can use either ^ or ** for exponentiation, e.g. 3^2 or 3**2
- Parentheses: () - You can also use square brackets, [ ], and braces, { }, for grouping, e.g. [1+2]/[3(4+5)]
- Note: 1/2x is evaluated from left to right and means \(\frac{1}{2}x\) which might not have been what you meant.
Syntax for entering expressions
- Be careful entering expressions just as you would be careful entering expressions in a calculator.
- Use the "Preview Button" to see exactly how your entry looks. E.g. to tell the difference between 1+2/3*4 and [1+2]/[3*4] click the "Preview Button".
- Sometimes using the * symbol to indicate mutiplication makes things easier to read. For example (1+2)*(3+4) and (1+2)(3+4) are both valid. So are 3*4 and 3 4 (3 space 4, not 34) but using a * makes things clearer.
- Use ('s and )'s to make your meaning clear. You can also use ['s and ]'s and {'s and }'s (except in contexts where those have special meanings, like creating intervals or sets).
- Don't enter 2/4+5 (which is 5.5) when you really want 2/(4+5) (which is 2/9).
- Don't enter 2/3*4 (which is 8/3) when you really want 2/(3*4) (which is 2/12).
- Entering big quotients with square brackets, e.g. [1+2+3+4]/[5+6+7+8], is a good practice.
- Be careful when entering functions. It's always good practice to use parentheses when entering functions. Write sin(t) instead of sint or sin t even though WeBWorK is smart enough to usually accept sin t or even sint. For example, sin 2t is interpreted as sin(2)t, i.e. (sin(2))*t so be careful.
- You can enter sin^2(t) as a short cut although mathematically speaking sin^2(t) is shorthand for (sin(t))^2 (the square of sin of t). (You can enter it as sin(t)^2 or even sint^2, but don't try such things unless you really understand the precedence of operations. The "sin" operation has highest precedence, so it is performed first, using the next token (i.e. t) as an argument. Then the result is squared.) You can always use the Preview button to see a typeset version of what you entered and check whether what you wrote was what you meant. :-)
- For example 2+3sin^2(4x) will work and is equivalent to 2+3(sin(4x))^2 or 2+3sin(4x)^2. Why does the last expression work? Because things in parentheses are always done first [ i.e. (4x)], next all functions, such as sin, are evaluated [giving sin(4x)], next all exponents are taken [giving sin(4x)^2], next all multiplications and divisions are performed in order from left to right [giving 3sin(4x)^2], and finally all additions and subtractions are performed [giving 2+3sin(4x)^2].
- Is -5^2 positive or negative? It's negative. This is because the square operation is done before the negative sign is applied. Use (-5)^2 if you want to square negative 5.
- When in doubt use parentheses!!! :-)
- The complete rules for the precedence of operations, in addition to the above, are
- Additions and subtractions are performed left to right: 1-2+3 = (1-2)+3 = 2.
- Multiplications and divisions are performed left to right: 2/3*4 = (2/3)*4 = 8/3.
- Exponents are taken right to left: 2^3^4 = 2^(3^4) = 2^81 = a big number.
- Use the "Preview Button" to see exactly how your entry looks. E.g. to tell the difference between 1+2/3*4 and [1+2]/[3*4] click the "Preview Button".
Mathematical Constants Available In WeBWorK
- pi This gives 3.14159265358979, e.g. cos(pi) is -1
- e This gives 2.71828182845905, e.g. ln(e*2) is 1 + ln(2)
Scientific Notation Available In WeBWorK
- 2.1E2 is the same as 210
- 2.1E-2 is the same as .021
Mathematical Functions Available In WeBWorK
Unless otherwise specified, all of the functions listed below are enabled by default. However, sometimes one or more of these functions is disabled for a particular WeBWorK problem because the instructor wants you to calculate the answer by some means other than just using the function.
- sqrt(x) -- The square root of x. Also can be written x^(1/2).
- abs(x) -- The absolute value of x. Also can be written |x|.
Exponential and Logarithmic Functions
- exp(x) -- The same function as e^x
- log(x) -- This is usually the natural log but your professor may have redined this as log to the base 10
- ln(x) -- The natural log
- logten(x) -- The log to the base 10
Trigonometric Functions
Note: All of the trigonometric functions use radian measure.
- cos(x)
- sin(x)
- tan(x)
- sec(x)
- cot(x)
- csc(x)
- arcsin(x), asin(x), or sin^-1(x)
- arccos(x), acos(x), or cos^-1(x)
- arctan(x), atan(x), or tan^-1(x)
- arccot(x), acot(x), or cot^-1(x)
- arcsec(x), asec(x), or sec^-1(x)
- arccsc(x), acsc(x), or csc^-1(x)
Hyperbolic Trig Functions
- sinh(x)
- cosh(x)
- tanh(x)
- sech(x)
- csch(x)
- coth(x)
- arcsinh(x), asinh(x), or sinh^-1(x)
- arccosh(x), acosh(x), or cosh^-1(x)
- arctanh(x), atanh(x), or tanh^-1(x)
- arcsech(x), asech(x), or sech^-1(x)
- arccsch(x), acsch(x), or csch^-1(x)
- arccoth(x), acoth(x), or coth^-1(x)
Other Functions
- n! -- n factorial (defined for nonnegative integers)
- sgn(x) -- the sign function, either -1 (if x < 0), 0 (if x = 0), or 1 (if x > 0)
These functions are available for some problems, but may not be enabled for others (for authoring information see step functions):
- step(x) -- the step function (1 if x > 0, 0 otherwise.)
- fact(n) -- another name for n!,
The following functions are not enabled in student answers by default:
- P(n,k) = n*(n-1)*(n-2)...(n-k+1) the number of ordered sequences of k elements chosen from n elements
- C(n,k) = "n choose k" the number of unordered sets of k elements chosen from n elements
- ceil(x) The ceiling function that rounds up to the nearest integer
- floor(x) The floor function that rounds down to the nearest integer
- max(x,y) The max function
- min(x,y) The min function
These can be used in authoring problems if PGauxiliaryFunctions.pl
is included in the problem. In order to use P(n,k) and C(n,k), you must be in the IntegerFunctions context.