Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Maple code for solving system of ODE using forward-backward sweep method.

While working a test workbook in Maple 2023 - added a file went away for a while and came back and started adding code to the workbook when I suppose it did an autosave and this error came up 4x in a row. 

How can I work with a LogNormal distribution represented by a mean and standard deviation?
I see that is with exp(Normal(mu,sigma)), but I dont sure. Would you please help me with a example using LN(mean=20,standard deviation=5)?
I will use in PDF, CDF and RandomVariable. 

For a table

T := table(sparse = {}, [1 = {a}, 2 = {b}])

T[3] returns {}. 

Is there an equivalent for an rtable?


T := table(sparse = {}, [1 = {a}, 2 = {b}])

table( [( 1 ) = {a}, ( 2 ) = {b} ] )

T[1]; T[2]



Get the default value here



But (as documented), the sparseness of the table is not inherited - all elements are filled

Vector[row](6, T, storage = sparse); op(%)

Vector[row](%id = 36893490697130506636)

6, {1 = {a}, 2 = {b}, 3 = {}, 4 = {}, 5 = {}, 6 = {}}, datatype = anything, storage = sparse, order = Fortran_order, shape = []

fill = {} should fill in all unspecified values. but this is incompatible with storage = sparse (as documented).

Vector[row](6, {1 = T[1], 2 = T[2]}, storage = sparse, fill = {}); op(%)

Vector[row](%id = 36893490697130478916)

6, {1 = {a}, 2 = {b}}, datatype = anything, storage = sparse, order = Fortran_order, shape = []

And the default fill is still zero for datatype=set; I expected {} here.

Vector[row](6, {1 = T[1], 2 = T[2]}, storage = sparse, datatype = set); op(%)

Vector[row](%id = 36893490697130474412)

6, {1 = {a}, 2 = {b}}, datatype = set, storage = sparse, order = Fortran_order, attributes = [_fill = 0], shape = []




I am stuck on how to graphically represent my two G and S shapes. Any suggestions to help me illustrate this concept of a ruled surface?

Thank you

I expect that there must exist a Maple proc that does the equivalent of the following but I couldn't find it.  Can it be in the combinat package?

And if there isn't one, can the following be improved?  It seems to be horribly inefficient to me, although efficiency is not a major concern for me right now since I need it only for small values of n.


Proc produces all lists of length n consisting of the

two distinct symbols a and b.

doit := proc(a, b, n::posint)
        local p := 1, L := [ [a], [b] ];
        for p from 1 to n-1 do
                 L := [ map( x -> [a,op(x)], L)[], map( x -> [b,op(x)], L)[] ];
        end do:
        return L;
end proc:


[[a], [b]]


[[p, p, p], [p, p, q], [p, q, p], [p, q, q], [q, p, p], [q, p, q], [q, q, p], [q, q, q]]


[[5, 5, 5], [5, 5, 7], [5, 7, 5], [5, 7, 7], [7, 5, 5], [7, 5, 7], [7, 7, 5], [7, 7, 7]]



The recent Maple 2023 release comes with a multitude of new features, including a new Canvas Scripting Gallery full of templates for creating interactive Maple Learn documents.

The Maple Learn Scripting Gallery can be accessed through Maple, by searching “BuildInteractiveContent Maple2023” in the search bar at the top of the application and clicking on the only result that appears. This will bring you to the help page titled “Build and Share Interactive Content”, which can also be found by searching “scripting gallery” in the search bar of a Maple help page window. The link to the Maple Learn Scripting Gallery is found under the “Canvas Scripting” section on this help page and clicking on it will open a Maple workbook full of examples and templates for you to explore.

The interactive content in the Scripting Gallery is organized into five main categories – Graphing, Visualization, Quiz, Add-ons and Options, and Applications Optimized for Maple Learn – each with its own sub-categories, templates, and examples.

One of the example scripts that I find particularly interesting is the “Normal Distribution” script, under the Visualizations category.



All of the code for each of the examples and templates in the gallery is provided, so we can see exactly how the Normal Distribution script creates a Maple Learn canvas. It displays a list of grades, a plot for the grade distribution to later appear on, math groups for the data’s mean and variance, and finally a “Calculate” button that runs a function called UpdateStats.

The initial grades loaded into the document result in the below plot, created using Maple’s DensityPlot and Histogram functions, from the Statistics package. 


The UpdateStats function takes the data provided in the list of grades and uses a helper function, getDist, to generate the new plot to display the data, the distribution, the mean, and the variance. Then, the function uses a Script object to update the Maple Learn canvas with the new plot and information.

The rest of the code is contained in the getDist function, which uses a variety of functions from Maple’s Statistics package. The Normal Distribution script takes advantage of Maple’s ability to easily calculate mean and variance for data sets, and to use that information to create different types of random variable distributions.

Using the “Interactive Visualization” template, provided in the gallery, many more interactive documents can be created, like this Polyhedra Visualization and this Damped Harmonic Oscillator – both from the Scripted Gallery or like my own Linear Regression: Method of Least Squares document.


Another new feature of Maple 2023 is the Quiz Builder, also featured in the Scripting Gallery. Quizzes created using Quiz Builder can be displayed in Maple or launched as Maple Learn quizzes, and the process for creating such a quiz is short.

The QuizBuilder template also provides access to many structured examples, available from a dropdown list:

As an example, check out this Maple Learn quiz on Expected Value: Continuous Practice. Here is what the quiz looks like when generated in Maple: