Joe Riel

9660 Reputation

23 Badges

20 years, 16 days

MaplePrimes Activity


These are replies submitted by Joe Riel

Allow me to suggest a slightly different approach.  That is, rather than hard-code all the translations, use a table that associates inert expressions to procedures.  This is (negligibly) less efficient, but it allows a user who only has access to the "compiled" module to change the behaviour via two exports, say AddLatex and RemoveLatex (analagous to AddType and RemoveType in the TypeTools package).  An outline is

Latex := module()
option package;
export AddLatex, RemoveLatex, Latex;
local LatexString;

    AddLatex := proc(eq :: symbol = procedure)
    local symb,prc;
        (symb,prc) := op(eq);
        if member(symb, [indices(inertToProc, 'nolist')]) then
            error "%1 is already an assigned Latex type", symb;
        end if;
        inertToProc[symb] := eval(prc);
        NULL;
    end proc;

    RemoveLatex := proc(symb :: symbol)
        if not member(symb, [indices(inertToProc, 'nolist')]) then
            error "%1 is not an an assigned Latex type", symb;
        end if;
        inertToProc[symb] := 'inertToProc[symb]';
        NULL;
    end proc;

    inertToProc := table(
        [NULL
         , _Inert_RATIONAL = proc(expr) ... end proc
         , _Inert_COMPLEX = proc(expr) ... end proc
         ...
         ]);

    LatexString := proc(expr)
         ...
         inertType := op(0,ToInert(args));
         func := inertToProc[inertType];
         if func :: indexed then
                  func(expr);
         else error ...
         end if;
     end proc;
     ...
end module:

        

Insert the line

LibraryTools:-Save(newLatex, "newLatex.mla");

after the module assignment and then execute the worksheet.  That creates the archive newLatex.mla (I'm not sure where it puts it, probably in currendir).  If you add that archive to libname, you can these use the package.  Note that if you want to do with(newLatex), you should add the line

    option package;

to the module assignment before saving.  You also might want to modify the assignment to Latex, I believe that there should be a newline character in the string (the following shows it, as `\n'):

    Latex := (expr) -> printf("%s\n",LatexString(expr));

Try working with 1/A. 

never mind (format got mangled).

While the original problem is readily solved by hand, a nice exercise is the extension to three dimensions.   Rather than the volume, a more useful metric might be the ratio of the enclosed volume to that of the unit-sphere.  Then extend the problem to n-dimensional hyperspheres.  What is the ratio as n goes to infinity?

Numerical solvers generally do convert to explicit first-order.

While it doesn't help here, you probably want to change the initial conditions.  The solution is the trivial y(x) = 0.

Numerical solvers generally do convert to explicit first-order.

While it doesn't help here, you probably want to change the initial conditions.  The solution is the trivial y(x) = 0.

I'll have to suggest that the Debian maintainer update that description.  The product is now simply Maple, and the company Maplesoft.  'Course I should also update the actual content.  I named the mode maplev rather than maple because there was an existing maple mode.

I'll have to suggest that the Debian maintainer update that description.  The product is now simply Maple, and the company Maplesoft.  'Course I should also update the actual content.  I named the mode maplev rather than maple because there was an existing maple mode.

He'll probably want to do combine( . , 'power'), possibly combine( . , 'power', 'symbolic'), before the matching.

He'll probably want to do combine( . , 'power'), possibly combine( . , 'power', 'symbolic'), before the matching.

Interesting idea.  To make it work you'd want to do something like

if IsWorksheetInterface('Standard') then
    print(INTERFACE_WORKSHEET(display,file="/home/joe/downloads/test.mw"));
    print(INTERFACE_WORKSHEET(display,file="/home/joe/downloads/compareDG.mw"));
end if;

with the appropriate file names.  This method is rather limited in that it always opens the same files, not the ones you last had open.  I suppose you could write a script that searches the configuration file for the most recently accessed files, however, there is no guarantee that they were actually active (in tabs) when Maple was last closed.

I usually just use the File > Recent Documents submenu.

Interesting idea.  To make it work you'd want to do something like

if IsWorksheetInterface('Standard') then
    print(INTERFACE_WORKSHEET(display,file="/home/joe/downloads/test.mw"));
    print(INTERFACE_WORKSHEET(display,file="/home/joe/downloads/compareDG.mw"));
end if;

with the appropriate file names.  This method is rather limited in that it always opens the same files, not the ones you last had open.  I suppose you could write a script that searches the configuration file for the most recently accessed files, however, there is no guarantee that they were actually active (in tabs) when Maple was last closed.

I usually just use the File > Recent Documents submenu.

Debian Etch is what I run. 

Click on the screenshots to see them at normal size. 

Good suggestion, I'll add some notes to my blog on configuring it for different versions.  Configuring it is more complicated that it should be, mainly 'cause I never had a pressing need to clean up that part of the code.

Debian Etch is what I run. 

Click on the screenshots to see them at normal size. 

Good suggestion, I'll add some notes to my blog on configuring it for different versions.  Configuring it is more complicated that it should be, mainly 'cause I never had a pressing need to clean up that part of the code.

First 146 147 148 149 150 151 152 Last Page 148 of 195