Re: simple Problem: D[ ]

• To: mathgroup at smc.vnet.net
• Subject: [mg27349] Re: [mg27310] simple Problem: D[ ]
• From: Tomas Garza <tgarza01 at prodigy.net.mx>
• Date: Wed, 21 Feb 2001 03:17:43 -0500 (EST)
• References: <200102200805.DAA26374@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```I see no reason why it doesn't work.

In[1]:=
f[x] = x^2;

In[2]:=
D[f[x], x]
Out[2]=
2 x

I suggest you define your f using the SetDelayed feature of Mathematica and
a pattern as formal parameter. E.g.

In[3]:=
g[x_] := x^2;

In[4]:=
D[g[x], x]
Out[4]=
2 x

This way you can use your function in a more general way. For example, you
cannot change the name of your variable with f, since Mathematica has no way
of knowing its meaning:

In[5]:=
D[f[y], y]
Out[5]=
f'[y]

whereas g can be handled normally:

In[6]:=
D[g[y], y]
Out[6]=
2 y

Tomas Garza
Mexico City

----- Original Message -----
From: "Christian Maier" <maier1 at sbox.tu-graz.ac.at>
To: mathgroup at smc.vnet.net
Subject: [mg27349] [mg27310] simple Problem: D[ ]

>
> I use mathmatica the first time and have a problem with a deriviation:
>
> in a simple problem:
>
> f[x]=x^2
> abl=D[f[x],x]
>
> then Mathematica puts out f[x]'    , but not 2 x
>
> How does it work correctly?