[LON-CAPA-users] Imaginary Numbers

Stuart Raeburn raeburn at msu.edu
Wed Feb 17 16:15:29 EST 2016


LON-CAPA loads a modified version of the Math::Complex perl module  
into perl safe space (named LONCAPA::LCMathComplex), so the following  
could be used in a perl script block in a resource in LON-CAPA.

$z1 = &cplx($a, $b);
$z2 = &cplx($c, $d);
$product = $z1 * $z2;
$e = &Re($product);
$f = &Im($product);

If you want to override perl's standard sqrt() function with one that  
handles imaginary numbers, you can do so, e.g.,

$g = &LONCAPA::LCMathComplex::sqrt(-1);


Stuart Raeburn
LON-CAPA Academic Consortium

Quoting "Harding, Gene L" <glhardin at purdue.edu>:

> Hi,
> Can LON-CAPA handle imaginary and complex numbers?  I am having   
> trouble finding any info about it in the help.
> Thanks,
> Gene L. Harding, PE
> Associate Professor of ECET
> 574-520-4190

More information about the LON-CAPA-users mailing list