acer

32348 Reputation

29 Badges

19 years, 330 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@roman_pearce What Roman says is quite true, especially about certain subsets of computation. My response was relating specifically to the concept of general symbolic computation, for which there is likely no all-round "silver bullet".

"Library routine" is sometimes used colloquially to mean a procedure that is written as interpreted Maple code, regardless of whether it is actually already stored in some archive file. That's the informal sense in which I meant it -- primarily just to distinguish it from kernel builtins or call_externals.

So sorry -- I overlooked that such usage not universally understood. I had intended the meaning to be more clear by qualifying it with "ie. not kernel built-in commands". I use the term is in the sense of a procedure that might typically be sensibly saved to a Library, not that it had been saved to a Library. That's an old, informal sense, and may now be even less technically accurate as call_externals may be saved.

I'd agree that it might not be the best term possible. To some it might connote prior storage in an archive as opposed to possible storage in an archive. If anyone suggests something markedly better then I'd happily use that instead. How about, "interpreted procedure"?

Note that I didn't write "system Library", because I wasn't referring only to procedures not written by oneself. To be sure, "Library" procedures and "procedures you write yourself" are not disjoint, and neither is a proper subset of the other.

acer

"Library routine" is sometimes used colloquially to mean a procedure that is written as interpreted Maple code, regardless of whether it is actually already stored in some archive file. That's the informal sense in which I meant it -- primarily just to distinguish it from kernel builtins or call_externals.

So sorry -- I overlooked that such usage not universally understood. I had intended the meaning to be more clear by qualifying it with "ie. not kernel built-in commands". I use the term is in the sense of a procedure that might typically be sensibly saved to a Library, not that it had been saved to a Library. That's an old, informal sense, and may now be even less technically accurate as call_externals may be saved.

I'd agree that it might not be the best term possible. To some it might connote prior storage in an archive as opposed to possible storage in an archive. If anyone suggests something markedly better then I'd happily use that instead. How about, "interpreted procedure"?

Note that I didn't write "system Library", because I wasn't referring only to procedures not written by oneself. To be sure, "Library" procedures and "procedures you write yourself" are not disjoint, and neither is a proper subset of the other.

acer

Implemented and used properly, I'd expect IsAnagram to be at least as efficient if not more so) than such approaches involving extraction of numerical digits into list structures. And of course it's convenient (with a little extra padding effort, required for any approach, really, when of inequality lengths with presumed leading zero).

acer

Implemented and used properly, I'd expect IsAnagram to be at least as efficient if not more so) than such approaches involving extraction of numerical digits into list structures. And of course it's convenient (with a little extra padding effort, required for any approach, really, when of inequality lengths with presumed leading zero).

acer

Thanks for the response, Will!

The exact cause might just have to remain a mystery.

Sometimes I've suspected that some other misses might be due to keywords (words indexed as searchable) not being recognized when lying within <pre> tags (which would be great pity, as it is a very common way to show 1D code here with a more appropriate font). Or if the word is bold or italicized. But those are just wild guesses on my part.

acer

Sorry, it isn't clear to me whether you want the numbers 8,4,4,7 or the pools like "tuv", etc. I'm trying to write code below that is more understandable than maximally efficient -- hope that's ok.

> t2 := "abc": t3 := "def": t4 := "ghi": t5 := "jkl":
> t6 := "mno": t7 := "pqrs": t8 := "tuv": t9 := "wxyz":
> T:=[t2,t3,t4,t5,t6,t7,t8,t9]:

> dec := proc(w::string,T)
>    local c, t, S;
>    for c in w do
>       for t from 2 to 9 do
>          if StringTools:-Search(c,T[t-1]) > 0 then
>             S[c]:=T[t-1];
>             break;
>          end if;
>       end do;
>    end do;
>    seq(S[c], c in op(w));
> end proc:

> dec( "this", T );

                  "tuv", "ghi", "ghi", "pqrs"

> dec( "abraham", T );

        "abc", "abc", "pqrs", "abc", "ghi", "abc", "mno"

I was wondering whether you were going to ask a tougher variant of your original question, such as how to find all phrases (of say 2-letter through 7-letter words) from a seven or 10 digits phone number.

I haven't this sort of fun since a code theme a few years ago.

acer

Sorry, it isn't clear to me whether you want the numbers 8,4,4,7 or the pools like "tuv", etc. I'm trying to write code below that is more understandable than maximally efficient -- hope that's ok.

> t2 := "abc": t3 := "def": t4 := "ghi": t5 := "jkl":
> t6 := "mno": t7 := "pqrs": t8 := "tuv": t9 := "wxyz":
> T:=[t2,t3,t4,t5,t6,t7,t8,t9]:

> dec := proc(w::string,T)
>    local c, t, S;
>    for c in w do
>       for t from 2 to 9 do
>          if StringTools:-Search(c,T[t-1]) > 0 then
>             S[c]:=T[t-1];
>             break;
>          end if;
>       end do;
>    end do;
>    seq(S[c], c in op(w));
> end proc:

> dec( "this", T );

                  "tuv", "ghi", "ghi", "pqrs"

> dec( "abraham", T );

        "abc", "abc", "pqrs", "abc", "ghi", "abc", "mno"

I was wondering whether you were going to ask a tougher variant of your original question, such as how to find all phrases (of say 2-letter through 7-letter words) from a seven or 10 digits phone number.

I haven't this sort of fun since a code theme a few years ago.

acer

And, for longer words,

> with(StringTools):
> with(PatternDictionary):
> dict:=Create('builtin'):
> L:=select(IsLower,select(IsAlpha,[seq](Get(dict,i),
>                                        i=1..Size(dict)-1))):

> t2 := "abc": t3 := "def": t4 := "ghi": t5 := "jkl":
> t6 := "mno": t7 := "pqrs": t8 := "tuv": t9 := "wxyz":

> findem := proc()
> global L;
> local i, T, numfound, thist, sol, thiswordlist, z, n;
>    n := nargs;
>    thiswordlist := select(z->length(z)=n,L);
>    T:=combinat:-cartprod([seq([LengthSplit(args[i],1)],
>                               i=1..nargs)]):
>    numfound:=0:
>    while not T[':-finished'] do
>       thist := cat(op(T[':-nextvalue']()));
>       if member(thist,thiswordlist) then
>          numfound:=numfound+1;
>          sol[numfound]:=thist;
>       end if;
>    end do:
>    if numfound > 0 then
>       convert(sol,list);
>    else NULL;
>    end if;
> end proc:

> findem(t4,t7);

                                   ["is"]

> findem(t2,t6);

                                ["am", "an"]

> findem(t3,t6);

                             ["do", "em", "en"]

> findem(t6,t2,t3,t2);

> findem(t2,t6,t6);

                        ["bon", "boo", "con", "coo"]

> findem(t6,t4,t6,t3);

                          ["mind", "mine", "nine"]

acer

And, for longer words,

> with(StringTools):
> with(PatternDictionary):
> dict:=Create('builtin'):
> L:=select(IsLower,select(IsAlpha,[seq](Get(dict,i),
>                                        i=1..Size(dict)-1))):

> t2 := "abc": t3 := "def": t4 := "ghi": t5 := "jkl":
> t6 := "mno": t7 := "pqrs": t8 := "tuv": t9 := "wxyz":

> findem := proc()
> global L;
> local i, T, numfound, thist, sol, thiswordlist, z, n;
>    n := nargs;
>    thiswordlist := select(z->length(z)=n,L);
>    T:=combinat:-cartprod([seq([LengthSplit(args[i],1)],
>                               i=1..nargs)]):
>    numfound:=0:
>    while not T[':-finished'] do
>       thist := cat(op(T[':-nextvalue']()));
>       if member(thist,thiswordlist) then
>          numfound:=numfound+1;
>          sol[numfound]:=thist;
>       end if;
>    end do:
>    if numfound > 0 then
>       convert(sol,list);
>    else NULL;
>    end if;
> end proc:

> findem(t4,t7);

                                   ["is"]

> findem(t2,t6);

                                ["am", "an"]

> findem(t3,t6);

                             ["do", "em", "en"]

> findem(t6,t2,t3,t2);

> findem(t2,t6,t6);

                        ["bon", "boo", "con", "coo"]

> findem(t6,t4,t6,t3);

                          ["mind", "mine", "nine"]

acer

I second the sentiment: unless you have some special circumstance then at the very least try using the Standard GUI.

Do you know that you can configure the Standard GUI to deal in quite familiar looking Worksheets, using 1D notation input? (Those are not defaults, but you can set them as GUI options and even save them as global preferences.)

In Classic, you can also first issue plotsetup(maplet) and get a Java-based plotter that supports more 2D Math. That plotter will show nicely typeset subscripts using your original example's syntax plot(y[r]^2,labels=[y[r],x[c]]) . But it will not display the plots inlined in the worksheet, and that may be less desirable for you.

acer

I second the sentiment: unless you have some special circumstance then at the very least try using the Standard GUI.

Do you know that you can configure the Standard GUI to deal in quite familiar looking Worksheets, using 1D notation input? (Those are not defaults, but you can set them as GUI options and even save them as global preferences.)

In Classic, you can also first issue plotsetup(maplet) and get a Java-based plotter that supports more 2D Math. That plotter will show nicely typeset subscripts using your original example's syntax plot(y[r]^2,labels=[y[r],x[c]]) . But it will not display the plots inlined in the worksheet, and that may be less desirable for you.

acer

@quanta I'll try and find time to give it a shot on Win7. (My cygwin's gcc is doing ABI=32, I think. But with some time I ought to be able to figure out using mingw for it. Maybe I can get the ABI=64 for gmp using the appropriate msvc++. Finding time is often the problem.)

If you enjoy reading older articles on this site, there are some interesting ones available under various "tag" pages. I like the performance and blog tags.

Maybe you were remembering this old post.

acer

@dalmas64

In your other posts, it was shown that supplying Optimization:-Maximize with the optional argunment method=branchandbound generates the correct solution (for your other differing univariate examples).

@dalmas64

In your other posts, it was shown that supplying Optimization:-Maximize with the optional argunment method=branchandbound generates the correct solution (for your other differing univariate examples).

First 444 445 446 447 448 449 450 Last Page 446 of 592