## WeBWorK Problems

### Debugging a (simple?) product rule question - answer submission not working right ### Debugging a (simple?) product rule question - answer submission not working right

by Sean Fitzpatrick -
Number of replies: 5

We have a (non-OPL) problem on the product rule, which seems simple enough, but something is not working correctly.

If I try submitting an answer, it gets marked as correct or incorrect, but the message doesn't show up in the results table: I haven't been able to reproduce it, but one of my students reported the following error:

DBD::mysql::st execute failed: Data too long for column 'frozen_hash' at row 1 at /opt/webwork/webwork2/lib/WeBWorK/DB/Schema/NewSQL/Std.pm line 837.
Here is the code for the problem:

## DESCRIPTION

## This is Problem 2.4.15 from the APEX Calculus text. It covers differentiation of basic trig functions and the product rule.

## ENDDESCRIPTION

## DBsubject(Calculus - single variable)

## DBchapter(Differentiation)

## DBsection(Product rule (with trigonometric functions))

## Level(2)

## Institution('Valdosta State University')

## Author('S. V. Ault')

## RevisedBy('F. J. Francis')

## TitleText1('APEX Calculus')

## AuthorText1('Hartman')

## EditionText1('3.0')

## Section1('2.4')

## Problem1('15')

## MO(1)

## Keywords('derivative', 'product rule', 'trig functions', 'ULETH-MATH1560', 'ULETH-MATH1565')

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

#  Initialization

DOCUMENT();

# Load whatever macros you need for the problem

# REQUIRED: Used for basic question and answer operations.

"PGstandard.pl",

# REQUIRED: Used for expression parsing.

"MathObjects.pl",

# Usually required for proper text formatting.

"PGML.pl",

# Used to provide contextual help for how to type inequalities/intervals.

);

# Sets up basic problem information.

TEXT(beginproblem());

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

#   Setup

#-ULETH-#

Context("Numeric");

$a = random(2,9,1);$f = Formula("x^{$a}");$fp = $f->D('x');$r = random(1,2,1);

if ($r==1) {$g = Formula("sin(x)");

$gp = Formula("cos(x)");$ans = Formula("$f*cos(x) +$fp*sin(x)")->reduce();

} else {

$g = Formula("cos(x)");$gp = Formula("-sin(x)");

$ans = Formula("-$f*sin(x) + $fp*cos(x)")->reduce(); }$fb = Formula($f*$gp)->reduce();

$gb = Formula($fp*$g)->reduce(); #-ENDULETH-# ############################# # Problem Text #-ULETH-# BEGIN_PGML Compute the derivative of the given function. >>[f(x) = [$f*$g].]<< [f'(x) = ] [_______________] [@ AnswerFormatHelp("formulas") @]* END_PGML #-ENDULETH-# ############################# # Solution #-ULETH-# BEGIN_PGML_SOLUTION Use the Product Rule. [ f'(x) = ([$f])([$gp]) + ([$fp])([$g]) = [$fb] + [$gb] = [$ans].

]

END_PGML_SOLUTION

#-ENDULETH-#

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

#-ULETH-#

# Setting this to 1 means that students will receive feedback on whether their

$showPartialCorrectAnswers = 0; #-ENDULETH# ANS($ans->cmp() );

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

COMMENT('

Randomization provides 16 different possible versions of this question.<BR>

Includes a solution set.<BR>

');

ENDDOCUMENT(); ### Re: Debugging a (simple?) product rule question - answer submission not working right

by Glenn Rice -
The reason the message doesn't show up is because you have \$showPartialCorrectAnswers set to 0.

I am not sure where the error comes from. ### Re: Debugging a (simple?) product rule question - answer submission not working right

by Danny Glin -

The only tables that have a 'frozen_hash' column have to do with achievements.

I don't know anything about achievements, so I have a couple of wild guesses as to what's causing that error.  The default max size for the frozen_hash column is 1024 characters, so based on the error WW is trying to store something longer than that in the column.  My guesses are:

1. There is too much information to fit into 1024 characters, which could be because there are a lot of assignments/achievements in the course.
2. The hashing algorithm is doing something WW doesn't expect, which is causing the hash to be longer.  This could be because of a change to a different character set (e.g. utf8). ### Re: Debugging a (simple?) product rule question - answer submission not working right

by Sean Fitzpatrick -

Ahh, thanks.

I do have achievements turned on. (Haven't used them in the past but I saw Alex's video and they looked like fun.)

So far only one student complaining so I won't worry too much. ### Re: Debugging a (simple?) product rule question - answer submission not working right

by Sean Fitzpatrick -
Spoke too soon. Just got another email from a student with the error, but on a different problem. Probably there's one misbehaving achievement badge? I'm not sure the error gives me enough to track that down. Or maybe I just need to cut down on the number of achievements available. (I assigned them all since that seemed simpler.)

This student gave a bit more detail on the error:   