Mac Dude

1002 Reputation

13 Badges

6 years, 82 days

MaplePrimes Activity

These are questions asked by Mac Dude

I have the following function involving 2 piecewise constructs:

ftotal := -1.70678763408500*10^6*dpp[f]*piecewise(t < 0, 0, 0 <= t and t <= t1, 1-cos(t*Pi/t1), t1 < t, 2)-3.41357526817000*10^6*corrFac*piecewise(t < 0, 0, 0 <= t and t <= t1, 1/2-(1/2)*cos(2*t*Pi/t1), t1 < t, 0)+3.51914976100000*10^8;

(This is a result from a prior calculation in Maple; I did not create this construct orginally). The condition blocks are the same for both piecewise functions so this can be simplified to one piecewise function. Per the Help this can be achieved using convert:


but I get this error:

Error, (in PiecewiseTools:-Convert) unable to compare 0 and t1

Since I pasted everything into a new sheet I know that t has no assigned value. Same is true for t1 (and specifically I need this for general t and t1). The conversion to Heaviside works; but converting from that back to piecewise fails with the same error.

Is there any way I can achieve the desired result other than doing it by hand?

Sample sheet is attached. I originally ran into this in Maple 2016 but verified the same issue is present in Maple 2017.



Maple has had object-oriented features since about version 15, implemented with modules and records and the ability to define exports of these. Methods can be defined and called using module:-Method() and properties in a similar way including hierarchical constructs. Overloading of functions is possible, although I have run into trouble trying to overload build-in function. While this mechanism is not fully oo, I have found it enormously helpful for larger projects and a distinguishing feature of Maple.

More recently, the option object was added to modules. What are the true new functionalities? I see that the syntax for methods has changed (Method(object,arguments) rather than module:-method(arguments)) but I do not see how that is an improvement. I guess there are also now bona-fide constructors, doing what used to be done with a module factory (a proc that returns an instance of a module). And Object(object) seems to do what copy(module) does.

I am conceptualizing a larger package that will make use of the oo features of modules. I know I can write this using the established :- syntax using modules. Are there any benefits to using the newer objects rather than modules and records (& I know that all these are essentially modules)?



I am trying to use the element properties Maple has in its ScientificConstants package. I am running into problems with the density of gaseous elements:


Units:-UsingSystem(); # returns SI as expected

GetValue(Element('Si',density)); # returns 2329.0000 [kg/m^3] which is 2.329 g/cm^3, which is correct

GetValue(Element('H',density(gas))); # returns 88 [kg/m^3], which is incorrect.

PDG gives the density of hydrogen as 8.376E-5 g/cm^3, which is 0.08376 kg/m^3.  

Even more crazy for Krypton:

GetValue(Element('Kr',density(gas))); # returns 3677.000 [kg/m^3]. Heavy little buggers, these Kypton atoms! Should be 3.486 in the same units.

What gives? Am I missing something here?

Mac Dude



I would like to create a Maple Workbook of my Lattice Package so I can put it on MapleCloud. I had an email exchange with Daniel Skoog from Maplesoft about this, and he even sent me an example that looked easy enough to adapt to my purposes. Alas, it does not work. Here is the code I wrote to assemble the already extant files:

                "Maple Initialization loaded..."
# Build Lattice workbook following example from Daniel Skoog, MapleSoft:
 "/Applications/Math_Calc/Maple 2015/Packages/Lattice/Lattice

    Version 1.1.0 release files"
# We have all files already from the App Center submission, so just assemble the workbook
"MLA file"="Lattice.mla",\
"Build procedure"="",\
"Manual"="The Lattice Package Users",\
"Release Notes"="V1.1 Release Notes.rtf");
Error, (in march) unable to attach worksheet file The Lattice Package Users

When I look at the created workbook (Lattice.maple), the only members included are, the Build procedure and the source file Lattice.mpl. In particular, Lattice.mla is not there, which is the most important one.

What am I doing wrong? What does "march" (which sounds like machine architecture) have to do with it??

I also don't quite know how to "install" it. I assume I just put the whole workbook into a directory accessible through libname ?

Mac Dude

PS: I could have sorted this privately with Daniel, but this may be of interest to others as well so I hope he'll answer through this forum.

I am dealing relatively often with vector functions of a variable vector. Specifically these are (in general nonlinear) mappings from R^6 to R^6, and often I have one or more extra parameter that controls the map.

Often I'd like to get a first-order expansion of these. The general scheme I use to do that is to map mtaylor over the components of the function vector. Like so:

map(mtaylor,F(<x1...x6>),[x1...x6,],order);# F(<...>)  is  <F1(<..>)..F6(<...>)>

This works fine until I hit a situation where the Taylor expansion for one of the parameters p does not exist. Then it bombs. Actually, I often can use assumptions on the parameters to prevent bombing; however, in that case I often get the unchanged function F returned. This is Bad as the whole thing happens in a loop with many concatenated functions F, and now expression swell makes Maple lock up.

In at least a significant subset of these functions, the series command works where taylor fails. "mseries", however, does not exist in Maple. So my question is whether someone has written an "mseries" command for Maple. I know how to do it in principle (but caution is needed to make it work as intended), however, I wonder whether either someone has done it before and might share his/her code, or whether there is a reason why "mseries" actually cannot work.


Mac Dude


1 2 3 4 5 6 7 Last Page 1 of 18