Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2008

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

Search the Archive

Adjoint Frechet Derivative in Mathematica

  • To: mathgroup at
  • Subject: [mg91239] Adjoint Frechet Derivative in Mathematica
  • From: "Euler@DAMTP" <anthony_ashton1 at>
  • Date: Mon, 11 Aug 2008 06:05:43 -0400 (EDT)

Hi all,

I'm currently trying to implement some code to compute the Frechet derivative, and the associated adjoint, of a system of PDEs. To find the Frechet derivative, I've been using:

FrechetD[support_List, dependVar_List,
  independVar_List, testfunction_List] :=
  Block[{indep, frechet, deriv, \[Epsilon], r0, x1, x2},
  r0 = Function[indep, x1 + \[Epsilon] x2];
  frechet = {}; Do[deriv = {};
   Do[AppendTo[deriv, \!\(
\*SubscriptBox[\(\[PartialD]\), \(\[Epsilon]\)]\ \((support[[
          j]] /. \[IndentingNewLine]dependVar[[
           i]] -> \((r0 /. \[IndentingNewLine]{indep -> 
              independVar, \[IndentingNewLine]x1 -> 
              dependVar[[i]] @@ independVar, \[IndentingNewLine]x2 -> 
              testfunction[[i]] @@ 
               independVar})\))\)\) /. \[Epsilon] -> 0],
    {i, 1, Length[support]}];
   AppendTo[frechet, deriv],
   {j, 1, Length[support]}];

This works an absolute charm. Then to compute the associated adjoint equation, I use:

AdjointFrechetD[support_List, dependVar_List,
  independVar_List, testfunction_List] := 
 Block[{subrule, $testf, frechet, n, b},
  subrule = b_. ($testf^(n__)) @@ independVar :>
    (-1)^Plus @@ {n} \!\(
\*SubscriptBox[\(\[PartialD]\), \(Delete[Thread[{independVar, {n}}], 
        0]\)]\((b\ $testf @@ independVar)\)\);
  frechet = FrechetD[support, dependVar,
    independVar , testfunction];
  Do[frechet = 
    frechet /.
     (subrule /. $testf -> testfunction[[i]]),
   {i, 1, Length[testfunction]}];
  frechet = Transpose[frechet]]

This doesn't work, sadly. All it seems to do is give me the transpose of the original Frechet derivative matrix. The code originally came from a book I've been looking at, so it can't be too far wrong. Sadly, my mathematica skills aren't good enough to spot why it's going wrong. If anyone could help if would be much appreciated!


  • Prev by Date: Re: Printing and Exporting graphics images from Mathematica 6 to
  • Next by Date: Re: Help with StyleSheets
  • Previous by thread: Re: Printing and Exporting graphics images from Mathematica 6 to
  • Next by thread: Re: Adjoint Frechet Derivative in Mathematica