On Jul 10, 10:01 pm, David Sanders <dpsand...@gmail.com> wrote: > Hi, > > Following up from a couple of my previous posts, I am now wondering > how to do symbolic pattern matching for an expression of the following > form:
Apologies for replying to my own post, but I was wondering if there's any documentation I should be reading about this stuff, rather than posting every naive question here? (Although maybe it's actually useful to post naive questions here!) Thanks, David. > > f, g = function('f g') > i = var('i') > > expr = f(i+1) g(i) > > I need to extract the "indices" i+1 and i from this expression. > > If I simplify to > > expr = f(i) > > then I still can't work out how to pattern match this. > I tried patterns > > w0 = SR.wild(0) > w1 = SR.wild(1) > > expr.match( w0(w1) ) > expr.match( w0[w1] ) > > but both give errors > > If I use > expr.operator() > > I get the response > f > > But I cannot even test the type of this, since the type of f and the > type of g are different. > > Presumably I am missing a key concept here. Any suggestions? > > Thanks and best wishes, > David. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org