RE: Re: how to replace...?
- To: mathgroup@smc.vnet.net
- Subject: [mg12548] RE: [mg12460] Re: how to replace...?
- From: Ersek_Ted%PAX1A@mr.nawcad.navy.mil
- Date: Sat, 23 May 1998 18:11:11 -0400
Suppose you have (2 f[y]-f[x]+1)/(y-x), and you want to treat
(f[y]-f[x])/(y-x) as f'[x].
Then you can get the desired result using the following:
In[1]:=
soln=Eliminate[{dummy==(2 f[y]-f[x]+1)/(y-x),
f'[x]==(f[y]-f[x])/(y-x)}, {dummy}] ;
In[2]:=
expr=Part[soln,2]/.(lhs_==rhs_)->rhs-lhs;
In[3]:=
Simplify[expr]
Out[3]=
-f[x]+f[y]+(x-y)f'[x]
Ted Ersek
|
|Yacine Ait-Sahalia wrote:
|
|> What should I do to systematically replace the limit |>
|> (f[y]-f[x])/(y-x) /. y->x |
|Note that the use of a replacement rule, i.e., y->x is _not_ the same
as |taking a limit.
|
|> by f'[x], no matter what the function f is? |
|In the most trivial cases, the following pattern will work: |
|In[1]:= (g[a]-g[b])/(a-b) /. (f_[y_]- f_[x_])/(y_- x_) -> f'[y] Out[1]=
|g'[a]
|
|However, if these terms are part of a more complicated expression this
|simple pattern will not work. The best answer probably depends on the
|exact form of the expressions you are trying to simplify. |
|Cheers,
|Paul Abbott