Daniel Skoog

## 1751 Reputation

11 years, 343 days

## Either here or a SCR...

If you're looking for additional input, MaplePrimes is as good a place as any to start a discussion on modifying or expanding commands. Otherwise, you can send an "official" request to Maplesoft using the SCR form here: https://www.mapleprimes.com/scr/new

## Cuboid inside a pyramid...

We can do this in a couple of steps. First construct a cuboid:

plots:-display(plottools:-cuboid([0,0,0],[1,1,1],color="Black"),style=wireframe,axes=none);

Next we construct a pyramid. There was some code posted to MaplePrimes to make a pyramid procedure a while back, so modifying this slightly, we can construct a pyramid using the following procedure:

Pyramid := proc(Y::(list(list)))
local L, L1, n;
n:=numelems(Y);
L:=plottools:-polygon([seq(Y[i],  i=1..n-1)], style=line, color="Blue");
L1:=seq(plottools:-line(Y[i],Y[n], color="Blue"), i=1..n-1);
return plots:-display(L,L1);
end proc:

This procedure takes a list of lists as input, where the list contains the points that define the corners of the pyramid. In the following, I'll assume that it's a pyramid centered at (0,0) and extending to -1 and 1. The height of the pyramid is set to 10.

Pyramid([[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[0,0,10]]);

Finally, we can merge these two in one interactive exploration. To do so, we'll just need to remember some properties of similar triangles, namely that the side lengths of the similar triangles form a proportion. If we imagine flattening the cuboid inside the pyramid to 2D (a rectangle inside of a triangle), we see the following:

I'll assume that we know the height of the cuboid - we'll define it as h below (this is actually the parameter that we'll explore). What we need to find is the corresponding width, w, of the rectangle inside the triangle. Using the aforementioned property of similar triangles, we can compute this as:

ED/AE = CB/AC or ED = w = CB * AE / AC

Plugging in some values:

w = 1 * (10 - h) / 10

The `plottools:-cuboid` command requires two points that define the cuboid, so using [ (10-h)/10, (10-h)/10, 0 ] as the bottom corner, and similarly, [ -(10-h)/10, -(10-h)/10, h ] as the top corner, we get:

Explore( plots:-display(Pyramid([[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[0,0,10]]),
plots:-display(plottools:-cuboid([(10-h)/10,(10-h)/10,0],[-(10-h)/10,-(10-h)/10,h],color="Black"),style=wireframe),axes=none),
parameters=[[h=0..10]]);

Test this in the MapleCloud.

You can also generate this as an animation in Maple:

plots:-display(seq(plots:-display(Pyramid([[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[0,0,10]]),
plots:-display(plottools:-cuboid([(10-h)/10,(10-h)/10,0],[-(10-h)/10,-(10-h)/10,h],color="Black"),style=wireframe),axes=none), h=0..10),
insequence=true);

## Maple Training...

If you are looking for more individualized training, there is some on-site training available, though you would need to contact the sales representative in your region for more details, here's a link:https://www.maplesoft.com/contact/

The MaplePrimes website itself is a great training ground as well - if you have any specific questions regarding numerical analysis, you can also ask those directly on this site.

## MathContainer details...

There are several uses for a MathContainer Component. Primarily it is used for input of single mathematical expressions as well as for display. To answer your questions, I'll assume that you have a MathContainer in your document named "MathContainer0":

It can store only one algebraic expression at a time?

Can it handle list of algebraic expressions?

The answer for this question depends on what you want to do with it. Technically, it can store more than one expression, but in most frequently, it usually contains only one parseable statement. A math container shouldn't be used as an alternative to a code edit region - if you want to code or to enter in multiline procedures, the code edit region is a better choice. If you want to use it to get input from a user, say a number value, a mathematical expression, or a list of such expressions, then that's a valid use case.

The DocumentTools:-GetProperty and DocumentTools:-SetProperty commands can help to make the use cases a little more clear. Say you have a math container and you type in 1, 2, 3. Doing:

DocumentTools:-GetProperty("MathContainer0",expression);

Will return:

1,2,3

However, you cannot set the property of a math container to be an expression sequence. SetProperty only allows you to send one expression to the math container.

DocumentTools:-SetProperty("MathContainer0",expression,x^2/sqrt(x));
DocumentTools:-SetProperty("MathContainer0",expression,[1,2,3]);

Can it store list data points (x,y) for a list of curves?

A math container can store a list of (x,y) points and in addition can even store a matrix of (x,y) points. Entering a matrix into a math container is a bit tricky - you'll need to copy and paste a matrix into the component for it to display as a matrix. Using a math container as a display for matrices is a much more frequent use case (in fact, something I use a lot). Here's an example of using a math container for displaying a matrix.

M:=Statistics:-Sample(Normal(0,1),[10,2]):
DocumentTools:-SetProperty("MathContainer0",value,M);

Can there be any use for click to edit this component?

There is no "click" functionality for math containers. Plot components have a notion of being able to register clicks and drags, and text areas have an action when changed. Math containers don't currently support either.

Hope this helps.

## DocumentTools:-SetProperty...

At this time, the only way to make an invisible component visible again is to use the DocumentTools:-SetProperty command. Note that for this to work, you will need to know the name of the component whose state you wish to change. For example, assuming that the name of your text area component is TextArea0:

`DocumentTools:-SetProperty("TextArea0",visible,true);`

## Plot annotations...

It sounds like plots:-textplot is probably what you were after, but just in case you wanted to have the labels appear and disappear when you cursor over the points or line, you could try using a plot annotation.

If you're using Maple 2017, you can add annotations with the 'annotation' option.

curve := y^2 = x^3 - 43*x + 166:
plots:-display([
plot(+sqrt(rhs(curve)),x = -10..12,annotation=curve),
plot(-sqrt(rhs(curve)),x = -10..12,annotation=curve),
plots:-pointplot([[3,8],[-5,16],[11,32],[3,-8]],symbol = solidbox,annotation=Array(["P=4P+4P=8P", "P*P", "2P+2P=4P", "4P*4P"]))
]);

## Classic Maple...

https://www.maplesoft.com/support/faqs/detail.aspx?sid=32659

## Bug reported...

Thanks for this report. I've filed a SCR.

## 10.13?...

Are you running the Mac OS X 10.13 beta? If so, are you running the most up to date version of it? Early versions of the 10.13 beta had issues with Maple and several other programs.

## Probably a bug (or oversight)...

This is probably a bug or an oversight. I'll file a ticket to fix this up, in the meantime, make sure to close the code edit window before you exit Maple ;)

## Try again...

This may be related to some changes that our web team has been making while upgrading most of our sites to https. Try logging in again now and let us know if you are still experiencing any issues.

## More details on .mla, .maple, install...

Hi all,

I'll comment on a couple of the questions above.

First, the "missing mla" file: When you use the PackageTools:-Create command to create a new package workbook, the .mla file is not added to the workbook as a file, rather it is saved into the workbook as a variable (you can see this if you open Maple and open the variable palette in the workbook navigator).

Stepping back, the key property that makes a workbook into a package workbook is the presense of a saved module in the workbook. When a workbook has a saved module, Maple will view it in a similar manner to an mla file on disk - meaning that if you have an un-extracted workbook in a path present in libname, Maple treats it like an added library available to be loaded with the "with" command. Put simply, .maple files appear the same as .mla files when placed in a library folder.

For Maple 2017, we added a new command called PackageTools:-Install. This command installs a package workbook by extracting some the workbook contents to a predefined folder on disk (%USERFOLDER%/maple/toolbox) - this folder is also automatically added to libname so Maple can load the package and view the help at any time. When installing, this command extracts any attached help files, but does not extract any .mla files from itself since doing so would actually be redundant (see previous comments about Maple viewing .mla and .maple as library files when placed in a folder in the library path). For a future release, we're working on teaching the workbook a couple of new tricks, such as automatically extracting all worksheet attachments of a workbook into a Maple help database file, however we're not quite there yet.

Please let me know if there are any questions about the above.

We have to look into the other issue mentioned by @dharr. I've tested this a couple of ways and haven't been able to reproduce it. Could you provide us with another example for this (just in case it requires some back and forth, we can also take this offline and you can send me some files at my maplesoft email).

## Try the show solution steps app in the M...

If you want to see the steps involved with integrating this expression, try to enter it into the 'Step-by-Step Solutions' MathApp on the MapleCloud: https://maple.cloud/#doc=5651983367143424

Screenshot:

## Style Sets...

To change the font that Maple uses for 2-D math (or any other style), you will need to use a custom style set. Here's a page that outlines changing the defaults: https://www.maplesoft.com/support/faqs/detail.aspx?sid=87675

 1 2 3 4 5 6 7 Last Page 3 of 12
﻿