lec8.mw
MCS 320 L-8 Friday 9 September 2005
1. Maple Input and Output
| > |
lprint(p); # same as convert to string |
| > |
printlevel := 5; # prints more information |
2. Exporting Plots
3. Reading and Writing Files
To save the polynomials and the solutions to file, we can use save
| > |
save p,sols,"H:\\data"; |
The file "data" on our H drive contains the p and sols as we would type it in in a Maple worksheet.
| > |
p := 'p'; sols := 'sols'; # clear p and sols |
With "writeto" and "appendto" we can write everything which appears on screen to a file. This is mainly useful for running procedures in batch and if we are running Maple in command line mode.
4. Importing and Exporting Data
| > |
m := matrix(4,3,(i,j) -> 1/(i+j-1)); |
To save this data in a format useful also to other programs, we can use the writedata.
| > |
data := map(evalf[20],m); # convert to 20 decimal places |
| > |
writedata(terminal,data,float); |
| > |
writedata("H:\\matrixdata",data,float); |
| > |
data := readdata("H:\\matrixdata",3); |
The result of the readdata is already stored as a variable of type listlist;
5. Low-Level I/O