Coding Tools - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Coding Tools


Maple 2023 features updates to tools for coding in Maple, such as the ability to open MPL files in Maple and an updated code editor.


Open MPL Files in Maple

Maple language files, which are typically saved with the file extension .mpl, can now be opened directly in Maple's standard interface using the File > Open menu.  

The file opens in a code editor window.  From that window, you can view, edit, execute, and save the file.  The window has many features of Maple's code editor, including syntax highlighting, syntax templates, command completion, line numbers, and automatic indenting.



When an MPL file is attached to a Maple workbook, double-clicking on the file in the workbook navigator now opens the file directly in Maple.


Code Edit Region Improvements

Code edit regions allow you to write Maple commands, functions, and procedures in a code editor, and then view them in your document with syntax highlighting to make your code more readable, or hide the code entirely if you don’t want the reader to be distracted by it.  They are particularly useful for sequences of commands, and definitions of functions, variables, and procedures that you wish to remain visible in the document rather than hidden in the start-up code, or if you want the many of the features available in Document mode but prefer to enter all your input using plain Maple syntax.
Maple 2023 includes many improvements that make it even easier to enter and run your Maple code in code edit regions:


Adding 1-D Math Expressions Using the Expressions Palette: While in the code edit region, selecting a 2-D expression from the Expression palette or the Calculus palette inserts the corresponding 1-D expression into the code edit region.


Adding Units Using the Units Palette: No need to remember additional syntax for including units in your calculations or your code. You can now insert units into the code edit region using the Units palette.


Units Hotkey in the Code Edit Region:  You can also choose to insert units in your calculations using the shortcut key combination, Ctrl + Shift + U (Command + Shift + U, on Mac). This inserts the general syntax for units. From here, you can choose to select the specific dimensionality and units of measure appropriate for your calculations.


Press Enter to execute code inside the Code Edit Region: Pressing the Enter key while in the code edit region executes the code and inserts a new code edit region after the output.

Shift + Enter (Shift + Return, for Mac) for a new line in a code edit region; Enter (Return, on Mac) to execute the code.


Find and replace in the Code Edit Region: The find and replace feature has been improved so that Maple will include the code edit region in the search, even if the code edit region is collapsed.


Python Language Support: You can now select Python as a language in a code edit region. The code will be executed using a Python 3 engine distributed with Maple and the state of the Python session can be queried and modified using the Python package.