The purpose is to be able to to offer a plain text file with data as a download for students who follow a statistical course.
The students have to learn how to use statistical software (SPSS) for analysing their data.
Because many, many maple commands simply do not work in Maple T.A. I cannot use straightforward commands like ExportMatrix or writedata etc.
Also the whole library URL and HTTP do not seem to work in the Maple T.A. environment.
Fortunately, after several month I found I could use the following code:
<a download="data.txt" href="data:text/plain;charset=utf-8,$datastring">click here for download data</a>
here the complete sourcecode:
algorithm=$datastring="1 2 3 4 5";@
question=<p><1></p><p> </p><p>$datastring</p><p><a download="data.txt" href="data:text/plain;charset=utf-8,$datastring">click here for download data</a></p>@
The problem I'm facing now is how to format $datastring as a tab delimited data file (with observations for a single observation unit on a single line):
This is what I have now in the algorithm section:
MultivariateNormalSample := proc (Sigma, V, N) local d;
d := LinearAlgebra:-Dimension(V);
LinearAlgebra:-LUDecomposition(Matrix(Sigma, datatype = float), 'method' = 'Cholesky') . ArrayTools:-Alias(Statistics:-Sample(Normal(0, 1), d*N), [d, N])+ArrayTools:-Replicate(Vector[column](V, datatype = float), 1, N) end proc:
S := MultivariateNormalSample(`<,>`(`<|>`(1, 2), `<|>`(2, 5)), `<,>`(2, 3), 100):
with gives as output:
K := "1,1,2,0,2,2,2,2,2,2,2,2,2,2,2,1,2,3,1,1,1,3,2,1,2,2,3,1,1,2,3,4,2,2,2,4,3,1,2,3,1,1,1,1,1,3,2,1,4,1,2,2,1,2,2,3,3,2,3,1,2,2,0,1,1,1,1,4,1,4,0,1,2,2,4,2,3,2,3,-1,3,1,1,3,3,1,1,2,1,4,1,3,2,2,2,4,1,1,4,3],[1,2,5,1,4,2,3,3,3,3,3,3,5,3,1,-1,3,4,3,0,2,5,5,0,4,3,4,1,4,2,4,7,3,3,5,8,4,0,2,3,0,2,2,3,1,5,3,1,6,2,3,4,1,4,3,5,5,2,4,4,4,3,-2,0,2,2,-1,4,1,8,-2,1,3,5,8,4,5,4,4,-1,3,1,1,5,4,1,2,5,-1,6,2,4,3,4,3,8,2,1,6,5]])"
I tried using StringTools SubstituteAll to get rid off the non digit characters ]], but SubstituteAll gives an error.
Another attempt was adding the following line:
but then I have to find a way to insert blanks and line feeds.
My purpose is to create an object $datastring as a text string including line feeds.
As many universities offer statistical courses using SPSS I believe my question is more than a personal matter.