Defining rules for Jacobi functions?



On Thu, Mar 5, 2009 at 8:59 AM, Raymond Toy <raymond.toy at stericsson.com> wrote:

> defrule(jsc, jacobi_sc(u,m), jacobi_sn(u,m)/jacobi_cn(u,m));
>
> This works great:
>
> apply1(sqrt(1+jacobi_sc(u,m)^2), jsc) ->
>
> sqrt(1+jacobi_sn(u,m)^2/jacobi_cn(u,m)^2)
>
> This doesn't work:
>
> apply1(jacobi_sc(x/b, 1-b^2/a^2), jsc) ->
>
> jacobi_sc(x/b,1-b^2/a^2)

Well, in the absence of matchdeclare declarations for u and m,
the rule only matches expressions in which u and m appear.
Maybe you want something like matchdeclare (uu, all, mm, integerp); ??
(I try to pick "uncommon" names for match variables; they are
actually bound by the pattern matching code, so if they have
some other values, those values can be obscured.)

Agreed that defrule is appropriate since you want to apply the
rule only sometimes.

HTH

Robert