CAPA Physics Problems

From WeBWorK_wiki
Jump to navigation Jump to search

Browsing the CAPA physics problem collection

Rochester has a collection of problems used in physics. These problems were originally CAPA problems and were converted some years ago, so the code isn't pretty, but for the most part they work.

The problems have been collected into a

physics "course"

so that you can browse through them and see what is already available.

Install and Set Up the CAPA Library

This step is optional. It installs and sets up the CAPA Library, which is a library of physics problems.

First we download the CAPA Library including required macros.

$ cd
$ cd downloads
$ svn co

Create a CAPA directory under /opt/webwork and move the CAPA macros there. Then move the CAPA graphics and library files to the required locations and set the group.

$ mkdir /opt/webwork/libraries/CAPA
$ cd rochester_physics_problib/macros/                   
$ mv CAPA_Tools /opt/webwork/libraries/CAPA/                       
$ mv CAPA_MCTools /opt/webwork/libraries/CAPA/                     
$ cd ..                                                                          
$ mv CAPA_Graphics /opt/webwork/webwork2/htdocs/
$ sudo chgrp -R wwdata /opt/webwork/webwork2/htdocs/CAPA_Graphics
  password: <wwadmin password>
$ sudo chmod -R g+w /opt/webwork/webwork2/htdocs/CAPA_Graphics        
$ cd ..                                                  
$ mv rochester_physics_problib /opt/webwork/libraries/

We need to edit global.conf again

$ cd /opt/webwork/webwork2/conf
$ gedit global.conf

Search for courseFiles{problibs} and scroll down several lines to the line

#      capaLibrary      => "CAPA",

Uncomment this line (i.e. remove the #) so it becomes

      capaLibrary      => "CAPA",

Next search for Locations of CAPA resources and, if necessary, edit the four following lines so that they read as follows (cut and paste is the best way to do this)

$pg{specialPGEnvironmentVars}{CAPA_Tools}             = "/opt/webwork/libraries/CAPA/CAPA_Tools/",        
$pg{specialPGEnvironmentVars}{CAPA_MCTools}           = "/opt/webwork/libraries/CAPA/CAPA_MCTools/",      
$pg{specialPGEnvironmentVars}{CAPA_GraphicsDirectory} = "$webworkDirs{htdocs}/CAPA_Graphics/",  
$pg{specialPGEnvironmentVars}{CAPA_Graphics_URL}      = "$webworkURLs{htdocs}/CAPA_Graphics/",  

Then save the file and quit. Note that we are setting up the CAPA macros and graphics so that they can be used by any WeBWorK course on the server.

There is one final step that is needed. We have to put a link in the templates directory of every course that needs access to the CAPA Library. If you want to have every course you create have access to the CAPA Library (unlikely unless you are in a physics department) put the link in the modelCourse

$ cd /opt/webwork/courses/modelCourse/templates/
$ ln -s /opt/webwork/libraries/rochester_physics_problib/ capaLibrary

More likely you just want to do this for individual courses. We don't have any yet. But for example after creating myTestCourse below, to set up access to the CAPA Library from myTestCourse, do the following

$ cd /opt/webwork/courses/myTestCourse/templates/
$ sudo ln -s /opt/webwork/libraries/rochester_physics_problib/ capaLibrary
password: <wwadmin password>

and do the analogous thing for every course that needs access to the CAPA Library. Then to gain access to the CAPA Library from the course, simply go to the Library Browser and click on the CAPA button.