Maxima newb here. I need to check that an expression is of the form constant + infinite sum of trigonometric terms
Is there a good way to do this - with or without a block?
There isn't a built-in way to do exactly that, but I think you can use the pattern-matching functions (i.e., for matching expressions, not strings) for this purpose. Something like:
matchdeclare (xx, trigtermp(x));
matchdeclare (yy, freeof(x));
defrule (myrule1, xx + yy, HEY(xx, yy));
where trigtermp
is itself a pattern-matching function which matches (multiplicative factor)*(trig function). My advice is read a little about matchdeclare
, defrule
, and defmatch
in the reference manual, and maybe follow up with the Maxima mailing list (maxima-discuss@lists.sourceforge.net) as this problem probably needs some additional discussion.