Sig fig context - #1474
Conversation
|
One thing to note is that this context only handles constant computations, not formulas involving significant figures. That can be added later, but will take more work that hasn't been done yet. Similarly, as Peter mentions, the current context only supports addition, subtraction, multiplication, division, and powers. So other functions, like trigonometric functions, logs, roots, etc., aren't yet implemented. The comments that I made that Peter links to above give one approach that could be taken for such functions. A full significant figures context should handle these other situations, but this is certainly useful as it stands. |
This includes flags for determining if a problem is to check to see if an answer has the correct # of sig figs and/or is close and give partial credit.
when using the extension with Units context and added a test for units with significant figures.
Also fixed an issue with the testing for "closeness" between student and correct sigfig answers.
Also, some improvements to language on tests.
And add in a test for partial credit.
The externs to formulas is non-trivial, and will require overriding a number of internal functions, so not something you may be able to do without assistance. I outlined an approach for handling functions in the comments you link to above, so that is something you may be able to implement more readily. I tried it out at one point, and think it worked out pretty well. |
|
@dpvc I got a note from @sfiedle1 about using flags in the extended context with units. Here's a pg file: This should give partial credit for numbers that are close with either correct or incorrect number of sig figs. Doing some troubleshooting, it looks like |
|
The MathObjects that use other math objects internally don't usually use those object's Trying to combine the various partial credits for the outer object and its parts would be a complicated process. For example, the One solution would be to provide a custom checker that does what you want, and then use something like [___]{$c->cmp(checker => &$context::SignificantFigures::unitChecker)}or something like that. A bit ugly, but easily handled. A solution that is easier for the problem author would be to provide a One complication with this is that it would depend on the Units context, so you would need that to be loaded before you could make the |
This creates a context for Significant Figures and huge thanks to @dpvc for all the help and @sfiedle1 for ideas, code and other suggestions.
In short, this handles the creation of a number type that keeps track of the number of its significant figures. Although the number is stored as a floating point, the
stringmethod rounds to the appropriate number of significant figures.Here are a few features:
1.23^3to result in an expected number with 3 sigfigs instead of 1, since 3 only has 1 sig fig.LimitedSignificantFigurescontext which disallows computations similar to other contexts.contextExtensions.plmacro, problems using both SignificantFigures and Units can be used together.There are two test suites.
significant_figures.ttests only numbers and operations between numbers.significant_figures_units.tincludes some simple tests for numbers with units.I have attached 4 sample problems.
setsig_fig.zip
If we can get this into 2.21, that would be great. It doesn't affect anything else. If not, I'll retarget to develop.
Also, for historical purposes, there is other discussion: pstaabp/pull/25 pstaabp/pull/32, pstaabp/pull/34 and pstaabp/pull/36