140 Reputation

5 Badges

15 years, 49 days

MaplePrimes Activity

These are replies submitted by ianmccr

@Mac Dude 

 No. I assumed that the changes to the help tools package in Maple 2018 might have caused a problem, but I'll give it a try and work through any necessary changes.  Thanks.

Ian McCreath



Thank you.  The type tests you suggested will make my procedure much more robust.

Ian McCreath

@Carl Love

And thus we come back to the basic problem of programming Maple in Windows. I was using the workbook mainly because it provided ready acess to the programming editor which is otherwise only available is the startup code area or the code edit areas of a worksheet. It would have been nice if the editor were available as a standalone application. 

Would you also advise breaking up a large body of code (in excess of 2000 lines) into separate linked modulesto make it more managable?

Thank you.

If my prior posts come across in the wrong way, I apologize. I am frustrated with this workbook problem and having a hard time describing what is going on. My earlier observation was a red-herring. I just noticed that you get two different menus in the Navigator. In one, "attach files" is an unavailable command, in the other "attach files" is available and works.  I thought I had the answer to my problem when I found this, but the real problem remains.

However, I have attached a zipfile of three pdfs of worksheets that illustrate my problem. The file Glyph2.pdf shows how I read my module into the worksheet. Using with to load the module, all of the exports are listed. But after a restart, using the packagetools install command, the modules listed exports do not include all of the exports in the source code, eg. the command DiracMatrices is in the first listing, not the second.

The file Glyph2removerestartcommand.pdf illustrates what happens when I remove the restart command. (I also closed Maple and deleted Glyph2 from my toolbox before I tried the reinstall.) Now Diracmatrices is present in the listing.

However, the file Untitled(2).pdf shows that the module, which is actually available from the toolbox, does not include the new exported procedures.

I really have no idea why  Packagetools seems to reinstall the old package.



@Carl Love 

According to the help topic, "Maple Workbook URI," the Workbook URI (Uniform Resource Identifier) is used to represent the identity and location of files within a Maple workbook or files residing inside another workbook in a given file directory.
A URI  would look like this:
              "exampleURI := "this:///MyCode.mpl""

At this time, I can't attach any files to a maple workbook file on my installation.




I had to change input and output to 2D math notation for extended typesetting to take effect. However, your advice solved the output problem.


I don't know how to edit the post to remove the upload, but if the monitors wish to remove it, I understand the concern. I am open to suggestions as to how I should present the question, but, fundamentally, I believe the problem is the result of the namespace in an installed package. The code itself is copied straight from the maple examples, and my worksheet repeats the examples given on the help page for the module's exports, but the results are different when installed.

@Carl Love 


Here's the zipped workbook.

@Carl Love 

Thank you. I'll try the inert multiplication. This saved me a lot of time trying to finesse the output.


Thank You.  I have played around quite a bit with the code that Carl posted. I think I finally have a feel  for how the execution paradigm works, enough that I can apply it myself I appreciate that quite a bit of Maple's power comes from the ability to return a procedure unevaluated, but the case of how to actually generate results doesn't leap out from the help examples or the programming guide.  The only reference in help that I can find is "special evaluation rules."  However, modifying "end proc" to "end proc() doesn't leap off the page unless considered in the light of the examples in this thread. Ian Thompson's book does touch on the subject, but lightly. I'm going to take a close look at your sample code in the same light. 

It is interesting to note that Help documents the use of the :- operator without the left operand as a means of calling the global instance of a procedure when there is a local instance of the same name. I recall this was actually used in some sample code (Quotient Field of the Polynomial Ring) in the Maple 8 programming guide, specifically  gcd:=(a,b)->:-gcd(a,b) .


You can't find yourself unless you first get lost.  With Carl's modifications to my worksheet, I can experiment a bit with the effects of changes to the code.  However, given our recent discussion, I am starting to wonder whether the procedure I store in the table can, in turn, make a call to another procedure defined elsewhere in the module. Are there any limitations on the complexity of the statement sequence of the stored procedure.


 I have tried you sample and it works.  My goal here is to set up the environment for a clifford algebra which uses a procedure to define dimension, minindex, maxindex, and a table representing the metric.  I intended to include calls to addspace at the end of the module so it would Ioad the metrictable with four or five different calls to a local procedure Assignspace(Dim,table['identity'] or the like).  This way the user can choose the metric environment to be used.  Then the call to GetSpace would set up the default environment when the module loads. (Something like the programming sample diffimpl does to create a database of functions for use by the parser.)  I am still trying to get a handle on the evaluation rules and  I didn't catch the syntactic distinction between evauluating a procedure and executing it.  Thank you for clarifying the rules for me.

I have attached a worksheet, but this is the code I was testing.testmodule.mw

Glyph2 := module()
    export    AddSpace, GetSpace, RemoveSpace,DoSpace;
    local     MetricTab;

    MetricTab := table():

    AddSpace := proc( theName::symbol, implementation )
        local    old_imp;
        old_imp := NULL;
        if assigned( MetricTab[ theName ] ) then
            WARNING( "replacing existing extension `%1'", theName );
            old_imp := eval( MetricTab[ theName ] )
        end if;
        MetricTab[ theName ] := eval( implementation, 1 );
        eval( old_imp, 1 )
    end proc;

    RemoveSpace := proc( theName::symbol )
        if assigned( MetricTab[ theName ] ) then
            MetricTab[ theName ] := evaln( MetricTab[ theName ] )
        end if;
    end proc;

    GetSpace := proc( theName::symbol )
        if assigned( MetricTab[ theName ] ) then
            eval( MetricTab[ theName ], 1 )
        end if
    end proc;
    AddSpace('default','proc() print("Metric is default")end proc');
    GetSpace( 'default');   
end module:

I ordered the book from Amazon after I read the post.  The book is full of useful insights that are hard to glean from the help files. I particularly appreciated Appendix B, which summarized the rules for terminating maple language statements. One tends to pick this up by osmosis, but having a summary of the rules for current and older versions of maple is welcome. While the information is probably included in the help files, I wasn't able to find a help page discussing terminating characters in particular.

@Carl Love 

" I fear that you don't have the module "spirit" yet. "  I'm afraid you're correct.  I'm moving forward using code that was written for Maple V and am not quite at the present yet.  All those globals did bother me, but I wanted to have a module that worked so I could play with the code and get a feel for current versions of Maple by experimentation. You're advice is  a helpful start.

1 2 3 Page 2 of 3