From: Richard Fateman on 12 Jan 2010 04:51 Is there a neat way to create a new symbol, say /!. so that expression /. BetterRules[rules] could be written as expression /!. rules I do not find writing something like (expression) ~BR~ (rules) to be quite adequate, especially with the extra parentheses. RJF
From: Jaebum Jung on 13 Jan 2010 05:56 You might want to try Notation package. In[1]:= <<Notation` In[2]:= BetterRules[x_->y_]:=x->y^2 In[3]:= Notation[x__/! y_ \[DoubleLongLeftRightArrow] ReplaceAll[x__,BetterRules[y_]]] In[4]:= (x+y)/!(x->3) Out[4]= 9+y Jaebum On 1/12/10 3:49 AM, Richard Fateman wrote: > Is there a neat way to create a new symbol, > say /!. so that > > expression /. BetterRules[rules] > > could be written as > > expression /!. rules > > I do not find writing something like > > (expression) ~BR~ (rules) > > to be quite adequate, especially with the extra parentheses. > RJF > > >
From: Chris Osborn on 14 Jan 2010 05:48 On Jan 12, 3:51 am, Richard Fateman <fate...(a)cs.berkeley.edu> wrote: > Is there a neat way to create a new symbol, > say /!. so that > > expression /. BetterRules[rules] > > could be written as > > expression /!. rules > > I do not find writing something like > > (expression) ~BR~ (rules) > > to be quite adequate, especially with the extra parentheses. > RJF Hi Richard, Yes, use the "Notation Package" (you can search for this in the docs). The actual function you will want to use is probably "InfixNotation". It's a bit weird though since you have to paste a skeleton of your call to InfixNotation from a palette, and then fill in the box asking for your operator. I haven't done this in a while, but it's all described in the docs. Chris
|
Pages: 1 Prev: restricting interpolating functions to be positive Next: Plotting a curve on a flat torus |