Jacobian of a function

Asked by Sander Rhebergen

I am trying to write my own Newton type solver in Fenics. I was wondering if there is a function in FEniCS that computes the Jacobian of a function? For example, let's say my function F(u) is defined as:

def F(u):
     return u[i].dx(j) * u[j]*dx(i)

and I want to compute J[k] * u[k], where J = DF/Du. Is there an function that can compute J for me? Something like diff or derivative?

Question information

Language:
English Edit question
Status:
Solved
For:
FEniCS Project Edit question
Assignee:
No assignee Edit question
Solved by:
Anders Logg
Solved:
Last query:
Last reply:
Revision history for this message
Best Anders Logg (logg) said :
#1

On Thu, Sep 13, 2012 at 08:41:23PM -0000, Sander Rhebergen wrote:
> New question #208515 on FEniCS Project:
> https://answers.launchpad.net/fenics/+question/208515
>
> I am trying to write my own Newton type solver in Fenics. I was wondering if there is a function in FEniCS that computes the Jacobian of a function? For example, let's say my function F(u) is defined as:
>
> def F(u):
> return u[i].dx(j) * u[j]*dx(i)
>
> and I want to compute J[k] * u[k], where J = DF/Du. Is there an function that can compute J for me? Something like diff or derivative?

Yes!

And it's called 'diff' or 'derivative' depending on what you want to
use it for. :-)

Check the FEniCS book (download from fenicsproject.org/book) for more
information.

--
Anders

Revision history for this message
Sander Rhebergen (sanderrhebergen) said :
#2

Thanks Anders Logg, that solved my question.

Revision history for this message
Sander Rhebergen (sanderrhebergen) said :
#3

Thanks, yes, it was derivative that I needed to use. I see how it works now :)