Re: Ask Mathematica to sub for a long expression

*To*: mathgroup at smc.vnet.net*Subject*: [mg71921] Re: Ask Mathematica to sub for a long expression*From*: carlos at colorado.edu*Date*: Mon, 4 Dec 2006 06:38:47 -0500 (EST)*References*: <ekp4o4$2fq$1@smc.vnet.net><ekudat$86k$1@smc.vnet.net>

aaronfude at gmail.com wrote: > Hi, > > Thanks for all the responses. It doesn't quite work for me, but maybe > with a little extra expertise it will. The problem is that that pattern > is not always obvious w/o extra algebra. The basic problem is > summarized in the fact that the following doesn't work the way I'd like > it to: > > -a-b/.a+b->c > > 2a+2b/.a+b->c > > Many thanks in advance! > > Aaron Fude Replacing nontrivial patterns sometimes works, sometimes it doesnt. It may depends on FullForm details. This violates a basic tenet of computer science: user-level results should not depend on internal representation. Here is a simple example. ClearAll[f,a,b,c,i]; f[b_,c_]:=1/(c+b^2); v=Table[{i,f[b,i]/.b^2->16},{i,-6,6}]; ListPlot[v,PlotJoined->True]; Try to track the source of the error message and the plot gap.

**Follow-Ups**:**Re: Re: Ask Mathematica to sub for a long expression***From:*Andrzej Kozlowski <akoz@mimuw.edu.pl>

**Re: Re: Ask Mathematica to sub for a long expression***From:*Daniel Lichtblau <danl@wolfram.com>