File:  [LON-CAPA] / loncom / html / adm / help / tex / Script_Functions.tex
Revision 1.17: download - view: text, annotated - select for diffs
Sat Mar 27 20:43:09 2021 UTC (3 years, 4 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, version_2_11_5_msu, version_2_11_5, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, HEAD
- Remove unwanted ampersand so PDF version of Authoring Manual can be built.

    1: \label{Script_Functions}
    2: 
    3: 
    4: This is a list of functions that have been written that are available in the
    5: Safe space scripting environment inside a problem: 
    6: 
    7: \begin{itemize}
    8: \item sin(x), cos(x), tan(x) 
    9: \item asin(x), acos(x), atan(x), atan2(y,x) 
   10: \item log(x), log10(x) 
   11: \item exp(), pow(x,y), sqrt(x) 
   12: \item abs(x), sgn(x) 
   13: \item erf(x), erfc(x) 
   14: \item ceil(x), floor(x) 
   15: \item min(...), max(...) 
   16: \item factorial(n) 
   17: \item N\%M (modulo function)
   18: \item sinh(x), cosh(x), tanh(x) 
   19: \item asinh(x), acosh(x), atanh(x) 
   20: \item roundto(x,n)
   21: \item cas(s,e,l) 
   22: \item web({}``a'',''b'',''c'') or web(a,b,c) 
   23: \item html({}``a'') or html(a) 
   24: \item j0(x), j1(x), jn(n,x), jv(y,x) 
   25: \item y0(x), y1(x), yn(n,x), yv(y,x) 
   26: \item random 
   27: \item choose 
   28: \item tex({}``a'',''b'') or tex(a,b) 
   29: \item var\_in\_tex(a) 
   30: \item to\_string(x), to\_string(x,y) 
   31: \item class(), sec(), classid() 
   32: \item name(), firstname(), middlename(), lastname(), student\_number()
   33: \item check\_status(partid)
   34: \item open\_date(partid), due\_date(partid), answer\_date(partid) 
   35: \item open\_date\_epoch(partid), due\_date\_epoch(partid), answer\_date\_epoch(partid)
   36: \item submission(partid,responseid,version)
   37: \item currentpart()
   38: \item sub\_string() 
   39: \item array\_moments(array) 
   40: \item format(x,y),prettyprint(x,y,target),dollarformat(x,target) 
   41: \item languages
   42: \item map(...) 
   43: \item caparesponse\_check 
   44: \item caparesponse\_check\_list
   45: \item parameter\_setting(name,partid)
   46: \item EXT()
   47: \item stored\_data(name,partid)
   48: \item wrong\_bubbles(correct,lower,upper,step,@given)
   49: \end{itemize}
   50: 
   51: 
   52: We also support these functions from Math::Cephes 
   53: \begin{verbatim}
   54: 
   55:  bdtr:  Binomial distribution
   56:  bdtrc:  Complemented binomial distribution
   57:  bdtri:  Inverse binomial distribution
   58:  btdtr:  Beta distribution
   59:  chdtr:  Chi-square distribution
   60:  chdtrc:  Complemented Chi-square distribution
   61:  chdtri:  Inverse of complemented Chi-square distribution
   62:  fdtr:  F distribution
   63:  fdtrc:  Complemented F distribution
   64:  fdtri:  Inverse of complemented F distribution
   65:  gdtr:  Gamma distribution function
   66:  gdtrc:  Complemented gamma distribution function
   67:  nbdtr:  Negative binomial distribution
   68:  nbdtrc:  Complemented negative binomial distribution
   69:  nbdtri:  Functional inverse of negative binomial distribution
   70:  ndtr:  Normal distribution function
   71:  ndtri:  Inverse of Normal distribution function
   72:  pdtr:  Poisson distribution
   73:  pdtrc:  Complemented poisson distribution
   74:  pdtri:  Inverse Poisson distribution
   75:  stdtr:  Student's t distribution
   76:  stdtri:  Functional inverse of Student's t distribution
   77: 
   78: \end{verbatim}
   79: 
   80: See https://metacpan.org/pod/Math::Cephes for more information 
   81: 
   82: Support for complex numbers in the Safe space scripting environment is available via the  
   83: LONCAPA::LCMathComplex package, which is the standard Math::Complex module available from CPAN,
   84: modified to work in Safe space.
   85: 
   86: These functions from LONCAPA::LCMathComplex are available:
   87: 
   88: \begin{verbatim}
   89: Re($z)
   90: Im($z)
   91: arg($z)
   92: abs($z)
   93: \end{verbatim}
   94: 
   95: where \$z is a complex number created using the Cartesian form,
   96: where \$a and \$b are numbers in one of the following ways:
   97: 
   98: \begin{verbatim}
   99: $z = LONCAPA::LCMathComplex->make($a, $b);
  100: $z = cplx($a, $b);
  101: $z = $a + $b*i;
  102: \end{verbatim}
  103: 
  104: or created using the polar form, where \$m and \$n are numbers, in which the first 
  105: argument is the modulus, and the second is the angle in radians:
  106: 
  107: \begin{verbatim}
  108: $z = LONCAPA::LCMathComplex->emake($m, pi/$n);
  109: $z = cplxe($m, pi/$n);
  110: \end{verbatim}
  111: 
  112: Where there is no overlap with function names used for Math::Cephes functions, 
  113: then you can just use the LCMathComplex functions directly, e.g.. \&cplx(), \&Re(), \&Im(), 
  114: but where there is overlap, as is the case for tanh(), to ensure the function from LCMathComplex is called, 
  115: include the full namespace identifier, e.g., LONCAPA::LCMathComplex::tanh().
  116: 
  117: See: https://metacpan.org/pod/Math::Complex for more information.
  118: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>