Difference between revisions of "InequalityAnswer1"

From WeBWorK_wiki
Jump to navigation Jump to search
(Created page with '<h2>Answer is an Inequality</h2> 300px|thumb|right|Click to enlarge <p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;"> This …')
 
(add historical tag and give links to newer problems.)
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
  +
{{historical}}
  +
  +
<p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Algebra/InequalityAnswer.html a newer version of this problem]</p>
  +
  +
 
<h2>Answer is an Inequality</h2>
 
<h2>Answer is an Inequality</h2>
   
Line 5: Line 10:
 
This PG code shows a question whose answer is an inequality.
 
This PG code shows a question whose answer is an inequality.
 
</p>
 
</p>
* Download file: [[File:InequalityAnswer1.txt]] (change the file extension from txt to pg when you save it)
 
  +
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/InequalityAnswer1.pg FortLewis/Authoring/Templates/Algebra/InequalityAnswer1.pg]
* File location in NPL: <code>FortLewis/Authoring/Templates/Algebra/InequalityAnswer1.pg</code>
 
  +
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/InequalityAnswer1_PGML.pg FortLewis/Authoring/Templates/Algebra/InequalityAnswer1_PGML.pg]
   
 
<br clear="all" />
 
<br clear="all" />
Line 67: Line 72:
 
<pre>
 
<pre>
 
Context("Inequalities-Only");
 
Context("Inequalities-Only");
  +
Context()->flags->set(formatStudentAnswer=>'parsed');
   
 
$a = random(3,9,1);
 
$a = random(3,9,1);
   
$ineq = "-$a x <= 10";
+
$ineq = "-$a x \leq 10"; # TeX
   
 
$answer = Compute("x >= -10 / $a");
 
$answer = Compute("x >= -10 / $a");
Line 78: Line 84:
 
<p>
 
<p>
 
<b>Setup:</b>
 
<b>Setup:</b>
We require students to use inequalities by using <code>Context("Inequalities-Only")</code>. If we had used <code>Context("Inequalities")</code> instead, then students could also enter their answer using interval notation.
+
We require students to use inequalities by using <code>Context("Inequalities-Only")</code>. If we had used <code>Context("Inequalities")</code> instead, then students could also enter their answer using interval notation. For more details, please see [http://webwork.maa.org/pod/pg/macros/contextInequalities.html contextInequalities.pl]
  +
</p>
  +
<p>
  +
We use <code>formatStudentAnswer=>'parsed'</code> and <code>Compute()</code> so that the student's answer are left as fractions rather than reduced to decimals.
 
</p>
 
</p>
 
</td>
 
</td>
Line 152: Line 158:
   
 
[[Category:Top]]
 
[[Category:Top]]
[[Category:Authors]]
+
[[Category:Sample Problems]]
  +
[[Category:Subject Area Templates]]

Latest revision as of 04:46, 18 July 2023

This article has been retained as a historical document. It is not up-to-date and the formatting may be lacking. Use the information herein with caution.

This problem has been replaced with a newer version of this problem


Answer is an Inequality

Click to enlarge

This PG code shows a question whose answer is an inequality.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"contextInequalities.pl",
"AnswerFormatHelp.pl",
);

TEXT(beginproblem());

Initialization: We must load contextInequalities.pl.

Context("Inequalities-Only");
Context()->flags->set(formatStudentAnswer=>'parsed');

$a = random(3,9,1);

$ineq = "-$a x \leq 10";  # TeX

$answer = Compute("x >= -10 / $a");

Setup: We require students to use inequalities by using Context("Inequalities-Only"). If we had used Context("Inequalities") instead, then students could also enter their answer using interval notation. For more details, please see contextInequalities.pl

We use formatStudentAnswer=>'parsed' and Compute() so that the student's answer are left as fractions rather than reduced to decimals.

Context()->texStrings;
BEGIN_TEXT
Solve the inequality \( \displaystyle $ineq \).
Enter your answer using inequality notation.
$BR
$BR
\{ ans_rule(40) \}
\{ AnswerFormatHelp("inequalities") \}
END_TEXT
Context()->normalStrings;

Main Text:

$showPartialCorrectAnswers = 1;

ANS( $answer->cmp() );

Answer Evaluation:

Context()->texStrings;
BEGIN_SOLUTION
${PAR}SOLUTION:${PAR}
Solution explanation goes here.
END_SOLUTION
Context()->normalStrings;

COMMENT("MathObject version.");

ENDDOCUMENT();

Solution:

Templates by Subject Area