WeBWorK Main Forum

intergation of perl modules

intergation of perl modules

by Zak Zarychta -
Number of replies: 2
Is it possible to configure WeBWorK to integrate the perl math module into the distro in order to access some of the mathematical functions available ?

If so how would I go about it?

thanks,
Zak
In reply to Zak Zarychta

Re: intergation of perl modules

by Michael Gage -
This might be a little tricky since you would probably be importing the Math module inside the Safe.pm compartment where the PG problem is evaluated.
(The Safe compartment prevents the use of perl commands that might cause mayhem with the computer.  This includes disk access commands, commands like print, require, and "use" .... )

Which functions of the perl math module did you want to use?  Many of them may already be available in the pg language -- and if there are a few missing it might be possible to duplicate those.

Take care,

Mike
In reply to Michael Gage

Re: intergation of perl modules

by Zak Zarychta -
specifically the module Math::SigFig in which there are functions that compute sums, differences, products and ratios to an appropriate amount of significant figures dependent on the argument.

eg
0.1 + 2.22 = 2.3
1.54 / 1.5 = 1.0

The idea was to use these functions as a fudge then converting the output to a string in WeBWorK so that an exact comparison could be made

The background context are numerical questions and data processing in physics where it is not appropriate to include superfluous digits in a calculation.

For example, consider the area of a coin,
When asked to compute this many students keep all the precision of \pi from their calculator in their answer. This gives an answer to ~9 significant figures, suggesting that they measured the diameter to a similar precision, approximately an atomic width!?

Thanks for your reply and help with this,
Regards,
Zak