Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: assigning functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56232] Re: [mg56204] assigning functions
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 20 Apr 2005 05:30:04 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

You don't need to define a separate function just use f'[x]

f[x_]:=x^2;

{f'[x],f'[2]}

{2 x,4}

Nonetheless, you can use Set ( = )

Clear[fprime];
fprime[x_]=D[f[x],x];

{fprime[x],fprime[2]}

{2 x,4}

or Evaluate the RHS of the SetDelayed ( := )

Clear[fprime];
fprime[x_]:=Evaluate[D[f[x],x]];

{fprime[x],fprime[2]}

{2 x,4}


Bob Hanlon

> 
> From: juejung <juejung at indiana.edu>
To: mathgroup at smc.vnet.net
> Date: 2005/04/19 Tue AM 04:55:01 EDT
> To: mathgroup at smc.vnet.net
> Subject: [mg56232] [mg56204]  assigning functions
> 
> 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
> 
> 


  • Prev by Date: Re: match 1, replace 2
  • Next by Date: Re: Integrate is driving me crazy, please help!
  • Previous by thread: Re: assigning functions
  • Next by thread: Re: assigning functions