Jacobian -- Applying Outer to lists
- To: mathgroup at yoda.physics.unc.edu
- Subject: Jacobian -- Applying Outer to lists
- From: "Anthony Varghese" <avarg at s1.arc.umn.edu>
- Date: Wed, 31 Mar 93 16:46:34 CST
Netters, I am trying to construct a Newton iteration scheme for a system of several variables using Maeder's Newton.m (p. 85 of "Programming in Mathematica") as a starting point. I am running into a number of hitches having to do with the computation of the jacobian. So, here is the basic problem as I see it: I have a system of, say 3, equations that I will call "dvdt": In[1]:= dvdt = { {x^2 + y^2}, {y + 2 z^2}, {x - y^3 + z} } dvdt is a function of a system of three variables, called "v": In[2]:= v = {x, y, z} Here is where the problems start. In the single variable Newton method, Maeder denotes the dependence of dvdt on v with a pure Function: NewtonZero[expr_, x_, x0_] := NewtonZero[ Function[x, expr], x0 ] However, this does not seem to do the right thing in the case where x and expr are lists: In[3]:= f = Function[v, dvdt] Out[3]= Function[v, dvdt] In[4]:= jacf = Outer[D,f,v] Outer::heads: Heads List and Function at positions 3 and 2 are expected to be the same. Out[4]= Outer[D, Function[v, dvdt], {x, y, z}] Mma did not make the substitutions I thought it would make and therefore, the Jacobian computation could not be made. Am I missing something crucial in Function? I decided to try to cast "dvdt" explicitly in terms of the v[[i]]s: In[1]:= v = {x, y, z} Out[1]= {x, y, z} In[2]:= dvdt = {{v[[1]]^2 + v[[2]]^2},{v[[2]] + 2 v[[3]]^2}, {v[[1]]-v[[2]]^3+v[[3]]} } 2 2 2 3 Out[2]= {{x + y }, {y + 2 z }, {x - y + z}} In[3]:= f = Function[v, dvdt] Out[3]= Function[v, dvdt] In[4]:= jacf = Outer[D,f,v] Outer::heads: Heads List and Function at positions 3 and 2 are expected to be the same. Out[4]= Outer[D, Function[v, dvdt], {x, y, z}] Same thing! How can I tell Mma that dvdt is a function of a list of variables and then have it use this information to compute the Jacobian? Thanks in advance, Tony Varghese