Re: Re: Ask Mathematica to sub for a long expression
- To: mathgroup at smc.vnet.net
- Subject: [mg71953] Re: [mg71921] Re: Ask Mathematica to sub for a long expression
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Tue, 5 Dec 2006 06:04:58 -0500 (EST)
- References: <ekp4o4$2fq$1@smc.vnet.net><ekudat$86k$1@smc.vnet.net> <200612041138.GAA02860@smc.vnet.net>
carlos at colorado.edu wrote:
> 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.
Rule-of-thumb tenets, basic or otherwise, yield to inviolable
restrictions. An example of the latter is that syntactic pattern
matching conforms to representation.
Daniel Lichtblau
Wolfram Research
- References:
- Re: Ask Mathematica to sub for a long expression
- From: carlos@colorado.edu
- Re: Ask Mathematica to sub for a long expression