WeBWorK Main Forum

Undefined subroutine &Math::Complex::cplx

Undefined subroutine &Math::Complex::cplx

by Andras Balogh -
Number of replies: 0
I am trying to use R to calculate eigenvalues (possibly for matrices of sizes 5x5 or 6x6 as computational exercise).

It works fine for a 3x3 matrix with real eigenvalues:
rserve_eval("eigsys=eigen(matrix(c(7,2,-4,4,5,-4,14,10,-11),nrow=3,ncol=3))");

But not for a 3x3 matrix with complex eigenvalues:
rserve_eval("eigsys=eigen(matrix(c(-1,-1,6, -7,8,8, 3,-5,4),nrow=3,ncol=3))");

I get the error message
Undefined subroutine &Math::Complex::cplx called at /usr/local/share/perl5/Statistics/R/IO/QapEncoding.pm line 323

The required perl module seems to be installed:
perl -MCPAN -e "install Math::Complex"
CPAN: Storable loaded ok (v2.51)
Reading '/root/.cpan/Metadata'
Database was generated on Mon, 13 Nov 2017 22:17:02 GMT
CPAN: Module::CoreList loaded ok (v5.20151220)
Math::Complex is up to date (1.59).

and I loaded a bunch of macros already:
loadMacros(
"PG.pl",
"PGstandard.pl",
"PGmatrixmacros.pl",
"PGmorematrixmacros.pl",
"PGcourse.pl",
"PGauxiliaryFunctions.pl",
"RserveClient.pl",
"MathObjects.pl",
"PGcomplexmacros.pl",
"PGcomplexmacros2.pl",
"PGnumericalmacros.pl",
"contextComplexExtras.pl"
);

What am I missing?