From: Richard F. <fa...@gm...> - 2025-10-02 16:08:16
|
The way tellsimp and tellsimpafter work is they put additional simplifications on particular symbols. (In lisp-speak, they put the additional rules as part of a program on the property list of atoms.) You could do something like tellsimp( a =. b , ....) in which case the rule would be put on the atom $=. in the system. But as the system points out, it won't work if you are being too coy about what you are simplifying. as tellsimp(vague_operator_Ill_tell_you_later(a,b,c) ....); defrule might help, or you could just cut to the chase and write allequal(a,b,c,d) or perhaps list_of_equals( [a,b,c,d]). Rjf On Thu, Oct 2, 2025 at 8:53 AM Leo Butler <Leo...@um...> wrote: > Hello, > > Aren't you over-thinking this? > > All you are doing is playing with a list and extracting sub-lists. I > don't see why you need to involve the simplifier or pattern matching. > Or even define =. as an nary operator. Why not just use `eq' as the op? > > Best regards, > Leo > > On Thu, Oct 02 2025, Eduardo Ochs <edu...@gm...> wrote: > > > Hi list, > > > > is is possible to use tellsimpafter to define the action of [n] on > > objects of the form expression_with_a_certain_op[n]? In case of "no", > > what is the workaround? Here's what I was trying... I defined an n-ary > > equality operator, "=.", and I was playing with ways of extracting the > > subexpressions and sub-equalities of objects like "a=.b=.c=.d=.e": > > > > has_op_1(e) := if not atom(e) then not subvarp(e); > > has_op_2(e,o) := if has_op_1(e) then is(op(e)=o); > > eqdotp (e) := has_op_2(e,"=."); > > matchdeclare (_eqdot,eqdotp); > > matchdeclare ([_a,_b,_n],all); > > matchdeclare (_n,all); > > tellsimpafter (subexpr(_eqdot,_n), args(_eqdot)[_n]); > > nary("=."); > > eqdot_subexpr(e,n) := args(e)[n]; > > eqdot_subeq (e,n) := args(e)[n] = args(e)[n+1]; > > > > oo : a=.b=.c=.d=.e; > > [op(oo), args(oo)]; /* [=., [a, b, c, d, e]] */ > > eqdot_subexpr(oo,2); /* b */ > > eqdot_subexpr(oo,3); /* c */ > > eqdot_subeq (oo,2); /* b = c */ > > subexpr (oo,2); /* b */ > > > > tellsimpafter (_eqdot[_n], args(_eqdot)[_n]); /* error */ > > > > The error is: > > > > tellsimpafter: main operator of pattern must not be match variable; > > found: _eqdot > > > > Thanks in advance! > > Eduardo Ochs > > https://anggtwu.net/eev-maxima.html > > > > _______________________________________________ > > Maxima-discuss mailing list > > Max...@li... > > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > > > > -- > --- > Best regards, > Dr Butler > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |