MathGroup Archive 1996

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

Search the Archive

Re: A simple question?

  • To: mathgroup at
  • Subject: [mg3644] Re: A simple question?
  • From: espen.haslund at (Espen Haslund)
  • Date: Sun, 31 Mar 1996 00:51:45 -0500
  • Organization: Universitet i Oslo
  • Sender: owner-wri-mathgroup at

In article <4jd5ej$pmr at>, nader at 
;>        Hi,
;>        I guess this must be a simple question, but I can't seem to
;>find a good solution to it. For a function f[x,y] I want to create a
;>2x2x2x2 matrix called fourthDs. The elements of fourthDs will be the
;>fourth derivatives of f with respect to x and y in the following form:
;>        This simply means that the number of 1's in the index will
;>give the number of derivations with respect to x and the number of 2's
;>in the index will give the number of derivations with respect to y. In
;>this case there will be 5 different elements in fourthDs. For example,
;>the last element in the above list will be the same for
;>fourthDs[[2,1,1,1]], fourthDs[[1,1,2,1]] and so on.
;>        I wonder how I can do this in Mma. Thanks in advance for your
>        Regards, Nader Tajvidi
Hi, Nader:

This is not so elegant:

fourthDs[f_, {x_, y_}] :=
   res = Table[0, {2},{2},{2},{2}];
      res[[i,j,k,l]] = 
       D[f, {x, Length[Select[{i,j,k,l}, # == 1 &] ] },
        {y, Length[Select[{i,j,k,l}, # == 2 &] ] }],

but I hope it will do what you want. 
- Espen


  • Prev by Date: packages
  • Next by Date: Mathematica to C
  • Previous by thread: Re: A simple question?
  • Next by thread: Re: A simple question?