Joe Riel

9660 Reputation

23 Badges

20 years, 5 days

MaplePrimes Activity


These are replies submitted by Joe Riel

Any idea how closely the computed value matches what the Blue Jays are actually doing?  

The stats in the sports section of the newspaper don't, I believe, include runs per game that a team is scoring/giving up.  Given the Jays current location in the AL East, I assume they are giving up more runs than they are scoring.

 

Nice, I hadn't thought of that.

Nice, I hadn't thought of that.

@marc005 The probability of stock 2 being positive is 1/3.

@Athar Kharal There is, in fact, a fairly compact way to do this, using ?ListTools:-Classify, which was introduced in Maple16.

map(lhs~, ListTools:-Classify(rhs, op(2,op(T))));

should do what you want.

I don't believe zip is what he wants here.  Rather, he want to do 

map( xy -> f(op(xy)), L );

Less efficiently, but easier to type, is 

map( f@op, L );

I don't believe zip is what he wants here.  Rather, he want to do 

map( xy -> f(op(xy)), L );

Less efficiently, but easier to type, is 

map( f@op, L );

@Carl Love. One reason it does not exist, I believe, is that the type mechanism is mainly syntactical (types are surface-level). Distinguishing independent from dependent variables requires more knowledge, hence more powerful tools. 

@Carl Love. One reason it does not exist, I believe, is that the type mechanism is mainly syntactical (types are surface-level). Distinguishing independent from dependent variables requires more knowledge, hence more powerful tools. 

@acer Thanks for mentioning _nresults.  It is a curious creature---it seems useful, but I've never found a definitive use for it.  

Amusing myself with it I wrote the following:

enough := () -> `if`(_nresults=undefined,NULL,seq(1.._nresults)):
(a,b,c) := enough();
                                 a,b,c := 1,2,3

What surprised me was

() := enough();
                                 :=

That represents

NULL := 'NULL'

Well, sort of.  If you enter NULL := 'NULL' an error is raised.  But if you do (I'm using tty maple)

(**) interface(prettyprint=0);
(**) () := ();
NULL := 'NULL'

NULL is a protected name that is assigned the empty expression sequence. Attempting to reassign it  raises an error. What surprised me was that it was legal to assign an empty sequence to the empty sequence. I suppose that makes sense; probably that is a result of being able to assign sequences to sequences. I don't recall when that feature was introduced (quite a while ago), but suspect that () := () was not legal in earlier versions of Maple. 

 


 

@acer Thanks for mentioning _nresults.  It is a curious creature---it seems useful, but I've never found a definitive use for it.  

Amusing myself with it I wrote the following:

enough := () -> `if`(_nresults=undefined,NULL,seq(1.._nresults)):
(a,b,c) := enough();
                                 a,b,c := 1,2,3

What surprised me was

() := enough();
                                 :=

That represents

NULL := 'NULL'

Well, sort of.  If you enter NULL := 'NULL' an error is raised.  But if you do (I'm using tty maple)

(**) interface(prettyprint=0);
(**) () := ();
NULL := 'NULL'

NULL is a protected name that is assigned the empty expression sequence. Attempting to reassign it  raises an error. What surprised me was that it was legal to assign an empty sequence to the empty sequence. I suppose that makes sense; probably that is a result of being able to assign sequences to sequences. I don't recall when that feature was introduced (quite a while ago), but suspect that () := () was not legal in earlier versions of Maple. 

 


 

@Carl Love Don/t know that I'd label it a typo. I used angle brackets to assign a Matrix, preformatted the block, submitted, then later edited the post to fix an actual typo, elsewhere. That invariably elides angle brackets---I invariably forget.  Fixed it.  Thanks.

@Carl Love Don/t know that I'd label it a typo. I used angle brackets to assign a Matrix, preformatted the block, submitted, then later edited the post to fix an actual typo, elsewhere. That invariably elides angle brackets---I invariably forget.  Fixed it.  Thanks.

A minor improvement: remove the eval from eval(procname); that is, i := op(procname). A good practice is to add a check of the assignment, otherwise 'i' appears in the output because it is assigned the procedure, which evaluates to a name.

phi := proc(x)
local i;
    if not procname::indexed then
        error "missing index";
    end if;
    i := op(procname);
    if not i :: numeric then
        error "expected numeric index";
    end if;
    ...
end proc:

 

A minor improvement: remove the eval from eval(procname); that is, i := op(procname). A good practice is to add a check of the assignment, otherwise 'i' appears in the output because it is assigned the procedure, which evaluates to a name.

phi := proc(x)
local i;
    if not procname::indexed then
        error "missing index";
    end if;
    i := op(procname);
    if not i :: numeric then
        error "expected numeric index";
    end if;
    ...
end proc:

 

First 50 51 52 53 54 55 56 Last Page 52 of 195