Re: Using substitution rules to define a function
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: Using substitution rules to define a function
- From: keiper (Jerry Keiper)
- Date: Thu, 31 Mar 1994 09:10:55 -0600
> invf1[w_]:=sol[[1,1,2]] When you type invf1[x] every occurance of "w" in the RHS (sol[[1,1,2]]) is replaced by "x" and then the result is evaluated. Because sol[[1,1,2]] has no "w" in it nothing is replaced. What you want to do is define invf1[ ] using invf1[w_] = sol[[1,1,2]] When you use Set[ ] ( = ) rather than SetDelayed[ ] ( := ) the RHS gets evaluated before the rule is formed so the rule becomes invf1[w_] = 2 2 2 a + b w + Sqrt[b] w Sqrt[4 a + b w ] --------------------------------------- 2 rather than simply invf1[w_]:=sol[[1,1,2]] Jerry B. Keiper