MathGroup Archive 2001

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

Search the Archive

Re: simple Problem: D[ ]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27353] Re: simple Problem: D[ ]
  • From: "Peter Meulbroek" <meulbroek at wag.caltech.edu>
  • Date: Wed, 21 Feb 2001 03:17:59 -0500 (EST)
  • Organization: California Institute of Technology, Pasadena
  • References: <96t91a$pqt@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

BTW:  I get different results from my calculations.
In[9]:=j[x] = x^2
Out[9]=\!\(x\^2\)
In[12]:=
abv = D[j[x], x]
Out[12]=2 x


probably best to use a pattern in the definition of the function.  If you
want to define a function f that takes one argument, try
f[x_] = x^2, or
f[x_] := x^2

the first is set; it replaces the pattern f[x], where x is just about
anything, with x^2.  The second is setdelayed;  it doesn't evaluate
immediately.  To understand the difference;
f[x_] = x^2
g[x_] = D[f[x], x]
g[x_] will have the value of 2 x

The derivative is calculated, and the results are inserted into the symbol
g.  This works well most situations.  For example, g[2 + y] will be 2*(2+y)

In the setdelayed case,
h[x_] := x^2
k[x_] := D[h[x], x]

k[2+y] will give an error, since the x in the derivative in the definition
of k evaluates to 2+y, and D[(2+y)^2, 2+y] is a syntaxt error.  In summary,
the symbol k  is set to the UNEVALUATED expression D[].  This is useful in
some contexts, not in others.


"Christian Maier" <maier1 at sbox.tu-graz.ac.at> wrote in message
news:96t91a$pqt at smc.vnet.net...
>
> 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?
> Thank aou in advance!
>
> Christian Maier
>
>
>




  • Prev by Date: Re: UnitStep[] Problem.
  • Next by Date: Re: ParallelMap inefficient?
  • Previous by thread: Re: simple Problem: D[ ]
  • Next by thread: chaos-to -order transform