[LON-CAPA-cvs] cvs: loncom /homework capa.units default_homework.lcpm /html/adm/help/tex Physical_Units.tex

www lon-capa-cvs-allow@mail.lon-capa.org
Thu, 06 Mar 2008 01:54:19 -0000


www		Wed Mar  5 20:54:19 2008 EDT

  Modified files:              
    /loncom/homework	capa.units default_homework.lcpm 
    /loncom/html/adm/help/tex	Physical_Units.tex 
  Log:
  Bug #1677: cc as unit (and a few others that people apparently wanted)
  
  
Index: loncom/homework/capa.units
diff -u loncom/homework/capa.units:1.15 loncom/homework/capa.units:1.16
--- loncom/homework/capa.units:1.15	Mon Nov 20 15:38:59 2006
+++ loncom/homework/capa.units	Wed Mar  5 20:54:16 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Physical Unit definitions
 #
-# $Id: capa.units,v 1.15 2006/11/20 20:38:59 albertel Exp $
+# $Id: capa.units,v 1.16 2008/03/06 01:54:16 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -135,4 +135,11 @@
 molarity        M      mol/L         # chemisty
 amu             amu    1.66053873e-27 kg # atomic mass unit
 amu             u      1.66053873e-27 kg # atomic mass unit
-
+lightspeed      c      299792458 m/s     # speed of light
+cubiccentimeter cc     cm^3              # cubic centimeter
+electroncharge  e      1.6021892E-19 C   # elementary charge
+hbar            hbar   1.05457148E-34 m^2*kg/s # Planck constant
+milesperhour    mph    0.44704 m/s   # miles per hour
+rpm             rpm    0.0166666667/s  # rounds per minute
+rpm             rpms   0.0166666667/s  # rounds per minute
+parsec          pc     3.08568025E16 m   # parsec
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.129 loncom/homework/default_homework.lcpm:1.130
--- loncom/homework/default_homework.lcpm:1.129	Wed Mar  5 13:24:07 2008
+++ loncom/homework/default_homework.lcpm	Wed Mar  5 20:54:16 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
 #
-# $Id: default_homework.lcpm,v 1.129 2008/03/05 18:24:07 www Exp $
+# $Id: default_homework.lcpm,v 1.130 2008/03/06 01:54:16 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -157,7 +157,7 @@
 
     #&LONCAPA_INTERNAL_DEBUG(" type is $type ");
     if ($type eq 'cs' || $type eq 'ci') {
-	#for string answers make surec all places spaces occur, there is 
+	#for string answers make sure all places spaces occur, there is 
         #really only 1 space, in both the answer and the response
 	$answer=~s/ +/ /g;
 	$response=~s/ +/ /g;
@@ -311,7 +311,7 @@
     if ($type eq '' || $type eq 'float') {
 	#for numerical problems split off the unit
 #	if ( $responses->[0][-1]=~ /(.*[^\s])\s+([^\s]+)/ ) {
-        if ( $responses->[0][-1]=~ /^([\d\.\,\s\$]*(?:(?:[xX\*]10[\^\*]*|[eE]*)[\+\-]*\d*)*(?:^|\S)\d)([\w\s][\$\s\w\^\*\/\(\)\+\-]*\D[\$\s\w\^\*\/\(\)\+\-]*)$/ ) {
+        if ( $responses->[0][-1]=~ /^([\d\.\,\s\$]*(?:(?:[xX\*]10[\^\*]*|[eE]*)[\+\-]*\d*)*(?:^|\S)\d+)([\$\s\w\^\*\/\(\)\+\-]*\D[\$\s\w\^\*\/\(\)\+\-]*)$/ ) {
 	    $responses->[0][-1]=$1;
 	    $unit=&capa_formula_fix($2);
             &LONCAPA_INTERNAL_DEBUG("Found unit :$unit:");
Index: loncom/html/adm/help/tex/Physical_Units.tex
diff -u loncom/html/adm/help/tex/Physical_Units.tex:1.5 loncom/html/adm/help/tex/Physical_Units.tex:1.6
--- loncom/html/adm/help/tex/Physical_Units.tex:1.5	Mon Nov 20 15:38:08 2006
+++ loncom/html/adm/help/tex/Physical_Units.tex	Wed Mar  5 20:54:18 2008
@@ -124,6 +124,14 @@
 molarity        M      # chemisty
 amu             amu    # atomic mass unit
 amu             u      # atomic mass unit
+lightspeed      c      # speed of light
+cubiccentimeter cc     # cubic centimeter
+electroncharge  e      # elementary charge
+hbar            hbar   # Planck constant
+milesperhour    mph    # miles per hour
+rpm             rpm    # rounds per minute
+rpm             rpms   # rounds per minute
+parsec          pc     # parsec
 \end{verbatim}
 \subsection*{Interpretation}
 The coded units are interpreted in the order of basic unit,