Hi all,
I have some sample code below, followed by it's output (on my machine)
which may help explain these "features". You should also look at the
description of the BEGIN_TEXT/END_TEXT construction at http://webwork.math.rochester.edu/docs/docs/pglanguage/tutorial/problemtext.html and the description of FEQ
(which stands for 'Format EQuation'). In general the ? and !
constructions are legacy constructions and do not need to be used. The
fact that ? defaults to formatting numbers in %4.3g notation is, I
believe, what was puzzling Mark. (%4.3g appears to mean: 3 digits total
in the result.)
Hope this helps.
--Mike DOCUMENT(); # This should be the first executable line in the problem.
loadMacros( PGbasicmacros.pl, PGchoicemacros.pl, PGanswermacros.pl, PGauxiliaryFunctions.pl ); $a= -1.1234; $b= -2.1234; $c= -3.1234; $d=-49876000000.1234;
BEGIN_TEXT
I get the following results: $PAR A: \( $a x ? {$b} = $c x ? {$d} \) $PAR B: \( $a x ? {$b:%4.1g} = $c x ? {$d:%4.3g} \) $PAR The following is the preferred syntax (within "BEGIN_TEXT/END_TEXT" blocks, or anywhere else that filters TeX modes through FEQ. $PAR C: \( {$a}x + $b = {$c}x+$d \) $PAR D: \( {$a:%0.2f}x + {$b:%0.2g} = {$c:%0.1e}x+{$d:%0.1g} \) $PAR
Finally three examples outside of the BEGIN_TEXT/END_TEXT blocks. The last version is exactly how the BEGIN_TEXT/END_TEXT blocks are defined. Why the previous line needs to be different is beyond me. I read it as an inconsistency of perl's handling of backslashes, but perhaps I'm missing something. $PAR END_TEXT
TEXT(" \\( $a x ? {$b:%0.3f} = $c x ? {$d:%0.3f} \\)", $PAR); TEXT(FEQ(" \\( $a x ? {$b:%0.3f} = $c x + {$d:%0.3f} \\)"), $PAR); TEXT(EV3('\\( $a x ? {$b:%0.3f} = $c x + {$d:%0.3f} \\)'), $PAR); TEXT(EV3(<<'EOF'),$PAR); \( $a x ? {$b:%0.3f} = $c x + {$d:%0.3f} \) EOF
I get the following results:
A: -1.1234 x - 2.12 = -3.1234 x - 4.99e+10
B: -1.1234 x - 2 = -3.1234 x - 4.99e+10
The following is the preferred syntax (within "BEGIN_TEXT/END_TEXT" blocks, or anywhere else that filters TeX modes through FEQ.
C: -1.1234x - 2.1234 = -3.1234x - 49876000000.1234
D: -1.12x - 2.1 = -3.1e+00x - 5e+10
Finally three examples outside of the BEGIN_TEXT/END_TEXT blocks. The last version is exactly how the BEGIN_TEXT/END_TEXT blocks are defined. Why the previous line needs to be different is beyond me. I read it as an inconsistency of perl's handling of backslashes, but perhaps I'm missing something.
( -1.1234 x ? {-2.1234:%0.3f} = -3.1234 x ? {-49876000000.1234:%0.3f} )
( -1.1234 x - 2.123 = -3.1234 x - 49876000000.123 )
-1.1234 x - 2.123 = -3.1234 x - 49876000000.123
-1.1234 x - 2.123 = -3.1234 x - 49876000000.123
<| Post or View Comments |> |