Hi Stuart, et al,

Thanks, that was very helpful.  After reviewing that web page last night, I was 
able to complete the calculation portion of a problem successfully.  

I am still having trouble with the response portion.  Is there a way to get 
"numericalresponse" to handle a complex number?  If not, is the technique 
Justin suggested using Maxima a good route?  Or is it best to just break the 
response into two "numericalresponses", one for the real part and one for the 
imaginary part?

Best regards,

Gene L. Harding, PE
Associate Professor of ECET
574-520-4190

-----Original Message-----
From: lon-capa-users-boun...@mail.lon-capa.org 
[mailto:lon-capa-users-boun...@mail.lon-capa.org] On Behalf Of Stuart Raeburn
Sent: Wednesday, February 17, 2016 4:15 PM
To: lon-capa-users@mail.lon-capa.org
Subject: Re: [LON-CAPA-users] Imaginary Numbers

Hi,

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.

$a=&random(1,5,1);
$b=&random(5,10,1);
$c=&random(10,15,1);
$d=&random(15,20,1);
$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);

See:
http://search.cpan.org/~jhi/Math-Complex-1.56/lib/Math/Complex.pm

Stuart Raeburn
LON-CAPA Academic Consortium


Quoting "Harding, Gene L" <glhar...@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

_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

Reply via email to