[seqfan] Re: Maple strongly discouraged
Charles Greathouse
charles.greathouse at case.edu
Sun Jan 12 19:17:20 CET 2014
If we're going to make a warning, let's use
# Warning: The RETURN command may produce incorrect answers in Maple 17+.
This avoids putting us in the position of encouraging any particular
language, and gives an implicit solution: use version 16 or earlier.
Charles Greathouse
Analyst/Programmer
Case Western Reserve University
On Sun, Jan 12, 2014 at 1:07 PM, Neil Sloane <njasloane at gmail.com> wrote:
> Dear Seq Fans, Maximilian Hasler has pointed out that
> my Maple program in A109671 (which worked correctly in Maple 16) no
> longer gives correct results in Maple 17 because it used the RETURN()
> command.
>
> The Maple web site says
>
> "use of the RETURN procedure is strongly discouraged"
>
> and I can see why - it produces incorrect answers (without any warning). Of
> course I don't see WHY they did this.
>
> Now there over 1900 Maple lines in the OEIS that use the RETURN statement.
> Maybe these lines need a comment saying:
>
> # Warning: May give incorrect answers because Maple has changed the meaning
> of RETURN. Suggest switching to Mathematica instead.
>
> (Not sure about the second part)
>
> I could (and probably will have to) do this with a global edit.
> Is there any other solution? It is unethical for us to include programs
> that give wrong answers.
>
> Here's the Maple program that works correctly in Maple 16 but gives wrong
> answers in Maple 17:
>
> > f:=proc(n) option remember; local t1;
>
> > if n = 1 then RETURN(1);
>
> > elif n mod 2 = 0 then RETURN(f(n/2));
>
> > else t1:= f(n-2)-f((n-1)/2);
>
> > if t1 > 0 then RETURN(t1) else RETURN(f(n-2)+f((n-1)/2)); fi; fi; end;
>
> Neil
> --
> Dear Friends, I have now retired from AT&T. New coordinates:
>
> Neil J. A. Sloane, President, OEIS Foundation
> 11 South Adelaide Avenue, Highland Park, NJ 08904, USA.
> Also Visiting Scientist, Math. Dept., Rutgers University, Piscataway, NJ.
> Phone: 732 828 6098; home page: http://NeilSloane.com
> Email: njasloane at gmail.com
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>
More information about the SeqFan
mailing list