--- loncom/html/adm/help/tex/Script_Functions.tex 2007/05/20 21:07:02 1.6 +++ loncom/html/adm/help/tex/Script_Functions.tex 2020/07/29 11:31:02 1.16 @@ -18,7 +18,7 @@ Safe space scripting environment inside \item sinh(x), cosh(x), tanh(x) \item asinh(x), acosh(x), atanh(x) \item roundto(x,n) -\item cas(s,e) +\item cas(s,e,l) \item web({}``a'',''b'',''c'') or web(a,b,c) \item html({}``a'') or html(a) \item j0(x), j1(x), jn(n,x), jv(y,x) @@ -28,16 +28,24 @@ Safe space scripting environment inside \item tex({}``a'',''b'') or tex(a,b) \item var\_in\_tex(a) \item to\_string(x), to\_string(x,y) -\item class(), sec() -\item name(), firstname(), lastname(), student\_number() +\item class(), sec(), classid() +\item name(), firstname(), middlename(), lastname(), student\_number() \item check\_status(partid) -\item open\_date(), due\_date(), answer\_date() +\item open\_date(partid), due\_date(partid), answer\_date(partid) +\item open\_date\_epoch(partid), due\_date\_epoch(partid), answer\_date\_epoch(partid) +\item submission(partid,responseid,version) +\item currentpart() \item sub\_string() \item array\_moments(array) \item format(x,y),prettyprint(x,y,target),dollarformat(x,target) +\item languages \item map(...) \item caparesponse\_check \item caparesponse\_check\_list +\item parameter\_setting(name,partid) +\item EXT() +\item stored\_data(name,partid) +\item wrong\_bubbles(correct,lower,upper,step,@given) \end{itemize} @@ -69,5 +77,42 @@ We also support these functions from Mat \end{verbatim} - Please see Math::Cephes for more information +See https://metacpan.org/pod/Math::Cephes for more information + +Support for complex numbers in the Safe space scripting environment is available via the +LONCAPA::LCMathComplex package, which is the standard Math::Complex module available from CPAN, +modified to work in Safe space. + +These functions from LONCAPA::LCMathComplex are available: + +\begin{verbatim} +Re($z) +Im($z) +arg($z) +abs($z) +\end{verbatim} + +where \$z is a complex number created using the Cartesian form, +where \$a and \$b are numbers in one of the following ways: + +\begin{verbatim} +$z = LONCAPA::LCMathComplex->make($a, $b); +$z = cplx($a, $b); +$z = $a + $b*i; +\end{verbatim} + +or created using the polar form, where \$m and \$n are numbers, in which the first +argument is the modulus, and the second is the angle in radians: + +\begin{verbatim} +$z = LONCAPA::LCMathComplex->emake($m, pi/$n); +$z = cplxe($m, pi/$n); +\end{verbatim} + +Where there is no overlap with function names used for Math::Cephes functions, +then you can just use the LCMathComplex functions directly, e.g.. \&cplx(), \&Re(), \&Im(), +but where there is overlap, as is the case for tanh(), to ensure the function from LCMathComplex is called, +include the full namespace identifier, e.g., &LONCAPA::LCMathComplex::tanh(). + +See: https://metacpan.org/pod/Math::Complex for more information.