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 

> with(DocumentTools:-Canvas):
 

> 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=``)"  )
]):
 

> ShowCanvas(cv);
 

Embedded component

Embedded component
Embedded componentEmbedded component
Embedded component
Image

 

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. 

> with(DocumentTools:-Canvas); -1
 

> file := cat(kernelopts(datadir),
 

> cv := NewCanvas([
 

> ShowCanvas(cv);
 

Embedded component

Image

 

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

> ShareCanvas(cv);
 

https://learn.maplesoft.com/#/?d=OTCKBNLTJUKMAKLMCLFIDMBFMJLKJPDQCGJIOMPJCPIOAOFQHNNHERHGFUIRNOBNEKOMGSMTIGCNKHETLJOLPIITMGKFMUMTONNN 

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.   

Embedded component

> ShowCanvas(cv);
 

Embedded component

Image
Embedded component
Embedded componentEmbedded component
Image
Embedded componentEmbedded component
Embedded componentEmbedded component
Embedded component

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

> ShareCanvas(cv);
 

https://learn.maplesoft.com/#/?d=BNMSGTBOPRITAPETOFHTHSLKMKFQANDSKGBRBUOTCPNKDQJKAMOSNPHUHNIKEGHQDJCPEPCLFOMOPUIUNKPGCPMRDQHKNHMLCOBU 

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.
 

Embedded component

> ShowCanvas(cv, entrybox = false); 1
 

Embedded component

Image
Embedded component
Embedded componentEmbedded component

 

> ShareCanvas(cv);
 

https://learn.maplesoft.com/#/?d=JOESANAGLRBIJUFMNQPRKGBMGKPIEODNBGGSCSEGOINMOIMFOOMODLILPIASNREKAKERCTHSEPIOIRGUAQCTIKLSCMCTOIAUFOJP 

 

 

Help with Math Problems 

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

> with(Grading); -1
 

> IntPractice(Int(`*`(x, `*`(sin(x))), x));
 

Embedded component

Image
Embedded component
Embedded componentEmbedded component
Embedded componentEmbedded component
Embedded componentEmbedded component
Embedded componentEmbedded component
Embedded componentEmbedded component
Embedded componentEmbedded component
Embedded componentEmbedded component
Embedded componentEmbedded component
Embedded componentEmbedded component

ImageThis interactive example can also be shared via Maple Learn: 

IntPractice(Int(`*`(x, `*`(sin(x))), x), 'output' = 'link'); -1https://learn.maplesoft.com/#/?d=ITFOMGBOPTOMCGMGLPBNLLKPHFEJERLHLOAJBOGMGKNGHLBQPLDLNIKQPSELBIJNKPLHLQKGFSLFKTGJIPKQIPMRDGOLHPKTDKFG 

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. 

Embedded component

> with(DocumentTools:-Canvas); -1
 

> ShowCanvas(cv, entrybox = false); 1
 

Embedded component

Embedded componentEmbedded component Image
Image
Image
Embedded componentEmbedded component
Embedded component
Embedded componentEmbedded component
Embedded component
Embedded componentEmbedded component

ShareCanvas(cv); 1  

https://learn.maplesoft.com/#/?d=LOJKCGMHBIMFJHPGPFANCRFGLRDGLHGODFDMIHGNAPBHLNLRGJGUFUMMPRJQJNAFNJGRBPMKEGKUAUOKAOKRINEPNNPNCIFULMIF