sigl1982

95 Reputation

4 Badges

9 years, 55 days

MaplePrimes Activity


These are questions asked by sigl1982

Hello,

how can I use procedures saved in ".m" files in my own repository?

I've created

LibraryTools:-ShowContents("C:\\Users\\Stefan\\maple\\toolbox\\myfactor\\lib");
[["Auxiliary.m", [2016, 10, 10, 15, 53, 20], 1024, 3333]]

and registered it in the maple.ini
libname;
     "C:\Program Files\Maple 18\Maple 18\lib",
       "C:\Users\Stefan\maple\toolbox\Iterator\lib", ".",
       "C:\Users\Stefan\maple\toolbox\myfactor\lib"


but Maple don't know the procedure squarefree() from the repository. What is wrong?

Thanks

Hello everybody,

I need help to increase the speed of two procedures.

My first (recursive) procedure returns a list of all k - element subsets of a given set {1, ... , n}:


nkSubSetList := proc(n :: nonnegint, k :: nonnegint)
        option remember;          # boosts with factor 5
        local X, prev, nextOne;

        # Local function that augments a nonnegint to a given set, e.g.
        local augment := (SetA, intm) -> {op(SetA), intm};

        # Case k > n allowed & needed for recursive call
        if n < 0 or k < 0 or k > n then
            X := {};
            return X
        elif n = 0 or k = 0 then
            X :=  [{}];
            return X
        else
            prev := nkSubSetList(n - 1, k);
            nextOne := map(augment, nkSubSetList(n - 1, k - 1), n);
            return [op(prev), op(nextOne)]
        end if;
end proc:

# Starting the Profiler on my system the call nkSubSetList(20, 10) needs 0,5 sec.
The other algorithm returns a list of all k-element subsets of a given set T:

TkSubSetList := proc(T :: set(posint), k :: nonnegint) :: list(set(posint));
    local n := nops(T);                                 # Cardinality of index set T
    local callSet := A -> map(i -> T[i], A);     # Call the i-th entry of the given set T

    # Input ASSERTS
    ASSERT(k <= n, "k is bigger than the cardinality of index set T");

    return map(callSet, nkSubSetList(n, k));
end proc:

# Starting the Profiler on my system the call TkSubSetList({1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}, 10) needs 1,8 seconds.

Who have an idea how to increase the speed of these algorithms?

Hello everybody,

I've failured cause of a simple parallel computation.

Let us assume I have 3 procedures g,h,i, each of them does the some computation on a different way and returns the same value (for example two of them need a second and the third needs a day).

It's my goal, that if one of the tasks finished, the other tasks stops and my programm continues. But if I use for example

>Threads:-Task:-Start( null, Task=[f := g(100)], Task=[f:= h(100)], Task[f:= i(100)]);

every task computed to the end and after that the program continues. How can I solve this problem?

P.S. Sorry about my english, I do my best

1 2 3 Page 3 of 3