WeBWorK Problems

PGmorematrixmacros Working? Or my error?

PGmorematrixmacros Working? Or my error?

by Ian Delbridge -
Number of replies: 3
I was attempting to make a new problem modeled after 'Library/Rochester/setLinearAlgebra10Bases/ur_la_10_25.pg and I noticed that it used basis_cmp which would definitely be useful in the situation. However, I tried this out in a new question - I loaded different macros, but included the macro that contains that sub, PGmorematrixmacros.pl, and I get an error telling me that there were a lot of syntax errors in that macro. 

This is a little confusing to me because it was already used in the original problem, listed above, but broke when used here. My only thought as to why it would fail now is because possibly this macro depends on other macros that I didn't know to load as well, or perhaps it interferes with MathObjects or something else I loaded. 

Does anyone know if this is the case, or if I might have just messed up somewhere else in the problem somehow causing these errors?

I load PGstandard, MathObjects, PGmatrixmacros, and PGmorematrixmacros.

My other thought is that perhaps the macro file we are using in the course isn't up to date and has errors in it, though that wouldn't explain why it would load in the original but not in the newer one.

I'll post the error messages below, and attach a copy of the problem file (don't criticize the rest of the problem! It's not done yet! I'll fix it up when I can get past loading the macros. :)  ) 
The original problem's code is here on github.

        Problem4
ERROR caught by Translator while processing problem file:IansRevised8/Library/Rochester/setLinearAlgebra10Bases/ur_la_10_25.pg
****************
ERRORS from evaluating PG file: 
Error detected while loading [PG]/macros/PGmorematrixmacros.pl: PG_macro_file_eval detected error at line 123 of file [PG]/lib/PGloadfiles.pm syntax error at line 16 of [PG]/macros/PGmorematrixmacros.pl, near "new Matrix" syntax error at [PG]/macros/PGmorematrixmacros.pl line 17, near "new Matrix" syntax error at [PG]/macros/PGmorematrixmacros.pl line 42, near "new Matrix" syntax error at [PG]/macros/PGmorematrixmacros.pl line 70, near "new Matrix" Global symbol "$B" requires explicit package name at [PG]/macros/PGmorematrixmacros.pl line 72, chunk 1. Global symbol "$B" requires explicit package name at [PG]/macros/PGmorematrixmacros.pl line 73, chunk 1. syntax error at [PG]/macros/PGmorematrixmacros.pl line 86, near "new Matrix" Global symbol "$matrix" requires explicit package name at [PG]/macros/PGmorematrixmacros.pl line 87, chunk 1. Global symbol "$B" requires explicit package name at [PG]/macros/PGmorematrixmacros.pl line 88, chunk 1. Global symbol "$row" requires explicit package name at [PG]/macros/PGmorematrixmacros.pl line 88, chunk 1. Global symbol "$scalar" requires explicit package name at [PG]/macros/PGmorematrixmacros.pl line 88, chunk 1. Global symbol "$matrix" requires explicit package name at [PG]/macros/PGmorematrixmacros.pl line 88, chunk 1. Global symbol "$row" requires explicit package name at [PG]/macros/PGmorematrixmacros.pl line 88, chunk 1. Global symbol "$B" requires explicit package name at [PG]/macros/PGmorematrixmacros.pl line 90, chunk 1. syntax error at [PG]/macros/PGmorematrixmacros.pl line 91, near "; }" [PG]/macros/PGmorematrixmacros.pl has too many errors. 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 455 of [PG]/macros/PG.pl from within main::loadMacros called at line 19 of (eval 1478)
****************
------Input Read 1 ## DESCRIPTION 2 ## Linear Algebra 3 ## ENDDESCRIPTION 4 5 ## Tagged by cmd6a 4/29/06 6 7 ## DBsubject(Linear algebra) 8 ## DBchapter(Euclidean spaces) 9 ## DBsection(Basis and dimension) 10 ## Institution('Rochester') 11 ## TitleText1('Linear Algebra with Applications') 12 ## AuthorText1('Jeffrey Holt') 13 ## EditionText1('1') 14 ## Section1('4.2') 15 ## Problem1('') 16 17 DOCUMENT(); # This should be the first executable line in the problem. 18 19 loadMacros( 20 "PGstandard.pl", 21 "MathObjects.pl", 22 "PGmatrixmacros.pl", 23 "PGmorematrixmacros.pl" 24 ); 25 26 TEXT(beginproblem()); 27 $showPartialCorrectAnswers = 1; 28 29 $a = non_zero_random(-10,10,1); 30 $b = random(-10,10,1); 31 32 BEGIN_TEXT 33 34 Find a basis of the subspace of \({\mathbb R}^2\) spanned by the solution set of the equation \( $a x_1 + $b x_2 = 0\). 35 $BR 36 \{ mbox( ans_array(2,1,5), ', ', ans_array_extension(2,1,5), '.' ) \} 37 38 END_TEXT 39 40 41 ANS(basis_cmp([[-$b/$a, 1]])); 42 43 ENDDOCUMENT(); # This should be the last executable line in the problem. -----
In reply to Ian Delbridge

Re: PGmorematrixmacros Working? Or my error?

by Paul Pearson -
Hi Ian,

I updated the Rochester linear algebra problems and many of the TCNJ linear algebra problems to MathObjects about one year ago.  At that time, the MathObjects matrices were brand new, so I was hesitant to put them into the Open Problem Library (OPL) immediately.  I have now put these problems on my own personal github repository and submitted a pull request to the webwork master github repository.  When this pull request is approved and the updates are officially in the OPL, you should do a git pull request to get the latest version of everything.

In the meantime, you should be able to see my version of the pg problem you mentioned in my personal github repo:

https://github.com/paultpearson/webwork-open-problem-library/blob/master/OpenProblemLibrary/Rochester/setLinearAlgebra10Bases/ur_la_10_25.pg

I recommend only using the pg files from my personal github repository as templates on an as-needed, short-term basis.  (In other words, I would recommend only copying, pasting, and editing only one file at a time from my personal repo if necessary.  For dealing with a larger number of pg problems, it will be worth waiting for the pull request to be approved so that you can update the OPL all at once.) 

Best regards,

Paul Pearson
In reply to Paul Pearson

Re: PGmorematrixmacros Working? Or my error?

by Ian Delbridge -
Paul Pearson,

That's great! I hadn't realized that Math Objects Matrices were so new, or that you had updated the linear algebra problems. 

I'll try to adapt your usage of multi-answer to my problems. I don't think I'll have to check bases too much after this, so the quick fix will at least do for now. Thanks!

Still I wonder though what the problem is in using PGmorematrixmacros  in my problem. To quench my curiosity, and to help anyone who might visit this page having a similar problem to mine, if anyone knows the problem, please let me know!

Thanks again, Paul.

-Ian Delbridge 
In reply to Ian Delbridge

Re: PGmorematrixmacros Working? Or my error?

by John Jones -
Hi,

I have not looked at the code to be sure, but I think you are getting a conflict of matrix objects.  Webwork has its own matrix object which predate PGmorematrixmacros (so morematrixmacros may be trying to use them), and the Mathobject matrices came after that.

John