There are a lof of individual Maple calls, some of which may not be necessary. Each call will open a separate Maple kernel and use resources on the server. This can slow processing down especially if a large number of users is accessing at the same time. You can combine Maple commands into a single or small number of calls and use switch to retrieve them instead,
$call1=maple("command1; command2; command3, ...");
I believe the arrays can be created in T.A. without the use of Maple call, for example
$arr1=[11.2,3.4,11.22,8.2]; instead of $arr1=maple("[11.2,3.4,11.22,8.2]"); might work for your purposes.
There are some intermediary variables (py, pz, o) that are not otherwise used or plotted. Variables that are not directly used in grading or display can likely be cut as intermediary steps.
I'm not that familiar with multivariate statistics, but I hope this general advice is helpful.