applying function identities (proposal)



Hi Barton,

> Maxima doesn't have a uniform method for applying function
> identities. Some identities are controlled by switches
> (for example, triginverses), while others have not-so-easy
> to remember (or guess) names (such as makegamma).

I agree that we can probably make the means of applying
built-in rules more consistent. Of the various mechanisms
you mentioned, I'm not sure what's preferable.

> It seems to me that there should be a database of function
> identities that could be searched and extended. The database
> would have names for collections of identities -- say all
> identities that convert something to the gamma function or
> all that identities that convert to a 1F1 function.

Well, the database might be something as simple as a list ....

> There would be a function, say 'applyident' that works
> something like this fake session:
>
> (%i1) applyident(pochhammer_reflect, 42 + pochhammer(-x,n));
> (%o1) 42 + pochhammer((-1)^n * pochhammer(x-n+1,n))

Isn't that just what apply1 attempts to do?

I guess apply1 at present doesn't know what to do with a list of rules.
But apply1 (expr, my_list) could just be apply (apply1, cons (expr, my_list))
or something like that.

> An optional predicate would determine whether to apply
> the identity. For example, to apply the identity only
> if the negation of the first argument to pochhammer is
> a mapatom, use
>
> (%i1) applyident(pochhammer_reflect, pochhammer(x,n) * pochhammer(-x,n),
>       lambda([e], mapatom(-first(e))));
> (%o1) pochhammer((-1)^n * pochhammer(x,n) * pochhammer(x-n+1,n))

At present rules can be defined (by defrule) to make use of
predicates via matchdeclare. If you want the predicate to come
into play, you apply the rule which was defined with the predicate.
So I don't see what additional functionality is gained here.

 > Querying the database might work something like:
>
> (%i1) findidentity(reflection);
> (%o1) [bessel_reflect, pochhammer_reflect, trigreflect]

Or, just display the list of rules.

> (%i2) describe_identity(pochhammer_reflect);
> (%o2) pochhammer = lambda([x,n], (-1)^n * pochhammer(-x -n + 1,n));

Isn't that what disprule does?

Maybe I'm not understanding what is proposed here,
but for the most part it appears to be covered by existing functions.

All the best,
Robert