[LON-CAPA-cvs] cvs: loncom /html/adm/help/tex Script_Functions.tex
raeburn
raeburn at source.lon-capa.org
Wed Jul 29 07:31:02 EDT 2020
raeburn Wed Jul 29 11:31:02 2020 EDT
Modified files:
/loncom/html/adm/help/tex Script_Functions.tex
Log:
- Documentation for syntax for complex numbers (LONCAPA::LCMathComplex).
Index: loncom/html/adm/help/tex/Script_Functions.tex
diff -u loncom/html/adm/help/tex/Script_Functions.tex:1.15 loncom/html/adm/help/tex/Script_Functions.tex:1.16
--- loncom/html/adm/help/tex/Script_Functions.tex:1.15 Sun Sep 15 22:42:05 2013
+++ loncom/html/adm/help/tex/Script_Functions.tex Wed Jul 29 11:31:02 2020
@@ -77,5 +77,42 @@
\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.
More information about the LON-CAPA-cvs
mailing list