Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Turning Derivative into Function (Newbie Question)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115473] Re: Turning Derivative into Function (Newbie Question)
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Tue, 11 Jan 2011 19:24:18 -0500 (EST)

If g is to work as a function it should have an argument, which it doesn't in your first definition.When redefining it, you should first Clear the previous definition. Then you get
In[1]:= Clear[g]In[2]:= g[x_]:=f'[x]
In[3]:= g[2]Out[3]= 4
as expected.
-Tomas
> Date: Tue, 11 Jan 2011 06:58:59 -0500
> From: forpeopleidontknow at gmail.com
> Subject: [mg115451] Turning Derivative into Function (Newbie Question)
> To: mathgroup at smc.vnet.net
>
> When I apply a function that outputs another function, how come I can not
> pass arguments to the new function? Am I missing some principle about how
> Mathematica functions work? Could someone please point me to the relevant
> documentation?
>
>
> A simple example to illustrate my confusion:
>
> In[1]: f[x_] := x^2
> In[2]: g := f'[x]
>
> So now I have:
>
> In[3]: g
> out[3]: 2x
>
> as expected
>
> So how come I get the following when trying to pass an argument to g:
>
> In[4]: g[2]
> Out[4]: 2x[2]
>
> Instead of the output I want:
>
> *Ou[4]: 4
>
>
> I tried
>
> In: g[x_] := f'[x]
>
> But it seems to think I'm trying to assign a function to Times.
> "SetDelayed::write: Tag Times in (2 x)[y_] is Protected. >>"
>
> Thank you very much for any help :)
>


  • Prev by Date: Re: Turning Derivative into Function (Newbie Question)
  • Next by Date: Re: Simple PDE with side conditions
  • Previous by thread: Re: Turning Derivative into Function (Newbie Question)
  • Next by thread: Re: Turning Derivative into Function (Newbie Question)