[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm /html/adm/help/tex Problem_LON-CAPA_Functions.tex all_functions_table.tex

raeburn raeburn at source.lon-capa.org
Wed Sep 12 18:00:31 EDT 2018


raeburn		Wed Sep 12 22:00:31 2018 EDT

  Modified files:              
    /loncom/html/adm/help/tex	Problem_LON-CAPA_Functions.tex 
                             	all_functions_table.tex 
    /loncom/homework	default_homework.lcpm 
  Log:
  - Bug 6873
    Shorter name for function: &conv_eng_format(). Add documentation
  
  
Index: loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex
diff -u loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.34 loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.35
--- loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.34	Wed Jun  6 18:40:08 2018
+++ loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex	Wed Sep 12 22:00:19 2018
@@ -50,6 +50,10 @@
 
 \$expr=\&math_calculus_expression() & Creates Math::Calculus::Expression object.  Methods are: \$expr->addVariable('x'), \$expr->setExpression('f(x)'), \$expr->simplify, \$expr->getExpression -- see Math::Calculus::Expression documentation at cpan.org for details.\\
 \hline
+
+(\$a,\$u)=\&conv_eng_format(\$x,\$b) & Converts numerical value \$x and base unit \$b to answer \$a and corresponding unit \$u in engineering format, i.e.,
+the answer is scaled by powers of ten, and an appropriate prefix from: m u n p f a z y k M G T P E Z Y precedes the base unit. Called in a script block to generate variables to assign to answer and unit attributes of numericalresponse tag. \\
+\hline
  
 \&prettyprint(\$x,'nn','optional target') & Note that that tag $<$num$>$ can be used to do the same thing. Display or format \$x as nn where nn is nF or nE or nS and n is an integer. Also supports the first character being a \$, it then will format the result with a a call to \&dollarformat() described below. If the first character is a , it will format it with commas grouping the thousands. In S mode it will fromat the number to the specified number of significant figures and display it in F mode. In E mode it will attempt to generate a pretty x10\^{}3 rather than a E3 following the number, the 'optional target' argument is optional but can be used to force \&prettyprint to generate either 'tex' output, or 'web' output, most people do not need to specify this argument and can leave it blank.\\
 \hline
Index: loncom/html/adm/help/tex/all_functions_table.tex
diff -u loncom/html/adm/help/tex/all_functions_table.tex:1.17 loncom/html/adm/help/tex/all_functions_table.tex:1.18
--- loncom/html/adm/help/tex/all_functions_table.tex:1.17	Wed Jun  6 18:40:08 2018
+++ loncom/html/adm/help/tex/all_functions_table.tex	Wed Sep 12 22:00:19 2018
@@ -35,7 +35,11 @@
 asinh(x), acosh(x), atanh(x) &\&asinh(\$x), \&acosh(\$x), \&atanh(\$x) &Inverse hyperbolic functions. \$x can be a pure number &  \\
  \hline 
 /DIS(\$x,''nn'') &\&format(\$x,'nn') &Display or format \$x as nn where nn is nF or nE or nS and n is an integer. & The difference is obvious. \\
- \hline 
+ \hline
+Not in CAPA &\$expr=\&math_calculus_expression() & Creates Math::Calculus::Expression object.  Methods are: \$expr->addVariable('x'), \$expr->setExpression('f(x)'), \$expr->simplify, \$expr->getExpression -- see Math::Calculus::Expression documentation at cpan.org for details. & \\
+ \hline
+Not in CAPA &(\$a,\$u)=\&conv_eng_format(\$x,\$b) & Converts numerical value \$x and base unit \$b to answer \$a and corresponding unit \$u in engineering format, i.e., the answer is scaled by powers of ten, and an appropriate prefix from: m u n p f a z y k M G T P E Z Y precedes the base unit. Called in a script block to generate variables to assign to answer and unit attributes of numericalresponse tag. & \\
+ \hline
 Not in CAPA &\&prettyprint(\$x,'nn','optional target') &Display or format \$x as nn where nn is nF or nE or nS and n is an integer. Also supports the first character being a \$, it then will format the result with a a call to \&dollarformat() described below. If the first character is a , it will format it with commas grouping the thousands. In S mode it will fromat the number to the specified number of significant figures and display it in F mode. In E mode it will attempt to generate a pretty x10\^{}3 rather than a E3 following the number, the 'optional target' argument is optional but can be used to force \&prettyprint to generate either 'tex' output, or 'web' output, most people do not need to specify this argument and can leave it blank. &  \\
  \hline 
 Not in CAPA &\&dollarformat(\$x,'optional target') &Reformats \$x to have a \$ (or $\backslash$\$ if in tex mode) and to have , grouping thousands. The 'optional target' argument is optional but can be used to force \&prettyprint to generate either 'tex' output, or 'web' output, most people do not need to specify this argument and can leave it blank. &  \\
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.174 loncom/homework/default_homework.lcpm:1.175
--- loncom/homework/default_homework.lcpm:1.174	Wed Sep 12 21:10:44 2018
+++ loncom/homework/default_homework.lcpm	Wed Sep 12 22:00:31 2018
@@ -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.174 2018/09/12 21:10:44 raeburn Exp $
+# $Id: default_homework.lcpm,v 1.175 2018/09/12 22:00:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -976,7 +976,7 @@
     return &xmlparse($formula);
 }
 
-sub convert_engineer_format {
+sub conv_eng_format {
     my ($ans,$baseunit)=@_;
     my ($value,$answer,$unit);
     $baseunit =~ s{[^\w/\-\.]}{}g; 




More information about the LON-CAPA-cvs mailing list