Re: Problem with ->
- To: mathgroup@smc.vnet.net
- Subject: [mg11520] Re: Problem with ->
- From: Paul Abbott <paul@physics.uwa.edu.au>
- Date: Fri, 13 Mar 1998 12:22:09 -0500
- Organization: University of Western Australia
- References: <6dv2lm$5dl@smc.vnet.net>
Hans Steffani wrote: > I want to substitute R[s] by k s. > I tried: > R[s] / R'[s] /. R[s] -> k s > and got > k s / R'[s] > instead of the expected > s Another solution, avoiding pure functions, and working for derivatives to any order, is to use pattern-matching: In[1]:= R[s]/R'[s]/.{R[s] -> k s, Derivative[n_][R][s] :> D[k s, {s, n}]} Out[1]= s Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul@physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________