Forum archive 2000-2006

Mark Schmitt - Strange display error

Mark Schmitt - Strange display error

by Arnold Pizer -
Number of replies: 0
inactiveTopicStrange display error topic started 9/27/2002; 3:48:39 AM
last post 9/28/2002; 4:34:39 AM
userMark Schmitt - Strange display error  blueArrow
9/27/2002; 3:48:39 AM (reads: 801, responses: 3)
I have b and d as non_zero_random(-10,10,.01). a and c are random(5,9,.01).

When I try to display \( $a x ? {$b} = $c x ? {$d} \), the last digit of $d disappears, but the last digit of $b is fine. Any idea what the issue might be?

I have solved the issue temporarily by changing the problem to \($a x ?{$b} = $d + $c x\), but I would like to know if I should worry about the way additive problems are displayed.

Thanks.

Mark

<| Post or View Comments |>


userJohn Jones - Re: Strange display error  blueArrow
9/27/2002; 5:43:36 PM (reads: 984, responses: 0)
Mark,

I can't reproduce the problem. What happens if you use:

 

BEGIN_TEXT
My equation is \( $a x +$b = $c x +$d \).
END_TEXT

John

<| Post or View Comments |>


userMark Schmitt - Re: Strange display error  blueArrow
9/28/2002; 3:14:32 AM (reads: 964, responses: 0)
If I use that code, all the digits are displayed, but if $d or $b < 0, I see:

4.52x +-5.21 = 3.27x +-4.31.

That is just as hard to read. I like the ability to have the right sign displayed without the extra +. But, as I said, I have a work around, by just putting the constant first. Mostly I'm wondering if this happens elsewhere.

Mark

<| Post or View Comments |>


userMichael Gage - Re: Strange display error  blueArrow
9/28/2002; 4:34:39 AM (reads: 977, responses: 0)
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 |>