# [Maxima] matchdeclare syntax

Edwin Woollett woollett at charter.net
Mon Feb 4 15:26:28 CST 2008

```Stavros Macrakis wrote:
>The reason the examples above work is because these transformations
>(simplifications) are already performed by default in >Maxima:
------------
I really missed a step in not trying out Maxima's automatic simplification
rules first. I am trying to clear Mathematica
syntax fog out of my brain. After teaching classes using Mathematica for
years, I have a pile of textbooks related to
Mathematica. As a way to learn to "think Maxima", I look for problems solved
the Mma way and say "how could I do
that with Maxima??"   I clearly need a personal 24 hour delay rule before I
appeal for help; I actually realised that I should
have checked the default Maxima behavior about 15 minutes after I sent that
message, but was taking an afternoon nap
with my wife, and told myself: take the nap!
-------------
>Actually, integerp isn't doing anything different:
>
>       tellsimp(f(q),0)\$
>       f(m) => f(m)
>       but  f(2) => 0
--------------------------
So I was still left with the issue: how to get Maxima to use integer
information in rules for both literal and
symbolic cases.
---------------------------
Barton Willis  wrote:
>Try something like:
>
>(%i1) matchdeclare(q, lambda([x], featurep(x, 'integer)))\$
>(%i2) tellsimp(fff(q*%pi), (-1)^q)\$
--------------------------------------------------
This seems to solve the general integer problem:

(%i1) pred1(x) := featurep(x, 'integer)\$
(%i2) matchdeclare(q,pred1)\$
(%i3) tellsimp( f(q), 0 )\$
(%i4) [f(2),f(m)];
(%o4)                              [0, f(m)]
(%i5) declare(m, integer )\$
(%i6) [f(2),f(m)];
(%o6)                               [0, 0]

-----------------------
thanks for the help.
Ted Woollett

```