From: Nasser M. A. <nm...@12...> - 2024-01-06 21:28:15
|
Currently my script has matrix of data I want to process. So the matrix is inside the script itself. But I'd like to separate the matrix from the script, and just have the script read the matrix from a file, as I will have many different matrices to process. This is what I have now: ---- file.red----- load_package "algint"; off nat; % off echo; linelength 4000; COMMENT These are integration problems to solve; matrix A; A:=mat(( (x^6-x^5+x^4-x^3+1)*exp(x),x), ( (-x^2+2)*exp(x/(x^2+2))/(x^3+2*x),x ), ( (2*x^4-x^3+3*x^2+2*x+2)*exp(x/(x^2+2))/(x^3+2*x),x ), ( (1+exp(x))*exp(exp(x)+x)/(exp(x)+x),x ), ( exp(1+1/ln(x))*(-1+ln(x)^2)/ln(x)^2,x ), ( exp(x+1/ln(x))*(-1+(1+x)*ln(x)^2)/ln(x)^2,x ) )$ nrows := part(length(A),1)$ etc.., the rest of the script.. ------------------------- Which I run using redcsl < file.red WHat I'd like to do is put the matrix in its own file. say A.mat ------- A.mat--------------- matrix A; A:=mat(( (x^6-x^5+x^4-x^3+1)*exp(x),x), ( (-x^2+2)*exp(x/(x^2+2))/(x^3+2*x),x ), ( (2*x^4-x^3+3*x^2+2*x+2)*exp(x/(x^2+2))/(x^3+2*x),x ), ( (1+exp(x))*exp(exp(x)+x)/(exp(x)+x),x ), ( exp(1+1/ln(x))*(-1+ln(x)^2)/ln(x)^2,x ), ( exp(x+1/ln(x))*(-1+(1+x)*ln(x)^2)/ln(x)^2,x ) )$ -------------------------------- And read file.red read that file at the start. But I do not see a command to do this looking at the manual PDF file. The matrix will always be called variable A if this makes any difference and the input file can be A.mat or any other name. Is this possible to do in Reduce? I am using rev 6657 on Linux. In Maple, I just do read file.mpl And this reads any Maple expressions/variables in file.mpl Thanks --Nasser |