Build and Share Interactive Content - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : System : Information : Updates : Maple 2022 : Build and Share Interactive Content

Build and Share Interactive Content

Maple 2022 provides additional tools for creating documents and interactive applications programmatically. These tools can be used to develop Maple Learn content or to create applications to be used in Maple.  Maple Learn is a new online environment designed specifically for teaching and learning mathematics.



Canvas Scripting

Help with Math Problems

Canvas-based Quizzes

Canvas Scripting

Maple 2022 greatly extends the tools for creating Canvas-based documents and interactive applications programmatically.

The Canvas package provides a framework for Maple users to easily build applications that can be used both in Maple and also shared on the web through Maple Learn.  These applications can gather user input and compute using standard Maple commands in either environment.

Canvas Package

The DocumentTools[Canvas] package builds on DocumentTools component primitives to provide a simple way to generate a grid layout of text and math.  It provides an easy mechanism to programmatically generate a page of math text and other elements.  New in Maple 2022 is the ability to add Sliders, 3-D Plots, Images, Hyperlinks, Line-Drawings, and many new options for controlling the display of math and text.

3-D Plot Example


cv := NewCanvas([
     Text("Volume of Revolution",fontsize=24),
     "This solid of revolution is created by rotating",
     f(x) = cos(x) + 1,
     Text("about the y=0 axis on the interval %1",(0 <= x) and (x <= 4*Pi)),
     Plot3D( "Student:-Calculus1:-VolumeOfRevolution(cos(x) + 1, x = 0 .. 4*Pi, output = plot, caption=``)"  )






















Image Example

In this example we embed an image in the canvas.    
Note: To execute this code you must be logged into the MapleCloud; see the Image command's help page for details.



cvNewCanvasSample Image&comma;Imagefile&colon;

























 The ShareCanvas command sends the canvas to Maple Learn and gives you a link to your document.


Interactive Example

In this example, we will define an application that allows user input and provides feedback.  The UpdateStats procedure will run when a button is pressed.  It will use the new GetElements command to extract specific pieces of the canvas, including an array of points as input to analyze, and named elements so they can be replaced with updated values.  





















To try this on the web using Maple Learn, execute:


On-Click Events

The Plot element has a new "onclick" option, and the Button element has a new "onmoved" option.  These can be used to react to events such as clicking on a plot or moving an image on a canvas.  There is also a new hidden State element, which can be used to record behind the scenes values that don't need to be visible in the canvas.

In this example the user is asked to click on a plot to add points.  When 2 or more points are set, the application will find a polynomial curve fit approximation and draw that on the plot too.


























Help with Math Problems

The new IntPractice and DiffPractice commands extend the algorithm behind SolveFeedback to handle integrals and derivatives.


IntPractice xsinx &DifferentialD;x
















This interactive example can also be shared via Maple Learn:

IntPractice xsinx &DifferentialD;x&comma; &apos;output&apos;&equals;&apos;link&apos;&colon;

Canvas-based Quizzes

The Quiz command now has an option to supply a solution.  The quiz question, verifier, new-problem generator and solution can return a canvas, which can be deployed to Maple Learn.


ShowCanvascv&comma; entrybox&equals;false&semi;