Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Update function def'n in terms of its old def'n' topicStudent Support Forum > General > Archives > "Update function def'n in terms of its old def'n"

Next Comment >Help | Reply To Topic
Author Comment/Response
Malingo
03/14/12 01:00am

Suppose I have an existing function defined, for example

f[x_] := x + 42

Now suppose I want to, at a later point, redefine the function f to do something slightly different. Perhaps, say, I want f to return double what it currently returns.

My first inclination is to try

f[x_] := f[x] * 2 ,

but that results in a never-ending recursive definition. How can I specify a new definition for f in terms of the *current* definition of f ?

URL: ,

Subject (listing for 'Update function def'n in terms of its old def'n')
Author Date Posted
Update function def'n in terms of its old def'n Malingo 03/14/12 01:00am
Re: Update function def'n in terms of its old d... Bill Simpson 03/14/12 4:22pm
Re: Re: Update function def'n in terms of its o... Malingo 03/21/12 01:52am
Next Comment >Help | Reply To Topic