simplifying versions of oddp and friends



Barton,

I like the idea of changing oddp and other predicates to simplifying. There
are two messy issues: 1) as always, backwards compatibility -- how much code
do we think would be affected? 2) semantics -- various predicates currently
have quite divergent semantics (see below).

So there is a lot of cleanup to do with predicates....

There are several different ways that predicates operate in Maxima:

1) Literal type checking: False if variable, e.g. integerp, ratnump,
stringp, taylorp, setp, oddp (not really a type check): accepts any class of
argument, returns true when the *literal* argument satisfies the predicate,
and false otherwise, even if the predicate is meaningless. Does *not* treat
variables as referring to their values. oddp(x) => false; oddp(%i) => false;
oddp(matrix([1,2])) => false; ratnump(i) => false.  (assume
declare(i,integer))

2) Variable property checking: featurep(i,integer) => true;
featurep(x,integer) => false.  Unknown returns false.  This has sometimes
been extended (inappropriately, I believe) to work on expressions as well,
e.g. featurep(i^2,integer) => true.

3) Value property: Error if unknown or variable, e.g. primep, lowercasep:
only accepts one class of arguments (integers for primep) and returns true
or false for the *literal* value; an error for arguments of other classes.
primep(x) => error; primep(%i) => error.

4) '<' category: strictly a noun -- has to be passed to 'is' for testing.
1<2 => 1<2; is(1<2) => true; is(p<p+1) => true. With prederror=true, gives
an error if it can't determine truth; with prederror=false, returns unknown
if it can't return true/false.

I think we need to rethink all this and decide what kinds of predicates we
need and what they should do for variables and for values outside their
domain, and which ones make sense as simplifying vs. evaluating.

               -s

On Sun, Feb 7, 2010 at 10:49 AM, Barton Willis <willisb at unk.edu> wrote:

>
> Would it be a good to have both simplifying and non-simplifying
> versions of oddp (and related predicates)?
>
> What started me thinking about this: for a positive integer n, we have
>
>  limit(hermite(n,x),x,minf) = if oddp(n) then minf else inf
>
> In this context, we need a simplifying oddp function--the
> non-simplifying version makes a mess. If we had a simplifying oddp
> function, limit(hermite(n,x),x,minf) could return a conditional.
>
> It might be OK to only have a simplifying oddp function, but that
> could break some code, I think.
>
> If we choose to have both simplifying and non-simplifying versions of
> some predicates, how should we name the simplifying version? The
> to_poly_solver prepends % to the simplifying predicate.
>
> Example with an experimental orthopoly extension:
>
>  (%i24) limit(hermite(n,x),x,minf);
>  (%o24) if %oddp(n) then minf else inf
>
>  (%i25) subst(n=9,%);
>  (%o25) if true then minf else inf
>
>  (%i26) ev(%,nouns);
>  (%o26) minf
>
> The ev(%, nouns) isn't terrific, but that is another problem.
>
> Barton
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>