AmirHosein Sadeghimanesh

225 Reputation

7 Badges

8 years, 364 days

Social Networks and Content at Maplesoft.com

Finished Ph.D. in Applied Algebraic Geometry in Biology and did postdoc in Mathematics of Chemical Reaction Networks, University of Copenhagen. Another postdoc in Nonlinear Dynamics in the Mathematical Models of Cell Biology at University of Szeged. Currently a research fellow at Coventry University. Main interests; Applied and Computational Algebraic Geometry, Computer Algebra, Mathematical Biology, Chemical Reaction Network Theory, Population Dynamics. I'm also a language lover!

MaplePrimes Activity


These are questions asked by AmirHosein Sadeghimanesh

For making a Maple package, an mla file, I were always using a same 4 lines code in a Maple worksheet and it was fine, but in Maple 2022 I receive an error message instead with the same 4 lines of code. Here is a simple example. Let's say I have a directory on my computer "C:\Home\Maple projects\Test_package", inside this directory I have one file "main.mpl" and a folder called "Functions" with a single file "Test.mm". The content of these two files are in below.

main.mpl

# This is just to test savelib at Maple 2022

unprotect('testSavelin');

testSavelib := module()
	option package;
	description "This is just a test.";
	export ModuleCopy, ModuleApply, ModulePrint;
	export Test;

kernelopts( includepath = currentdir() ):
$include "Functions\\Test.mm"

end module;

protect('testSavelib');

Test.mm

Test := proc( x :: integer )
	description "prints a message saying what integer you have given to this function.";
	printf("You have inserted the integer %d.\n", x);
end proc:

Now I open a Maple worksheet and do the followings.

kernelopts(includepath="C:\\Home\\Maple projects\\Test_package"):
read("C:\\Home\\Maple projects\\Test_package\\main.mpl");
LibraryTools:-Create("C:\\Home\\Maple projects\\Test_package\\test.mla");
savelib('testSavelib'," C:\\Home\\Maple projects\\Test_package\\test.mla ");

On previous versions of Maple the result would be a test.mla file with the testSavelib package in it. But in Maple 2022 I receive an error message instead, and the test.mla is an empty mla.

Error, could not open ` C:\Home\Maple projects\CAD project\test.mla \testSavelib.m` for writing

Here is a screenshot.

The timelimit command of Maple can be used to do a computation if it uses less than a given amount of time, otherwise generating an error message that can be cought by try ... catch. Now my question is that there exists any similar command, but with a limitation on memory usage, not the time usage. I don't mean what datalimit in kernelopts can does, because I am not going to limit the memory usage of the whole Maple session, but just a command which may be used inside a larger procedure etc.

Let's say I have an mpl file and in this file there are several lines $include<~/~/~.mpl> and in some of those called mpl files, there are also some more include lines. And assume the paths of these files are given relative to a specific folder. Now I guess this specific folder has to be mentioned by modifying includepath. But looking at the help pages related to includepath (here and here) I get this sentence "it can be modified by calling kernelopts(includepath)", but I tired typing things like kernelopts(includepath):="C:\\Homes\\testFolder"; and still I see "" for kernelopts(includepath);. How can I tell Maple to look for the files relative to this location either by typing something at the Maple worksheet before typing read("C:\\Home\\testFolder\\main.mpl); or by adding a line at my main mpl file?

We can write a list, set, MutableSet and array type together with their entries types. For example list(polynom) or array(array(integer)). But what about a table? For example how can I emphasize a type table with indices of the type integer and entries a list of integers? I was guessing table(integer,list(integer)) which is not working, so my guess is not correct. I tried some other combinations which they didn't work too. I can't see anything in the programming guide and the help of Maple or a post here that is addressing this question.

Example:

test:=table([1=[1,2,3],2=[6,5,4]]):
type(test,table(integer,list(integer))): # which of course is not working.

 

Consider 1-dimensional arrays in Maple. To add one element at the end of an array, there is a pre-defined command ArrayTools:-Append (or using ArrayTools:-Insert if one wants to add an element at another location of the array) and to remove one entry from an array there is another pre-defined command ArrayTools:-Remove. Now let's say I want to add several elements and remove several elements. If I want to add all of the new elements at the end of the array, there is a predefined command ArrayTools:-Extend. If I want to remove several entries that are sequal, then I can give the second argument of ArrayTools:-Remove as a range n1..n2. But now let's say I want to remove several entries that are not sequal, for examples entries with indices in [5,8,14]. Is there any special efficient way to do it or just defining a loop to do the removals one by one? Removing by a loop is not very nice since the number of indices will change after each removal. Then another idea is to redefine the whole array using a select or a seq. But I'm guessing that none of these are the best way to do so. If I was dealing with MutableSet, I would use &minus, but I can't use MutableSets in every situation, because MutableSets change the order of elements and have more special properties like no repeated elements etc.

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