I was trying to clean up previously written problems and added parserCustomization.pl to the macos (allowing both i and j as sqrt(-1) ). This appeared to work well for the problems that I was testing. However, some problems in a different HW group in the same class, failed - as noted by a student. I was not working on the problems that he was working on - indeed, the problems that he was concerned with had no complex numbers. I cannot see why it failed. I had 7 problems that all used the same load macros command - all total overkill on macros (I know I don't need all of these, but I thought I'd include them all since some may be caused the problem, since the problem was modified from one in the problem library, before I understood mor about which macros are actually needed. However, only 2 of the problems bomb. I don't understand why. When I remove the parserCustomization.pl macro, the problem compile and execute correctly.

Currently, we are running without

parserCustomization.pl in the macros folder - and living with the i in the complex equations.

Error and code below

Joel

*********************

Error messages

ERRORS from evaluating PG file:

Error detected while loading [PG]/macros/MathObjects.pl: PG_macro_file_eval

detected error at line 123 of file [PG]/lib/PGloadfiles.pm Error detected

while loading [PG]/macros/Parser.pl: PG_macro_file_eval detected error at

line 123 of file [PG]/lib/PGloadfiles.pm Error detected while loading

[TMPL]/macros/parserCustomization.pl: PG_macro_file_eval detected error at

line 123 of file [PG]/lib/PGloadfiles.pm Can't locate object method

"Default" via package "context::ComplexJ" (perhaps you forgot to load

"context::ComplexJ"?) at line 6 of [TMPL]/macros/parserCustomization.pl,

chunk 1. The calling package is PGloadfiles The calling package is

PGloadfiles The calling package is PGloadfiles Died within

PGloadfiles::compile_file called at line 166 of [PG]/lib/PGloadfiles.pm

from within PGloadfiles::loadMacros called at line 444 of [PG]/macros/PG.pl

from within main::loadMacros called at line 18 of (eval 2269)

Error details

You do not have permission to view the details of this error.

Figured it would be of best interest to notify ASAP.

Thanks ahead of time,

-Matt

***** Data about the problem processor: *****

Display Mode: MathJax

Show Old Answers: yes

Show Correct Answers: no

Show Hints: yes

Show Solutions: no

***** Data about the user: *****

User ID: mpfishe2@ncsu.edu

Name: Matt Fisher

Email: mpfishe2@ncsu.edu

Student ID: 200046154

Status: Enrolled ('C')

Section:

Recitation:

Comment:

***** Data about the problem: *****

Problem ID: 3

Source file: local/setHomework_7_templates/Eulers_method_2nd_order_system_03.pg

Value: 10

Max attempts 10

Random seed: 4120

Status: 0

Attempted: no

Last answer: none

Number of correct attempts: 0

Number of incorrect attempts: 0

***** Data about the homework set: *****

Set ID: Homework_8

Set header file: defaultHeader

Hardcopy header file: defaultHeader

Open date: 10/30/2014 at 08:55am EDT

Due date: 11/14/2014 at 12:45pm EST

Answer date: 11/14/2014 at 12:45pm EST

Visible: yes

Assignment type: default

**********************************************************************************

# DESCRIPTION

# Problem from 'Mathematics: The Language of Electrical and Computer Engineering', Viniotis and Trussell, 3rd ed.

# WeBWorK problem written by Joel Trussell, <hjt@ncsu.edu>

# ENDDESCRIPTION

## DBsubject(Electrical Engineering)

## DBchapter(Differential equations)

## DBsection(Problems)

## Institution(North Carolina State University)

## Author(H. J. Trussell)

## TitleText1('Mathematics: The Language of Electrical and Computer Engineering')

## AuthorText1('Viniotis and Trussell')

## EditionText1('3')

## Problem1('7.23-24')

DOCUMENT(); # This should be the first executable line in the problem.

loadMacros(

"PG.pl",

"PGbasicmacros.pl",

"PGchoicemacros.pl",

"PGanswermacros.pl",

"PGgraphmacros.pl",

"PGmatrixmacros.pl",

"PGnumericalmacros.pl",

"PGauxiliaryFunctions.pl",

"PGcourse.pl",

"PGstandard.pl",

"MathObjects.pl",

"AnswerFormatHelp.pl",

"unionTables.pl",

"parserAssignment.pl",

"parserImplicitEquation.pl",

"unionLists.pl",

"parserPopUp.pl",

#"PGmorematrixmacros.pl"

);

TEXT(beginproblem());

$showPartialCorrectAnswers = 1;

Context("ImplicitEquation");

Context()->variables->{namePattern} = qr/[a-z][a-z0-9_]*'*/i;

Context()->variables->add(t=>"Real","v"=>"Real","v'"=>"Real",v1=>"Real",v2=>"Real",w=>"Real");

Context()->flags->set(

tolerance => 0.001,

tolType => "absolute",

zeroLevel => 1E-12, # when to use zeroLevelTol

zeroLevelTol => 1E-10, # smaller than this matches zero

ImplicitTolerance => 1E-6,

);

$c1 = random(2,9,1);

$c2 = random(2,9,1);

$c3 = random(2,9,1);

$c4 = random(2,9,1);

$w = random(10,100,10);

$a[1] = random(2,6,1) * random(-1,1,2);

$a[2] = $a[1];

$a[3] = random(2,6,1) * random(-1,1,2);

$a[4] = $a[3];

$tag = random(1,4,1);

$a[$tag] = - $a[$tag];

$m = random(2,5,1);

$n = random(2,5,1);

if ($m == $n) {$n = $n+1;}

$p = random(2,9,1);

$vd = Formula(" $c3 t cos(t) ");

$yd = Formula(" $c4 sin($w t)^2 ");

$h = 0.1;

$h2 = 2*$h;

$h3 = 3*$h;

$v0 = random(2,5,1);

$vdot0 = random(0,3,1);

$y0 = random(2,5,1);

$ydot0 = random(0,3,1);

$vdh = $c3*$h*cos($h);

$vdh2 = $c3*$h2*cos($h2);

$vdh3 = $c3*$h3*cos($h3);

$ydh = $c4*sin($w*$h)**2;

$ydh2 = $c4*sin($w*$h2)**2;

$ydh3 = $c4*sin($w*$h3)**2;

$vh = $v0 + $h*(-$c1)*$y0 ;

# if (abs($vh)<10**(-10)) {$vh = 0};

$yh = $y0 + $h*(-$c2)*$v0 ;

$vh2 = $vh + $h*(-$c1)*$yh + $h*$vdh;

$yh2 = $yh + $h*(-$c2)*$vh + $h*$ydh;

$vh3 = $vh2 + $h*(-$c1)*$yh2 + $h*$vdh2;

$yh3 = $yh2 + $h*(-$c2)*$vh2 + $h*$ydh2;

# det = $a[1] * $a[4] * e^(($m+$n)*t);

BEGIN_TEXT

This problem is related to Problem 7.23-24 in the text.

$PAR

Given the system of differential equations

$PAR

\( v' + $c1 y = $vd u(t)\)

$PAR

\( y' + $c2 v = $yd u(t) \)

$PAR

$BR The matrix equation for using Euler's method to compute \( v(t+h) \) and \( y(t+h) \), takes the same form as in the answer to Problem 9.

$PAR

For \( h = $h \), compute the solution for \( t = 0, $h, $h2, $h3 \), when the initial conditions are \( v(0) = $v0 \), and \( y(0) = $y0 \).

$BR

\( v(0) = \) \{ ans_rule(15)\} $BR

\( v(0.1) = \) \{ ans_rule(15)\} $BR

\( v(0.2) = \) \{ ans_rule(15)\} $BR

\( v(0.3) = \) \{ ans_rule(15)\} $BR

\( y(0) = \) \{ ans_rule(15)\} $BR

\( y(0.1) = \) \{ ans_rule(15)\} $BR

\( y(0.2) = \) \{ ans_rule(15)\} $BR

\( y(0.3) = \) \{ ans_rule(15)\} $BR

END_TEXT

ANS( Compute($v0)->cmp() );

ANS( Real($vh)->cmp() ); # change this later

ANS( Compute($vh2)->cmp() );

ANS( Compute($vh3)->cmp() );

ANS( Compute($y0)->cmp() );

ANS( Real($yh)->cmp() );

ANS( Compute($yh2)->cmp() );

ANS( Compute($yh3)->cmp() );

ENDDOCUMENT(); # This should be the last executable line in the problem.

## PREP 2014 Question Authoring - Archived

### problem with parserCustomization.pl

The cut-off date for posting to this forum is reached so you can no longer post to it.