WeBWorK Problems

Why comments and latex \( do not work?

Why comments and latex \( do not work?

by ADAM SIKORA -
Number of replies: 2

Hi, why comments and latex \( do not work in the problem below? (As in the screenshot.)


##DESCRIPTION

##  Total Probability 

##ENDDESCRIPTION

##KEYWORDS('probability')

## DBsubject('Probability')

## DBchapter('ConditionalProbability')

## DBsection('Total Probability')

## Date('6/3/2002')

## Author('Saad Ghahramani')

## Institution('')

## TitleText1('Fundamentals of Probability')

## EditionText1('3')

## AuthorText1('Saad Ghahramani')

## Section1('3.3')

## Problem1('6')

########################################################################

DOCUMENT();      

loadMacros(

   "PGstandard.pl",     # Standard macros for PG language

   "MathObjects.pl",

   "PGML.pl",

   #"source.pl",        # allows code to be displayed on certain sites.

   #"PGcourse.pl",      # Customization file for the course

);

# Print problem number and point value (weight) for the problem

TEXT(beginproblem());

# Show which answers are correct and which ones are incorrect

$showPartialCorrectAnswers = 1;

Context("Numeric");

#Context()->texStrings;

#BEGIN_TEXT

BEGIN_PGML

Let X, Y, and Z be random variables. Suppose that the variance of X is 0.7, Cov(X,Y) = 0.4, Cov(X,Z) = 1.2, and Cov(Y,Z) = 0.8. Find each of the following to two decimal places (if applicable).

(a)

\(Cov(2 Y, 3 X +1)\)

[____]{14.4}

     # 4*9*0.4

 (b)

Cov(2 X + Y, 3 X + 2 Z) 

[____]{51.2}

        # 4*9*0.7 + 4*4*1.2+ 9*0.4+ 4*0.8

END_PGML

#Context()->normalStrings;

ENDDOCUMENT();

Attachment Screen Shot 2021-11-21 at 6.36.57 PM.png
In reply to ADAM SIKORA

Re: Why comments and latex \( do not work?

by Glenn Rice -
In PGML use [`Cov(2 Y, 3 X +1)`] for latex, and [% this is a comment %] for comments. You should take a look at https://webwork.maa.org/wiki/Category:PGML and specifically https://webwork.maa.org/wiki/Introduction_to_PGML for more information on using PGML.
In reply to ADAM SIKORA

Re: Why comments and latex \( do not work?

by Alex Jordan -

This problem uses PGML, with the statement wrapped in BEGIN_PGML...END_PGML. The math delimiters for PGML are different than for regular PG. They are not slash-parens.  Here is some documentation:

https://webwork.maa.org/wiki/Mathematical_notation_-_PGML

For inline math, the delimiters are [`...`].

For a comment in PGML, see:

https://webwork.maa.org/wiki/Comments_-_PGML

For more about PGML, see:

https://webwork.maa.org/wiki/Category:PGML_Syntax