Next: Debugging Maple Programs Up: Programming in Maple Previous: Computing with Polynomials

Reading and Saving Procedures: read and save

You can write one or two line Maple programs interactively. But for larger programs you will want to save them in a file. Typically, one would use an editor to write the Maple program and save it into a file, then read the program into Maple before using it. A program can be read into Maple using the read command. For example, if we have written a Maple procedure MAX in the file MAX, in Maple we read this file into Maple by doing


read MAX;

You can save your Maple procedures or any formulae that you have computed in your Maple session in a file from inside Maple using the save statement, which has the form

save f1, f2, ..., filename;

This saves the values of the variables f1, f2, ... in text format in the file filename. You can also save Maple data in internal format or the so called ``.m'' format. This format is more compact and can be read faster by Maple. One simply appends ``.m'' to the filename as follows

save f1, f2, ..., `filename.m`;

This saves the values of f1, f2, ... in the file filename.m You can then read them back in to Maple using the read command:


read `filename.m`;


bondaren@thsun1.jinr.ru