Joe Riel

9660 Reputation

23 Badges

19 years, 364 days

MaplePrimes Activity


These are answers submitted by Joe Riel

Here's an even more hackish way: replace the procedure that is formatting the number.  I located that using mdcs (my custom debugger available via the MapleCloud).  The replacement I'm showing only affects the current session.

om := kernelopts('opaquemodules'=false):
Statistics:-Visualization:-VennDiagram:-GenerateSize := proc( U, dsl )
    if dsl = ':-absolute' or dsl = ':-default' then
        S->sprintf( "%d", numelems( S ) )
    elif dsl = ':-relative' then
        # this is the line that was changed
        S->sprintf( "%.0f%%", 100*numelems(S)/numelems(U) )
    elif dsl = ':-contents' then
        S->sprintf( "%a", S )
    else
        ()->""
    end if;
end proc:
kernelopts('opaquemodules'=om):

The call in your worksheet now produces what you want.

I can reproduce this.  I have each worksheet set to use an independent kernel.  In one worksheet I did

stopat(simplify):
simplify(x);

In the debugger I clicked the quit button.  Then opened a new worksheet and executed

simplify(x)

Below that appeared

DBG> quit

I rarely use the builtin debugger, instead using a custom debugger which does not appear to have this issue.

There is a bug in the routine.  I ran the following comparison test

tst := proc()
    local dir, files1, files2;
    dir := FileTools:-JoinPath([getenv("HOME"), "maple", "MaplePrimes"]);
    files1 := FileTools:-ListDirectory(dir
                                       , 'depth' = infinity
                                      );
    files1 := select(f -> FileTools:-Extension(f) = "mpl", files1);
    files1 := convert(files1, set);
    files2 := FileTools:-ListDirectory(dir
                                       , 'depth' = infinity
                                       , 'select' = "*.mpl"
                                      );
    files2 := select(f -> FileTools:-Extension(f) = "mpl", files2);
    files2 := convert(files2, set);
    [NULL
     , numelems(files1 minus files2)
     , numelems(files2 minus files1)
    ];
end proc:

tst();

That returned [65, 0], indicating 65 files were missed when the select option was used.

I've examined the procedure and see a problem.  There is a call to select in the code; it should be :-select to avoid a conflict with the option name.  Will file a report.

I filed the bug report.  Also looked at the operation. The issue is not the naming of the options, but rather the recursion is done on the paths after the select pattern is used.

The preceding export to the module definition is nonsensical, in context.  Eliding it cleans up the message.  You could wrap the code in an outer module declaration, so the the use of export makes sense.

Here's a hackish solution.  It's simple, not robust, but it should generally work for this particular case (pdf and dvi files).

FileTools:-ListDirectory(currentdir(), :-select = "*.[dp][dv][if]");

The forward-quoting of the types need to be adjusted.  One solution is
 

test := proc(V::{And(Vector(1),satisfies( v->type(v[1],'Vector[:-column](3)') ) ),
                 And(Vector(1),satisfies( v->type(v[1],'Vector[:-row](3)') ) )})
    print("works");
end proc:

 

StringTools:-Remove is not the procedure you want to use; it is for removing characters from a string.  What you want is probably
StringTools:-Subs(["\\begin{array}{ccc}" = ""], s);

The procedure CodeTools:-Profiling:-Profile can be used to record the number of times a procedure is called.

From the output I'll guess you are located fairly close to Maplesoft; there aren't many hops and they seem reasonably short. On my system there a few more hops, they are longer, and I can see the switch from the US sites to the Canadian sites.

See ?plot,details.  You can use the 'view' option or specify the y-range with an additional range.
plot(x, x=1..2, 'view'=[1..2, -1..2]);
plot(x, x=1..2, -1..2);

In module A, s has to be an export, not a local.

The call `<,>`(a,b,c) is somewhat equivalent to Vector[column]([a,b,c]) and `<|>`(a,b,c) to Vector[row]([a,b,c]). The actual procedures are mainly builtin, but you can inspect the non-builtin part by doing

interface('verboseproc'=3):
print(`<,>`):
print(`<|>`):

The help page for Vector describes the row and column options.

Pi/3 is not an integer (in the range 0..10), so fails in u[i,Pi/3]:=0;

CodeTools:-Profiling takes the procedure you want to profile as an argument. You are passing a call to PickAngles.  Try

with(CodeTools:-Profiling):
Profile(PickAngles):
PickAngles(...);  # appropriate call to exercise the procedure
PrintProfiles(PickAngles);

 

Not clear that this will help, but in the Logic package you can use &iff. To get the desired looking expression you could do

with(Logic):
(&not (P &or Q)) &iff ((&not P) &and (&not Q));

See the help page ?Logic,operators.

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