MathGroup Archive 2005

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

Search the Archive

Re: assigning functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56250] Re: assigning functions
  • From: Peter Pein <petsie at arcor.de>
  • Date: Wed, 20 Apr 2005 05:30:59 -0400 (EDT)
  • References: <opspforld7yw49cj@juergen> <d42kri$3du$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

juejung wrote:
> sorry, i just found the solution myself. yes, the help file is helpful ;-)
> 
> f[x_] := x^2;
> fprime[x_] = D[f[x], x]
> 
> works just fine!
> the "set delayed assignment rule" for the second part was wrong.
> 
> best
> juergen
> 
> On Mon, 18 Apr 2005 10:17:35 -0500, juejung <juejung at indiana.edu> wrote:
> 
> 
>>dear all,
>>
>>i would like to do the following.
>>assign a function:
>>f[x_] := x^2;
>>
>>take its derivate:
>>D[f[x], x]
>>
>>and assign the result of this to a new function, like fprime[x]:
>>fprime[x_] := D[f[x], x]
>>
>>unfortunately that doesn't work.
>>when i try to evaluate fprime[2] i get an error message.
>>
>>can somebody please help, this haunts me for a while now.
>>
>>thanks and all the best
>>
>>juergen
> 
Just to remind you:
In[1]:=
f[x_] := x^2;
fprime[x_] = D[f[x], x];
fprime[z]
f[x_] := x^3;
fprime[z]
Out[3]=
2*z
Out[5]=
2*z

fprime didn't recognize the change of f.

f[x_] := x^2;
fprimeDelayed[x_] := Derivative[1][f][x]
fprimeDelayed[z]
f[x_] := x^3;
fprimeDelayed[z]
Out[8]=
2*z
Out[10]=
3*z^2

this one did.

-- 
Peter Pein
Berlin


  • Prev by Date: Re: Integrating a complicated expression involving Sign[...] etc.
  • Next by Date: Re: (x-y) DiracDelta[x-y] does not simplify to 0
  • Previous by thread: Re: assigning functions
  • Next by thread: holding boxes verbatim