Loading ...
Sorry, an error occurred while loading the content.
 

Re: [maple8] Weird interaction between map, lhs, and assuming forces extra eval

Expand Messages
  • Stanley J Houghton
    I agree with the analysis but the correction needs more thought to ensure that we cope with a variable name that needs assumption is buried in one of the
    Message 1 of 6 , Sep 27, 2002
      I agree with the analysis but the correction needs more thought to
      ensure that we cope with a variable name that needs assumption is
      "buried" in one of the positions highlighted.

      Regards
      Stan


      On Fri, 27 Sep 2002 08:27:05 -0700 "Edgardo S. Cheb-Terrab"
      <ecterrab@...> wrote:
      > > I don't know if this is a bug or if there is some
      subtle documntation that
      > > I missed:
      > >
      > > > restart;
      > > > map(lhs, {a=0});
      > > {a}
      > > Everything is as expected so far.
      > >
      > > > restart;
      > > > map(lhs, {a=0}) assuming real;
      > > {lhs(a=0)}
      > > > eval(%)
      > > {a}
      > >
      > > Why is the extra eval needed?
      >
      > From what I see this is a bug. The solution has to do with what seems
      > undocumented features in `assuming`: you can tell to it that "this and that"
      > symbols are keywords of a command and hence should not receive assumptions
      > over them.
      >
      > Concretely, what is going on is that when
      >
      > > map(lhs, {a=0}) assuming real;
      >
      > `lhs` is being replaced by lhs~ with assumptions (so it is not `lhs` anymore),
      > then executed (lhs~ performs nothing), then replaced lhs~ -> lhs. leading to
      >
      > {lhs(a=0)}
      >
      > Then, as Stanley noted, if you
      >
      > > map(lhs, {a=0}) assuming a::real;
      >
      > all works because in this case only `a` is assumed real. This bug is fixed as
      > follows:
      >
      > > `assuming/keywords`['map'] := () -> args[1];
      >
      > That is: state that the first argument to map is always a keyword -- not to be
      > assumed. Then you have, as expected:
      >
      > > map(lhs, {a=0}) assuming real;
      >
      > {a}
      >
      > These routines `assuming/keywords` receive the function arguments and tell
      > which of them are keywords.
      >
      > For map2 it is also missing
      >
      > `assuming/keywords`['map2'] := () -> args[1..2];
      >
      > There are many interesting examples in the library. Via
      > indices(`assuming/keywords`) you see which are there.
      >
      > Edgardo
      > _______________________________________________________________________
      > Edgardo S. Cheb-Terrab http://lie.uwaterloo.ca/ecterrab
      > Centre for Experimental and Constructive Mathematics SFU, Canada
      > Theoretical Physics Department UERJ,Brazil
      >
      >
      >
      > To unsubscribe from this group, send an email to:
      > maple8-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.