Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1994
*January
*February
*March
*April
*May
*June
*July
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1994

[Date Index] [Thread Index] [Author Index]

Search the Archive

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





  • Prev by Date: Problem adding Text to plots
  • Next by Date: Re: Using substitution rules to define a function
  • Previous by thread: Re: Using substitution rules to define a function
  • Next by thread: Re: Using substitution rules to define a function