Maple 18 includes new and expanded tools to connect to and work with external data sources and file formats. These include new support for connecting with Internet data sources, support for importing from and exporting to popular 3-D graphics formats, and working with compressed files.
Connecting to URL Data Sources
3-D Graphics Import/Export
Import and Export of Tabular and Spreadsheet Data
Compressed File Support
Export of Graphs to LaTeX
The new URL package offers efficient tools for connecting to remote data sources using the HTTP, HTTP Secure (HTTPS), and FTP transfer protocols. For HTTP and Secure HTTP, both GET and POST operations are supported.
sitecontent ≔ URL:-Get http://www.maplesoft.com :
<h2>Object moved to <a href="https://www.maplesoft.com/">here</a>.</h2>
As well, support for URLs has now been extended in many other places in Maple where filenames were previously supported, simplifying the steps necessary to connect to this data using Maple.
fingerprint ≔ ImageTools:-Readhttp://www.maplesoft.com/data/examples/jpg/fingerprint.jpg
The updated plottools package offers new tools and functionality for generating, importing, exporting 3-D graphic models in a variety of formats.
Importing and Exporting 3-D models
The new importplot and exportplot commands permit the exchange of 3-D geometric data between a variety of formats and Maple plots. After import, a geometric object can then be combined with other visualizations in Maple using existing tools such as plots[display]. The following new data formats are supported for both import and export:
BYU - Movie.BYU geometry
PLY - Stanford triangle format (ASCII & binary)
JVX - JavaView geometry
STL - Stereolithography file format (ASCII & binary)
OBJ - Wavefront file format
VTK - Visualization ToolKit file format
OFF - Object File Format
In addition to importing from a local file, importplot also allows the user to import directly from a URL.
The following examples illustrate imports from PLY and STL file formats.
The following examples illustrate exporting Maple 3-D objects to BYU and OFF formats, then importing them back.
surface≔ plot3d sinx+x*cosy, x=−5..5, y=−5..5,color=purple:
KnotFile ≔cat FileTools:-TemporaryDirectory, /MyKnot.byu:
SaddleFile ≔cat FileTools:-TemporaryDirectory, /saddle.obj:
The improved ImportMatrix and ExportMatrix commands enable tabular and spreadsheet data in a variety of formats to be imported to and exported from Maple matrices. The following new data formats are supported for both import and export:
DIF - Data Interchange Format
ODS - OpenDocument Spreadsheet
SXC - Sun XML Calc spreadsheet
These commands also now handle Excel spreadsheet files using the previously existing ExcelTools package. As a result, in total, they now support four additional formats. In addition to importing from a local file, ImportMatrix also supports importing data directly from a URL.
csvFile ≔ catkerneloptsdatadir,/example/timedata.csv:
csvData ≔ ImportMatrixcsvFile
csvData â‰” Mar 06 01:16 3/7/200526.860912411.414301472⁢1071.505894402⁢1070.0648Mar 06 20:12 3/7/200525.756241812.358229695⁢1072.497614407⁢1070.0591Mar 06 20:43 3/7/200525.127064283.029212316⁢1073.314477184⁢1070.0942Mar 07 00:25 3/7/200525.122490952.496855419⁢1072.656019993⁢1070.0637Mar 07 00:44 3/7/200522.759192762.722498752⁢1072.818590004⁢1070.0353Mar 07 00:59 3/7/200522.206311129.859010832⁢1071.029975998⁢1070.0447Mar 08 00:15 3/8/200522.114772988.333640321⁢1078.579230226⁢1070.0295Mar 08 00:16 3/8/200521.412271131.174272859⁢1071.217998806⁢1070.0372Mar 08 00:16 3/8/200521.332533154.950350549⁢1065.239008009⁢1070.0583Mar 08 00:16 3/8/200520.627523091.765508208⁢1071.870092003⁢1070.0592`:``:``:``:``:`28 Ã— 6 Matrix
MapleTimeline ≔ http://www.maplesoft.com/data/examples/dif/maple-timeline.dif.gz:
timelineData ≔ ImportMatrixMapleTimeline
timelineData â‰” 1990Maple V1992Maple V R21994Maple V R31996Maple V R41997Maple V R51999Maple 62001Maple 72002Maple 82003Maple 92004Maple 9.5`:`19 Ã— 2 Array
Imported Excel Data
Imported DIF Data
Maple 18 supports both zip and gzip file formats.
The gzip format allows lossless compression of data in a single file. Your large matrix can be written to a file using this format, thus taking up less room on disk compared to an ordinary uncompressed data file.
The zip format allows lossless compression of organized collection of data and resources in a single file. Think of it as a collection of files zipped together in a single archive. By splitting the data into a directory structure within the zip file, the data is better organized for easy extraction.
To use the short form of command names, we'll load the package:
Reading Zip Files
Now, let's point to a sample zip file and look to see what is included inside it:
zipfile ≔ FileTools:-JoinPath kerneloptsmapledir, data, help, FileTools, sample.zip:
There are three files, we will read each of them in.
The first file is stored with the suffix ".m", so it is immediately restored as a Maple object when read into Maple.
data ≔ ReadFiledata.m in zipfile;
data â‰” 22.214.171.124.126.96.36.199.188.8.131.52.184.108.40.206.220.127.116.11.`:`50 Ã— 2 Array
The second file is plain text. In this case we additionally use the parse command to turn the plain text into equations.
opts ≔ parseReadFileoptions.txt in zipfile,string;
opts â‰” axes=none,view=−600..300,−800..100
The third file is an image. We will extract it into a temporary directory.
imagefile ≔ catFileToolsTemporaryDirectory, /myantennas.jpg:
Extractantennas.jpg in zipfile, imagefile;
Now, let's plot the data, image, and options we just read in.
plotspolygonplot data, background=imagefile, opts;
Creating and Writing to Zip Files
This short section will show how the sample zip file was created.
Start with naming the container zip file -- "myzip.zip". Individual files within the zip will be specified using in to separate the container name with the in-zip name. The data is already defined in the previous section, we'll write it out to a sub-file with a .m extension.
newzipfile ≔ myzip.zip:
WriteFile data.m in newzipfile, data ;
Here the options are written as plain text.
WriteFile options.txt in newzipfile, axes=none, view=[-600..300,-800..100];
The image is taken from the data directory on disk and put directly into the zip archive.
ReadWriteFile antennas.jpg in newzipfile, catkerneloptsmapledir,/data/images/antennas.jpg;
We are done. Let's look to see what is inside our new zip file.
This new zip file that we created can be read by standard tools like WinZip and pkzip. Similarly, files created using these tools can be opened and read by Maple.
The new GraphTheory[Latex]
command generates LaTeX code for displaying a graph using the LaTeX picture environment. It handles directed and undirected graphs in both black and white and color. The vertex labels are placed beside the vertices in the LaTeX picture.
We create an undirected unweighted soccer ball graph.
S â‰” Graph 1: an undirected unweighted graph with 60 vertices and 90 edge(s)
Here we export the soccer ball graph S to a compilable LaTeX file.
Finally, we compile "soccer.tex" and we obtain a LaTeX output document containing a picture as shown below:
Index of New Commands and Packages
What's New in GraphTheory
Download Help Document
What kind of issue would you like to report? (Optional)