Worksheet
WorksheetToJupyter
convert a worksheet into a Jupyter notebook
Calling Sequence
Parameters
Options
Description
Notes
Examples
Compatibility
WorksheetToJupyter( worksheet, opts )
worksheet
-
string or XML tree data structure
opts
(optional) options of the form outputfile = ~path
outputfile = string
Specifies a file path to which to write the generated Jupyter notebook. If omitted, no file is generated and a string encoding the generated notebook is returned.
WorksheetToJupyter(worksheet) converts a Maple worksheet in .mw format into a Jupyter notebook containing the equivalent input commands suitable for use with the Maple Kernel for Jupyter.
If the first argument worksheet is a string, it is treated as a filename. Otherwise, a worksheet as an XML tree data structure is expected.
If an output file is specified with option outputfile, the notebook is written to outputfile and the number of bytes written to the file is returned. Otherwise the output is a string which encodes the generated notebook.
This command only fully supports worksheets. It may not work properly for Maple documents with tables or components.
Output saved in the original worksheet is not translated to output in the Jupyter workbook. To see output in the Jupyter notebook, execute the notebook using the Maple Kernel for Jupyter.
with⁡Worksheet:
filename≔FileTools:-JoinPath⁡example,MatrixExample.mw,base=datadir
filename≔/maple/cbat/active/268316/data/example/MatrixExample.mw
WorksheetToJupyter⁡filename
{ "nbformat_minor": 4, "nbformat": 4, "metadata": { "language_info": { "name": "maple", "file_extension": ".mpl", "mimetype": "application/vnd.maple.mpl", "version": "2024" }, "kernelspec": { "display_name": "Maple 2024", "language": "maple", "name": "maple" } }, "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { }, "outputs": [ ], "source": [ "m := Matrix(2,2,[[-4, sqrt(17)], [ln(45), 61/4]])" ] }, { "cell_type": "code", "execution_count": null, "metadata": { }, "outputs": [ ], "source": [ "m[1,1]*m[2,2]-m[1,2]*m[2,1]" ] } ] }
E≔sqrt⁡xπ
E≔xπ
useDocumentTools,DocumentTools:-LayoutinW ≔ Worksheet⁡Group⁡Input⁡Textfield⁡Equation⁡E,executable=true,style=TwoDimInput,style=MapleInputend use
WorksheetToJupyter⁡W
{ "nbformat_minor": 4, "nbformat": 4, "metadata": { "language_info": { "name": "maple", "file_extension": ".mpl", "mimetype": "application/vnd.maple.mpl", "version": "2024" }, "kernelspec": { "display_name": "Maple 2024", "language": "maple", "name": "maple" } }, "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { }, "outputs": [ ], "source": [ "sqrt(x)/Pi" ] } ] }
The Worksheet:-WorksheetToJupyter command was introduced in Maple 2022.
For more information on Maple 2022 changes, see Updates in Maple 2022.
See Also
Export as Maple Text
Jupyter/package
Maple Kernel for Jupyter
XMLTools
Download Help Document