Skip to content
Snippets Groups Projects
Commit 61be0daa authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Minor changes to the Windows search for Maxima, and major reorganisation of the docs.

parent 7cc830f5
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,9 @@ An _answer test_ is used to compare two expressions to establish whether they sa ...@@ -4,7 +4,9 @@ An _answer test_ is used to compare two expressions to establish whether they sa
This page is dedicated to answer tests which establish numerical precision. This page is dedicated to answer tests which establish numerical precision.
Other tests are documented in a page on [answer tests](../Authoring/Answer_tests.md). Other tests are documented in a page on [answer tests](../Authoring/Answer_tests.md).
Please also see the separate notes on [numbers](../CAS/Numbers.md). Please also see the separate notes on [numbers](../CAS/Numbers.md) and [scientific units](Units.md).
With other answer tests a question author can manipulate the student's answer with the CAS before applying an answer test. With these tests it is _essential_ that the SAns field is exactly the name of the input. For example, if your input is `ans1` then the SAns field of the answer test must only be `ans1`. The reason for this is that Maxima changes the display of floating point numbers to remove or add trailing zeros. These answer tests must take the value typed at the input, not the value passed through the CAS, otherwise digits will be changed. Further information and examples are given in the page on [numbers](../CAS/Numbers.md). This problem does not apply to the teacher's answer because we do not test whether the teacher has supplied the correct number of trailing zeros. We only test if the student's answer is sufficiently close in numerical precision. So, it is safe to calculate the teacher's answer field of the answer test from question variables using the CAS. Care will be needed to display the correct number of significant figures with trailing zeros elsewhere in the question though.
# Introduction to numerical testing # # Introduction to numerical testing #
...@@ -21,10 +23,10 @@ All software have limitations on the extent to which they can robustly deal with ...@@ -21,10 +23,10 @@ All software have limitations on the extent to which they can robustly deal with
The option to these tests is a tolerance. The default tolerance is 0.05. The option to these tests is a tolerance. The default tolerance is 0.05.
* Relatve: Tests whether `abs(sa-ta) <= opt * abs(ta)` * Relative: Tests whether `abs(sa-ta) <= opt * abs(ta)`
* Absolute: Tests whether `abs(sa-ta) < opt` * Absolute: Tests whether `abs(sa-ta) < opt`
NumRelative and NumAbsolute can also accept lists and sets. Elements are automatically converted to floats and simplified (i.e. `ev(float(ex),simp)`) and are compared to the teacher's answer using the appropriate numerical test and accuracy. A uniform accuracy must be used. With lists the order is important, but with sets it is not. Checking two sets are approximately equal is an interesting mathematical problem.... NumRelative and NumAbsolute can also accept lists and sets. Elements are automatically converted to floats and simplified (i.e. `ev(float(ex),simp)`) and are compared to the teacher's answer using the appropriate numerical test and accuracy. A uniform accuracy must be used. With lists the order is important, but with sets it is not. Checking whether two sets are approximately equal is an interesting mathematical problem....
### GT & GTE ### ### GT & GTE ###
...@@ -51,7 +53,7 @@ The following cases illustrate the difficulties in inferring the number of signi ...@@ -51,7 +53,7 @@ The following cases illustrate the difficulties in inferring the number of signi
Therefore, with trailing zeros there are a number of cases in which it is not possible to tell from the written form of an expression precisely how many significant digits are present in a student's answer. This creates a problem for automatic assessment. Therefore, with trailing zeros there are a number of cases in which it is not possible to tell from the written form of an expression precisely how many significant digits are present in a student's answer. This creates a problem for automatic assessment.
To avoid this ambiguity some scientists adopt a convention where \(100\) has _exactly one significant digit_. To express one hundred to three significant digits it is _necessary_ to use \(1.00e2\). This certainly avoids ambiguity but in many assessment situations teachers do not want to enforce such strict rules. STACK seeks to provide tools for both situations: very strict enforcement of the significant figures rules (needed when teaching significant figures of course!) and a more liberal situation in which STACK will accept an input of \(100\) when the teacher wanted 1, 2 or 3 significant figures. To avoid this ambiguity some scientists adopt a convention where \(100\) has _exactly one significant digit_. To express one hundred to three significant digits it is _necessary_ to use \(1.00e2\). This conforms to the specifications in international standards and it certainly avoids ambiguity but in many assessment situations teachers do not want to enforce such strict rules. STACK seeks to provide tools for both situations: very strict enforcement of the significant figures rules (needed when teaching significant figures of course!) and a more liberal situation in which STACK will accept an input of \(100\) when the teacher wanted 1, 2 or 3 significant figures.
In addition to the number of significant figures used to express the number, a teacher will also want to establish that the student actually has the right number! In more liberal situations a teacher will condone an error in the last place. E.g. they will accept an answer written to four significant figures, but where only three are actually correct. In addition to the number of significant figures used to express the number, a teacher will also want to establish that the student actually has the right number! In more liberal situations a teacher will condone an error in the last place. E.g. they will accept an answer written to four significant figures, but where only three are actually correct.
...@@ -80,8 +82,19 @@ This test only supports numbers where \(|sa|<10^{22}\). Please see the [notes a ...@@ -80,8 +82,19 @@ This test only supports numbers where \(|sa|<10^{22}\). Please see the [notes a
Tests (i) whether the student's answer is equivalent to the teacher's and is written to `opt` decimal places. The option, which must be a positive integer, dictates the number of digits following the decimal separator `.`. Note that trailing zeros are ''required'', i.e. to two decimal placed you must write `12.30` not just `12.3`. The test rounds the numbers to the specified number of decimal places before trying to establish equivalence. Tests (i) whether the student's answer is equivalent to the teacher's and is written to `opt` decimal places. The option, which must be a positive integer, dictates the number of digits following the decimal separator `.`. Note that trailing zeros are ''required'', i.e. to two decimal placed you must write `12.30` not just `12.3`. The test rounds the numbers to the specified number of decimal places before trying to establish equivalence.
## Other issues ##
A teacher may wish to see if a student's answer is incorrect only by orders of magnitude. E.g. a student answers \(110\) instead of \(1100\). To do this, a teacher can check whether \(\log_{10}\) of the ratio of two expressions is an integer, e.g.
integerp(rat(float(log(sa/ta)/log(10))))
There is currently no functionality within the numerical answer tests to automatically check this, and there is no dedicated answer test to establish this property. A separate PRT node is needed.
# See also # See also
* [Answer tests](Answer_tests.md) * [Answer tests](Answer_tests.md)
* [CAS and numbers](../CAS/Numbers.md) * [CAS and numbers](../CAS/Numbers.md)
* [Scientific units](Units.md)
* [Maxima](../CAS/Maxima.md) * [Maxima](../CAS/Maxima.md)
...@@ -47,11 +47,11 @@ Stack provides an input type to enable teachers to support students in entering ...@@ -47,11 +47,11 @@ Stack provides an input type to enable teachers to support students in entering
This input type is built closely on the algebraic input type with the following differences. This input type is built closely on the algebraic input type with the following differences.
1. The input type will check both the teacher's answer and the student's answer for units. The input will require the student's answer to have units if and only if the teacher's answer also has units. This normally forces the student to use units. Also, students sometimes add units to dimensionless quantities (such as pH) and this input type will also enable a teacher to reject such input as invalid when the teacher does not use units. 1. The input type will check both the teacher's answer and the student's answer for units. The input will require the student's answer to have units if and only if the teacher's answer also has units. This normally forces the student to use units. Also, students sometimes add units to dimensionless quantities (such as pH) and this input type will also enable a teacher to reject such input as invalid when the teacher does not use units.
2. This input type *always accepts floating point numbers*, regardless of the option set on the edit form. 2. This input type *always accepts floating point numbers*, regardless of the option set on the edit form. The input type should display the same number of significant figures as typed in by the student. Note that all other input types truncate the display of unnecessary trailing zeros in floating point numbers, loosing information about significant figures. If you want to specifically test for significant figures, use this input type, with the teacher's answer having no units.
3. The student must type a number of some kind. Entering units on their own will be invalid. Note, if you want to ask a student for units, then use the algebraic input type. Units on their own are a not valid expression for this input. 3. The student must type a number of some kind. Entering units on their own will be invalid. If you want to ask a student for units, then use the algebraic input type. Units on their own are a not valid expression for this input.
4. If the teacher shows the validation, "with variable list" this will be displayed as "the units found in your answer are"... 4. If the teacher shows the validation, "with variable list" this will be displayed as "the units found in your answer are"...
5. The student is permitted to use variable names in this input type. 5. The student is permitted to use variable names in this input type.
6. The "insert stars" option is unchanged. You may or may not want your students to type a `*` between the numbers and units for implied multiplication. 6. The "insert stars" option is unchanged. You may or may not want your students to type a `*` or space between the numbers and units for implied multiplication.
7. You may want the single letter variable names options here. Note that since `km` literally means `k*m=1000*m` this is not a problem with most units. 7. You may want the single letter variable names options here. Note that since `km` literally means `k*m=1000*m` this is not a problem with most units.
8. The input type checks for units in a case sensitive way. If there is more than one option then STACK suggests a list. E.g. if the student types `mhz` then STACK suggests `MHz` or `mHz`. 8. The input type checks for units in a case sensitive way. If there is more than one option then STACK suggests a list. E.g. if the student types `mhz` then STACK suggests `MHz` or `mHz`.
...@@ -67,19 +67,21 @@ The extra options to the input should be a comma separated list of tags. This i ...@@ -67,19 +67,21 @@ The extra options to the input should be a comma separated list of tags. This i
## Answer tests ## ## Answer tests ##
STACK provides a number of answer tests for dealing with units. These are designed to accept a single answer with units such as `12.3*m/s`. This will not work with sets, lists, matrices, equations etc. STACK provides a number of answer tests for dealing with units. These are designed to accept an answer which is a dimensional numerical quantity, that is a floating point number with units such as `12.3*m/s`. This will not work with sets, lists, matrices, equations etc.
The answer tests *require* the teacher's answer (second argument to the function) to have units. If the teacher does not specify units then the test will fail. This decision is to help question authors write robust questions e.g. just specifying a number would be problematic. The input will accept an answer as valid if and only if the teacher's answer has units, so you should know in advance if you have units. If you want to compare numbers (i.e. no units), just use the numerical test! The answer tests *require* the teacher's answer (second argument to the function) to have units. If the teacher does not specify units then the test will fail. This decision is to help question authors write robust questions e.g. just specifying a number would be problematic. The input will accept an answer as valid if and only if the teacher's answer has units, so you should know in advance if you have units. If you want to compare numbers (i.e. no units), just use the numerical test.
The units answer tests will happily accept a `stackunits` expression. Otherwise, the answer test splits up both arguments into this form first. The units answer tests will happily accept a `stackunits` expression. Otherwise, the answer test splits up both arguments into this form first.
There are three decisions to be made: There are three decisions to be made:
1. Does the written precision matter? I.e. should the student use certain significant figures? If so, should we take a strict interpretation of significant figures (\(100\) has 1 sig fig, \(1.00e2\) has 3) or not (\(100\) has somewhere between 1 and 3 sig figs)? 1. Does the written precision matter? I.e. should the student use certain significant figures? If so, should we take a strict interpretation of significant figures (\(100\) has 1 sig fig, \(1.00e2\) has 3) or not (\(100\) has somewhere between 1 and 3 sig figs)? See the `NumSigFigs` and `SigFigsStrict` answer tests.
2. How does numerical precision matter? A number might be written using significant figures, but is it the right number? 2. How does numerical precision matter? A number might be written using significant figures, but is it the right number? See the `NumSigFigs`, `NumRelative` and `NumAbsolute` answer tests.
3. Do we convert to compatible units, or require strict units which match those given by the teacher exactly? 3. Do we convert to compatible units, or require strict units which match those given by the teacher exactly?
There are two families of answer tests. Essentially, the teacher has to make three decisions. These could always be done in a potential response tree with three nodes, but this is a common task. For legacy reasons, some of the answer tests (e.g. `NumSigFigs`, `UnitsSigFigs`) combine answering two or more of these questions in one answer test.
For scientific units (Q3.) there are two families of answer tests.
1. `Units[...]` gives feedback if the student has the wrong units, but number is equivalent on conversion, 1. `Units[...]` gives feedback if the student has the wrong units, but number is equivalent on conversion,
2. `UnitsStrict[...]` expects the student's answer to use exactly the units which appear in the teacher's answer. There is no conversion here. However, answernotes will record whether the conversion would have worked. 2. `UnitsStrict[...]` expects the student's answer to use exactly the units which appear in the teacher's answer. There is no conversion here. However, answernotes will record whether the conversion would have worked.
...@@ -92,20 +94,21 @@ __Notes__ ...@@ -92,20 +94,21 @@ __Notes__
1. All variables are considered to be units. 1. All variables are considered to be units.
2. The numerical part is compared using the one of the three numerical answer tests. Each *requires* various options, e.g. the number of significant figures, or the numerical accuracy. These answer tests uses identical options to the numerical tests. 2. The numerical part is compared using the one of the three numerical answer tests. Each *requires* various options, e.g. the number of significant figures, or the numerical accuracy. These answer tests uses identical options to the numerical tests.
3. The units system accepts both `l` and `L` for litres, and the display respects the way they are typed in. 3. The units system accepts both `l` and `L` for litres, and the display respects the way they are typed in.
4. Currently there is no localisation (i.e. language support) for unit names/spellings. 4. Only abbreviations are accepted, not full names. I.e. students may not use `meter`, instead they must use `m`.
5. The letter `u` is the prefix for micro, and is displayed as \(\mu\) when the student validates. 5. Currently there is no localisation (i.e. language support) for unit names/spellings.
6. The string `xi` is the Greek letter \(\xi\). If you assume single variable letter names this might clash with `x*i` which is a relatively common pattern. 6. The letter `u` is the prefix for micro, and is displayed as \(\mu\) when the student validates.
7. The string `xi` is the Greek letter \(\xi\). If you assume single variable letter names this might clash with `x*i` which is a relatively common pattern.
## Conversion to base units and numerical accuracy ## ## Conversion to base units and numerical accuracy ##
This only applys to the "non-strict" versions of the tests. If the units in the student's answer do not match those of the teacher, then both the student's and teacher's answer is converted to base scientific units and the numerical test applied again. Note, the student's answer is *not* converted to the units used by the teacher. This only applies to the "non-strict" versions of the tests. If the units in the student's answer do not match those of the teacher, then both the student's and teacher's answer is converted to base scientific units and the numerical test applied again. Note, the student's answer is *not* converted to the units used by the teacher.
For example, in order to make a numerical comparison between `1.1*Mg/10^6` and `1.2*kN*ns/(mm*Hz)` both expressions are converted to base units of `kg`. The numerical test is then applied. For example, in order to make a numerical comparison between `1.1*Mg/10^6` and `1.2*kN*ns/(mm*Hz)` both expressions are converted to base units of `kg`. The numerical test is then applied.
For the `NumRelative` test the option gives the required percentage tolerance within which a student's answer should be. Literally we test the following `|sa-ta| < |ta*tol|`. Here `sa` and `ta` are the numerical value of the student's and teacher's answer respectively. The same `tol` is used both when the units match and *once they have been converted to base units*. For the `NumRelative` test the option gives the required percentage tolerance within which a student's answer should be. Literally we test the following `|sa-ta| < |ta*tol|`. Here `sa` and `ta` are the numerical value of the student's and teacher's answer respectively. The same `tol` is used both when the units match and *once they have been converted to base units*.
Similarly, for `NumAbsolute` the option is an absolute difference. Literally we test Similarly, for `NumAbsolute` the option is an absolute difference. Literally we test
`|sa-ta| < |tol|`. Here `sa` and `ta` are the numerical value of the student's and teacher's answer respectively *once they have been converted to base units*. Note, where the units are compatible, the same `tol` is used before and after conversion to base units. For this reason, the test `UnitsAbsolute` is likely to give strange behaviour for answers where the units are compatible. *Suggestions from those teaching science, with examples, of improved behaviour here are very welcome!* `|sa-ta| < |tol|`. Here `sa` and `ta` are the numerical value of the student's and teacher's answer respectively *once they have been converted to base units*. Note, where the units are compatible, the same `tol` is used before and after conversion to base units. For this reason, the test `UnitsAbsolute` is likely to give strange behaviour for answers where the units are compatible.
## Dealing with units in Maxima functions, e.g. question variables and PRTs ## ## Dealing with units in Maxima functions, e.g. question variables and PRTs ##
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
Numerical answer tests are documented in a page dedicated to [numerical answer tests](../Authoring/Answer_tests_numerical.md). Numerical answer tests are documented in a page dedicated to [numerical answer tests](../Authoring/Answer_tests_numerical.md).
## Constants ## ## Precise Constants ##
In maxima the special constants are defined to be In Maxima the special constants are defined to be
%i, %e, %pi %i, %e, %pi
...@@ -18,27 +18,36 @@ Optionally, depending on the question settings, you have ...@@ -18,27 +18,36 @@ Optionally, depending on the question settings, you have
i: %i i: %i
j: %i j: %i
Sometimes you need to use \(e\) as an abstract symbol not a number. Sometimes you need to use \(e\), or other constants, as an abstract symbol not a number. The Maxima solution is to use the `kill()` command, but for security reasons users of STACK are not permitted to use this function. Instead use `stack_reset_vars(true)` in the question variables. This resets all the special constants defined by STACK so the symbols can be redefined in an individual STACK question.
The Maxima solution is to use the `kill()` command, but for security reasons users of STACK are not permitted to use this function. Instead use `stack_reset_vars(true)` in the question variables.
This resets all the special constants defined by STACK so the symbols can be redefined in a STACK question.
The following commands which are relevant to manipulation of numbers are defined by STACK. ## Internal representation of numbers ##
| Command | Description Maxima has two data types to represent numbers: integers and floats. Rational numbers are expressed as a division of two integers not with a dedicated data type, and surds with fractional powers or the `sqrt` function.
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The option [Surd for Square Root](../Authoring/Options.md#surd) enables the question author to alter the way surds are displayed in STACK.
| `decimalplaces(x,n)` | Truncate \(x\) to \(n\) decimal places.
| `dispdp(x,n)` | Truncate \(x\) to \(n\) decimal places and display with trailing digits.
| `significantfigures(x,n)` | Truncate \(x\) to \(n\) significant figures.
| `scientific_notation(x)` | Write \(x\) in the form \(m10^e\). Only works with `simp:false`.
| `commonfaclist(l)` | Returns the hcf of a list of numbers.
| `list_expression_numbers(ex)` | Create a list with all parts for which `numberp(ex)=true`.
| `coeff_list(ex,v)` | This function takes an expression \(ex\) and returns a list of coefficients of \(v\).
| `coeff_list_nz(ex,v)` | This function takes an expression \(ex\) and returns a list of nonzero coefficients of \(v\).
| `numabsolutep(sa,ta,tol)` | Is \(sa\) within \(tol\) of \(ta\)? I.e. \( |sa-ta|<tol \)
| `numrelativep(sa,ta,tol)` | Is \(sa\) within \(tol\times ta\) of \(ta\)? I.e. \( |sa-ta|<tol\times ta \).
## Display of numbers ## Similarly, complex numbers are not represented as a single object, but as a sum of real and imaginary parts, or via the exponential function.
The input and display of complex numbers is difficult, since differences exist between mathematics, physics and engineering about which symbols to use.
The option [sqrt(-1)](../Authoring/Options.md#sqrt_minus_one) is set in each question to sort out meaning and display.
## Floating point numbers ## {#Floats}
* To convert to a float use Maxima's `float(ex)` command.
* To convert a float to an exact representation use `rat(x)` to rationalise the decimal.
The variable \(e\) has been defined as `e:exp(1)`. This now potentially conflicts with scientific notation `2e3` which means `2*10^3`.
If you expect students to use scientific notation for numbers, e.g. `3e4` (which means \(3\times 10^{4}\) ), then you may want to use the [option for strict syntax](../Authoring/Inputs.md#Strict_Syntax).
## Maxima and floats with trailing zeros ##
For its internal representation, Maxima always truncates trailing zeros from a floating point number. For example, the Maxima expression `0.01000` will be converted internally to `0.01`. Actually this is a byproduct of the process of converting a decimal input to an internal binary float, and back again. Similarly, when a number is a "float" datatype, Maxima always prints at least one decimal digit to indicate the number is a float. For example, the floating point representation of the number ten is \(10.0\). This does _not_ indicate significant figures, rather it indicates data type. In situations where the number of significant figures is crucial this is problematic.
Display of numbers in STACK is controlled with LaTeX, and the underlying LISP provides flexible ways to represent numbers.
Note, that apart from the units input, all other input types truncate the display of unnecessary trailing zeros in floating point numbers, loosing information about significant figures. So, when the student's answer is a floating point number, trailing zeros will not be displayed. If you want to specifically test for significant figures, use the [units input type](../Authoring/Units.md), with the teacher's answer having no units. The units input type should display the same number of significant figures as typed in by the student.
## Display of numbers with LaTeX ##
The display of numbers is controlled by Maxima's `texnumformat` command, which STACK modifies. The display of numbers is controlled by Maxima's `texnumformat` command, which STACK modifies.
...@@ -47,7 +56,7 @@ Stack provides two variables to control the display of integers and floats respe ...@@ -47,7 +56,7 @@ Stack provides two variables to control the display of integers and floats respe
stackintfmt:"~d"; stackintfmt:"~d";
stackfltfmt:"~a"; stackfltfmt:"~a";
These two variables control the output format of integers (`integerp`) and floats (`floatnump`) respectively. These variables persist, so you need to define their values each time you expect them to change. These two variables control the output format of integers (identified by the predicate `integerp`) and floats (identified by the predicate `floatnump`) respectively. These variables persist, so you need to define their values each time you expect them to change.
These variables must be assigned a string following Maxima's `printf` format. These variables must be assigned a string following Maxima's `printf` format.
...@@ -55,7 +64,8 @@ These variables can be defined in the question variables, for global effect. Th ...@@ -55,7 +64,8 @@ These variables can be defined in the question variables, for global effect. Th
The decimal number @n:73@ is written in base \(2\) as @(stackintfmt:"~2r",n)@, in base \(7\) as @(stackintfmt:"~7r",n)@, in scientific notation as @(stackintfmt:"~e",n)@ and in rhetoric as @(stackintfmt:"~r",n)@. The decimal number @n:73@ is written in base \(2\) as @(stackintfmt:"~2r",n)@, in base \(7\) as @(stackintfmt:"~7r",n)@, in scientific notation as @(stackintfmt:"~e",n)@ and in rhetoric as @(stackintfmt:"~r",n)@.
The result should be "The decimal number \(73\) is written in base \(2\) as \(1001001\), in base \(7\) as \(133\), in scientific notation as \(7.3E+1\) and in rhetoric as \(seventy-three\).." The result should be "The decimal number \(73\) is written in base \(2\) as \(1001001\), in base \(7\) as \(133\), in scientific notation as \(7.3E+1\) and in rhetoric as \(seventy-three\)."
To force all floating point numbers to scientific notation use To force all floating point numbers to scientific notation use
...@@ -65,15 +75,28 @@ To force all floating point numbers to decimal floating point numbers use ...@@ -65,15 +75,28 @@ To force all floating point numbers to decimal floating point numbers use
stackfltfmt:"~f"; stackfltfmt:"~f";
You can also force all integers to be displayed as floating point decimals or in scientific notation using `stackintfmt` and the appropriate template. You can also force all integers to be displayed as floating point decimals or in scientific notation using `stackintfmt` and the appropriate template. This function calls the LISP `format` function, which is complex and more example are available [online](http://www.gigamonkeys.com/book/a-few-format-recipes.html) elsewhere.
The number of decimal digits printed is controlled by Maxima's `fpprec` and `fpprintprec` variables. The default for STACK is | Template | Input | TeX Output | Description/notes
| ----------- | ----------- | -------------- | ----------------------------------------------------------------------------------------------
| `"~,4f"` | `0.12349` | \(0.1235\) | Output four decimal places: floating point.
| | `0.12345` | \(0.1234\) | Note the rounding.
| | `0.12` | \(0.1200\) |
| `"~,5e"` | `100.34` | \(1.00340e+2\) | Output five decimal places: scientific notation.
| `"~:d"` | `10000000` | \(10,000,000\) | Separate decimal groups of three digits with commas.
| `~r` | `9` | \(nine\) | Rhetoric.
| `~:r` | `9` | \(ninth\) | Ordinal rhetoric.
| `~7r` | `9` | \(12\) | Base 7.
| `~@r` | `9` | \(IX\) | Roman numerals.
| `~:@r` | `9` | \(VIIII\) | Old style Roman numerals.
There are many other options within the LISP format command. Please note with the rhetoric and Roman numerals that the numbers will be in LaTeX mathematics environments.
Maxima has a separate system for controlling the number of decimal digits used in calculations and when printing the _value_ of computed results. Trailing zeros will not be printed with the value. This is controlled by Maxima's `fpprec` and `fpprintprec` variables. The default for STACK is
fpprec:20, /* Work with 20 digits. */ fpprec:20, /* Work with 20 digits. */
fpprintprec:12, /* Print only 12 digits. */ fpprintprec:12, /* Print only 12 digits. */
For further examples, please see Maxima's documentation on `printf`.
## Notes about numerical rounding ## ## Notes about numerical rounding ##
There are two ways to round numbers ending in a digit \(5\). There are two ways to round numbers ending in a digit \(5\).
...@@ -85,7 +108,23 @@ Maxima's `round(ex)` command rounds multiples of 1/2 to the nearest even integer ...@@ -85,7 +108,23 @@ Maxima's `round(ex)` command rounds multiples of 1/2 to the nearest even integer
STACK has defined the function `significantfigures(x,n)` to conform to convention of rounding up. STACK has defined the function `significantfigures(x,n)` to conform to convention of rounding up.
## STACK numerical predicates ## ## STACK numerical functions and predicates ##
The following commands which are relevant to manipulation of numbers are defined by STACK.
| Command | Description
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| `significantfigures(x,n)` | Truncate \(x\) to \(n\) significant figures.
| `decimalplaces(x,n)` | Truncate \(x\) to \(n\) decimal places.
| `dispdp(x,n)` | Truncate \(x\) to \(n\) decimal places and display with trailing digits. Note, this always prints as a float, and not in scientific notation.
| `scientific_notation(x,n)` | Write \(x\) in the form \(m10^e\). Only works with `simp:false` and when printing as a float. The optional second argument applies `dispdp(m,n)` to the mantissa to control the display of trailing zeros.
| `commonfaclist(l)` | Returns the hcf of a list of numbers.
| `list_expression_numbers(ex)` | Create a list with all parts for which `numberp(ex)=true`.
| `coeff_list(ex,v)` | This function takes an expression \(ex\) and returns a list of coefficients of \(v\).
| `coeff_list_nz(ex,v)` | This function takes an expression \(ex\) and returns a list of nonzero coefficients of \(v\).
| `numabsolutep(sa,ta,tol)` | Is \(sa\) within \(tol\) of \(ta\)? I.e. \( |sa-ta|<tol \)
| `numrelativep(sa,ta,tol)` | Is \(sa\) within \(tol\times ta\) of \(ta\)? I.e. \( |sa-ta|<tol\times ta \).
| Function | Predicate | Function | Predicate
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
...@@ -95,26 +134,6 @@ STACK has defined the function `significantfigures(x,n)` to conform to conventio ...@@ -95,26 +134,6 @@ STACK has defined the function `significantfigures(x,n)` to conform to conventio
| `anyfloatex(ex)` | Decides if any floats are in the expression. | `anyfloatex(ex)` | Decides if any floats are in the expression.
## Floating point numbers ## {#Floats}
The variable \(e\) has been defined as `e:exp(1)`. This now potentially conflicts with scientific notation `2e3` which means `2*10^3`.
If you expect students to use scientific notation for numbers, e.g. `3e4` (which means \(3\times 10^{4}\) ), then you must use the [option for strict syntax](../Authoring/Inputs.md#Strict_Syntax). Otherwise STACK will try to insert star characters for you and `3e4` will be interpreted as `3*e*4`.
## Displaying a float with trailing zeros ##
By default in Maxima all trailing zeros are suppressed. Therefore, you can't display \(3.00\) for scientific work easily. To overcome this, STACK provides a function `dispdp(x, n)`. Here `x` is a number, and `n` is the number of decimal digits to display. This function does perform rounding, and adds trailing digits to the display. If you want to do further calculation with the value don't use this function, instead round with `decimalplaces(x,n)` and display only at the last moment.
## Surds ##
The option [Surd for Square Root](../Authoring/Options.md#surd) enables the question author to alter the way surds are displayed in STACK.
## Complex numbers ##
The input and display of complex numbers is difficult, since differences exist between mathematics, physics and engineering about which symbols to use.
The option [sqrt(-1)](../Authoring/Options.md#sqrt_minus_one) is set in each question to sort out meaning and display.
## See also ## See also
[Maxima reference topics](index.md#reference) [Maxima reference topics](index.md#reference)
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
For current and future plans, see [Development track](Development_track.md) and [Future plans](Future_plans.md). For current and future plans, see [Development track](Development_track.md) and [Future plans](Future_plans.md).
## Version 3.5.6
TODO for release.
1. Add additional units suggestested by David H.
2. Ensure for the units input that the validation feedback displays the number of decimal places found in the student's answer.
3. Add unit tests for the validation feedback, including a question walk through.
New featured added in this branch, but not yet on a tagged release. New featured added in this branch, but not yet on a tagged release.
1. Change the display so that the underscore in atoms is displayed using subscripts. 1. Change the display so that the underscore in atoms is displayed using subscripts.
......
...@@ -22,7 +22,8 @@ Note, where the feature is listed as "(done)" means we have prototype code in th ...@@ -22,7 +22,8 @@ Note, where the feature is listed as "(done)" means we have prototype code in th
1. (done - in equiv branch) "scratch working" area in which students can record their thinking etc. alongside the final answer. 1. (done - in equiv branch) "scratch working" area in which students can record their thinking etc. alongside the final answer.
2. Dragmath (actually, probably use javascript from NUMBAS instead here, or the MathDox editor). 2. Dragmath (actually, probably use javascript from NUMBAS instead here, or the MathDox editor).
3. Sliders. 3. Sliders.
4. Geogebra input. 4. Geogebra input (protoype already exisits: needs documentation, testing and support).
5. Re-sizable matrix input. See NUMBAS examples here, with Javascript.
* It is very useful to be able to embed input elements in equations, and this was working in STACK 2.0. However is it possible with MathJax or other Moodle maths filters? * It is very useful to be able to embed input elements in equations, and this was working in STACK 2.0. However is it possible with MathJax or other Moodle maths filters?
This might offer one option: http://stackoverflow.com/questions/23818478/html-input-field-within-a-mathjax-tex-equation This might offer one option: http://stackoverflow.com/questions/23818478/html-input-field-within-a-mathjax-tex-equation
* In the MCQ input type: Add choose N (correct) from M feature (used at Aalto). * In the MCQ input type: Add choose N (correct) from M feature (used at Aalto).
......
...@@ -72,6 +72,7 @@ $settings->add(new admin_setting_configselect('qtype_stack/maximaversion', ...@@ -72,6 +72,7 @@ $settings->add(new admin_setting_configselect('qtype_stack/maximaversion',
'5.32.0' => '5.32.0', '5.32.1' => '5.32.1', '5.33.0' => '5.33.0', '5.32.0' => '5.32.0', '5.32.1' => '5.32.1', '5.33.0' => '5.33.0',
'5.34.0' => '5.34.0', '5.34.1' => '5.34.1', '5.35.1' => '5.35.1', '5.34.0' => '5.34.0', '5.34.1' => '5.34.1', '5.35.1' => '5.35.1',
'5.35.1.2' => '3.35.1.2', '5.36.0' => '5.36.0', '5.36.1' => '5.36.1', '5.35.1.2' => '3.35.1.2', '5.36.0' => '5.36.0', '5.36.1' => '5.36.1',
'5.37.3' => '5.37.3', // Recently compiled GCL version for Windows is much faster.
'5.38.0' => '5.38.0', '5.38.1' => '5.38.1', '5.38.0' => '5.38.0', '5.38.1' => '5.38.1',
'default' => 'default'))); 'default' => 'default')));
......
...@@ -132,10 +132,16 @@ class stack_cas_configuration { ...@@ -132,10 +132,16 @@ class stack_cas_configuration {
} }
$locations = array(); $locations = array();
$locations[] = 'C:/maxima-' . $this->settings->maximaversion . '/';
$locations[] = 'C:/Maxima-' . $this->settings->maximaversion . '/';
$locations[] = 'C:/bin/Maxima-gcl-' . $this->settings->maximaversion . '/';
$locations[] = 'C:/bin/Maxima-sbcl-' . $this->settings->maximaversion . '/';
$locations[] = 'C:/Program Files/Maxima-' . $this->settings->maximaversion . '/'; $locations[] = 'C:/Program Files/Maxima-' . $this->settings->maximaversion . '/';
$locations[] = 'C:/Program Files (x86)/Maxima-' . $this->settings->maximaversion . '/'; $locations[] = 'C:/Program Files (x86)/Maxima-' . $this->settings->maximaversion . '/';
$locations[] = 'C:/Program Files/Maxima-sbcl-' . $this->settings->maximaversion . '/'; $locations[] = 'C:/Program Files/Maxima-sbcl-' . $this->settings->maximaversion . '/';
$locations[] = 'C:/Program Files (x86)/Maxima-sbcl-' . $this->settings->maximaversion . '/'; $locations[] = 'C:/Program Files (x86)/Maxima-sbcl-' . $this->settings->maximaversion . '/';
$locations[] = 'C:/Program Files/Maxima-gcl-' . $this->settings->maximaversion . '/';
$locations[] = 'C:/Program Files (x86)/Maxima-gcl-' . $this->settings->maximaversion . '/';
if ('5.25.1' == $this->settings->maximaversion) { if ('5.25.1' == $this->settings->maximaversion) {
$locations[] = 'C:/Program Files/Maxima-5.25.1-gcl/'; $locations[] = 'C:/Program Files/Maxima-5.25.1-gcl/';
$locations[] = 'C:/Program Files (x86)/Maxima-5.25.1-gcl/'; $locations[] = 'C:/Program Files (x86)/Maxima-5.25.1-gcl/';
......
...@@ -280,14 +280,18 @@ significantfigures(x,n) := block([fpprec:128, fpprintprec:16, simp:true, ex, ex1 ...@@ -280,14 +280,18 @@ significantfigures(x,n) := block([fpprec:128, fpprintprec:16, simp:true, ex, ex1
return(ex2) return(ex2)
)$ )$
scientific_notation(x) := block([simp:false,fpprintprec,ex,ex2,ex3], scientific_notation([a]) := block([simp:false,fpprintprec,ex,ex2,ex3,exn],
if ev(is(length(a)=1), simp) then (x:first(a), exn:false)
else if ev(is(length(a)=2), simp) then (x:first(a), exn:second(a))
else error("scientific_notation takes only one or two arguments"),
if real_numberp(x) and ev(x>0,simp) then ( if real_numberp(x) and ev(x>0,simp) then (
ex:ev(floor(float(log(x)/log(10))),simp), ex:ev(floor(float(log(x)/log(10))),simp),
ex2:ev(float(x/10^ex),simp), ex2:ev(float(x/10^ex),simp),
ex3:ex2*10^ex, ex3:ex2*10^ex,
if not(is(exn=false)) then ex3:dispdp(ex2,exn)*10^ex,
return(ex3) return(ex3)
) else return (x) ) else return (x)
); )$
/* ********************************** */ /* ********************************** */
/* Inequalities */ /* Inequalities */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment