Using substitution rules to define a function
- To: mathgroup at yoda.physics.unc.edu
- Subject: Using substitution rules to define a function
- From: Jean.Peccoud at imag.fr (Jean Peccoud)
- Date: Mon, 28 Mar 1994 16:33:11 +0200
Dear Mathgroup, could anybody explain me what happens here ? Sol is a solution of an equation In[32]:= sol Out[32]= 2 2 2 a + b w + Sqrt[b] w Sqrt[4 a + b w ] {{x -> ---------------------------------------}, 2 2 2 2 a + b w - Sqrt[b] w Sqrt[4 a + b w ] {x -> ---------------------------------------}} 2 Here I want to define a function of w which returns the first solution. In[34]:= invf1[w_]:=sol[[1,1,2]] invf1[x] Out[34]= 2 2 2 a + b w + Sqrt[b] w Sqrt[4 a + b w ] --------------------------------------- 2 but when I want to compute the value of this function for x, w remains. There must be a basic trick that I did not undestand well in using rules or patterns. Thank you. ----------------------------------- Jean Peccoud TIMC-IMAG Faculte de medecine de Grenoble F-38700 La Tronche France tel : (33) 76 63 71 85 fax : (33) 76 51 86 67 E-mail : Jean.Peccoud at imag.fr