Function Repository Resource:

# DVectorField

Generate the tensor associated with the nth derivative of a vector field at a point

Contributed by: E. Chan-López, Víctor Castellanos, Héctor Argote Morales & Sjoerd Smit
 ResourceFunction["DVectorField"][f,vars,p,n] gives the tensor corresponding to the nth derivative of a vector field f with respect to variables vars at a given point p.

## Details

ResourceFunction["DVectorField"][f,vars, p, n] is a useful tool for computing the tensors associated with the Taylor approximations used in local bifurcation theory for nonlinear ordinary differential equations or nonlinear maps.
DvectorField[f,vars, p, n,"MultilinearFunction"] can be used to obtain multilinear functions associated with the tensors of each Taylor approximation.
DvectorField[f,vars, p, n,"MultilinearFunction"] generates new indexed symbols, such as x1, from the variables of the vector field , so once generated, preassigning values to these symbols should be avoided. These indexed symbols allow multilinear functions to be easily evaluated in calculations where they are required.
DvectorField[f,vars, p, n,"PureMultilinearFunction"] can be used to obtain multilinear functions associated with the tensors of each Taylor approximation using pure functions.
In typical usage, p will be an equilibrium point of the dynamical system f.

## Examples

### Basic Examples (2)

Use DVectorField with a 2D vector field:

 In[1]:=
 Out[1]=

Use DVectorField with a 3D vector field:

 In[2]:=
 Out[2]=

### Scope (3)

Use DVectorField with the Lorenz system to compute some multilinear functions:

 In[3]:=
 Out[6]=

Equilibrium points:

 In[7]:=
 Out[11]=

Linear and bilinear functions for Lorenz system at the above equilibrium points:

 In[12]:=
 Out[12]=
 In[13]:=
 Out[13]=

### Applications (37)

#### Hopf bifurcation analysis and first Lyapunov coefficient (3)

Compute the first Lyapunov coefficient for the Brusselator system:

 In[14]:=
 In[15]:=
 Out[18]=

The equilibrium point:

 In[19]:=
 In[20]:=
 Out[21]=

Assume α>0 fixed and take β as a bifurcation parameter to show that the system exhibits a supercritical Hopf bifurcation at X0(α, β=β0), where β0=1+α2.

The Jacobian matrix and its transpose:

 In[22]:=
 Out[23]=
 In[24]:=
 Out[25]=

Analyse the local stability with the resource function BialternateSum, with β as control parameter:

 In[26]:=
 Out[26]=

The critical value of the Hopf bifurcation:

 In[27]:=
 Out[27]=

Then, the Brusselator system is locally asymptotically stable at X0(μ) for β<β0 and locally asymptotically unstable for β>β0 (appears a stable limit cycle surrounded the unstable equilibrium point). We verify the previous conclusion by the transversality condition:

 In[28]:=
 Out[28]=

The non-trivial equilibrium point at β=β0:

 In[29]:=
 Out[30]=

Shift the non-trivial equilibrium point to the origin:

 In[31]:=
 Out[33]=

Verify that indeed the non-trivial equilibrium was shifted to the origin:

 In[34]:=
 Out[34]=

The Jacobian matrix in the new state variables:

 In[35]:=
 In[36]:=
 Out[37]=

The linear approximation at the origin and its transpose at β=1+α2 and α=ω:

 In[38]:=
 In[39]:=
 In[40]:=
 Out[41]=
 In[42]:=
 Out[43]=
 In[44]:=
 Out[44]=

The critical eigenvectors q, , p, :

 In[45]:=
 Out[49]=

The normalization 〈pn,q〉=1

 In[50]:=
 Out[50]=
 In[51]:=
 Out[52]=
 In[53]:=
 Out[53]=
 In[54]:=
 Out[54]=

The third-order Taylor approximation for the polynomial system

Linear function:

 In[55]:=
 Out[56]=

Bilinear function:

 In[57]:=
 Out[58]=

Trilinear function:

 In[59]:=
 Out[60]=

Verify that the Taylor series expansion of the Brusselator system is correct:

 In[61]:=
 Out[61]=

The first Lyapunov coefficient is given by:

where

and h20, h11 are given by

h20=(2 ⅈω 𝕀2×2-AA)-1BB(q,q), h11=-AA-1BB(q,q)

First, compute h20, h11 and C1 as follows:

 In[62]:=
 Out[63]=
 In[64]:=
 Out[65]=
 In[66]:=
 Out[66]=

Finally, compute the first Lyapunov coefficient:

 In[67]:=
 In[68]:=
 Out[68]=
 In[69]:=
 Out[69]=

The first Lyapunov coefficient is clearly negative for all positive α. Thus, the Hopf bifurcation is nondegenerate and always supercritical.

Compute the first Lyapunov coefficient for the following predator-prey system:

 In[70]:=
 In[71]:=
 Out[74]=

The orbitally equivalent polynomial system:

 In[75]:=
 Out[76]=

The Jacobian matrix for the orbitally equivalent polynomial system:

 In[77]:=
 In[78]:=
 Out[79]=

The non-trivial equilibrium point:

 In[80]:=
 In[81]:=
 Out[82]=

The linear approximation at X0(μ):

 In[83]:=
 In[84]:=
 Out[85]=

Analyse the local stability with the resource function BialternateSum, with α as control parameter:

 In[86]:=
 Out[86]=

The critical value of the Hopf bifurcation:

 In[87]:=
 Out[87]=

Then, the system is locally asymptotically stable for α>α0 and locally asymptotically unstable for α<α0 (with c>d), and can be confirmed by the transversality condition:

 In[88]:=
 Out[88]=

The non-trivial equilibrium point at α=α0:

 In[89]:=
 Out[90]=

Shift the non-trivial equilibrium point to the origin:

 In[91]:=
 Out[92]=

Verify that indeed the non-trivial equilibrium was shifted to the origin:

 In[93]:=
 Out[93]=

The Jacobian matrix in the new state variables:

 In[94]:=
 Out[95]=

The linear approximation at the origin and at and :

 In[96]:=
 In[97]:=
 In[98]:=
 In[99]:=
 In[100]:=
 In[101]:=
 Out[89]=
 In[102]:=
 In[103]:=
 Out[104]=
 In[105]:=
 Out[105]=

The critical eigenvectors q, , p, :

 In[106]:=
 In[107]:=
 Out[111]=

The normalization 〈pn,q〉=1

 In[112]:=
 In[113]:=
 Out[113]=
 In[114]:=
 In[115]:=
 Out[116]=
 In[117]:=
 Out[117]=
 In[118]:=
 Out[118]=

The third-order Taylor approximation for the polynomial system

Linear function:

 In[119]:=
 In[120]:=
 Out[121]=

Bilinear function:

 In[122]:=
 In[123]:=
 Out[124]=

Trilinear function:

 In[125]:=
 In[126]:=
 Out[127]=

Verify that the Taylor series expansion of the polynomial system is correct:

 In[128]:=
 Out[128]=

The first Lyapunov coefficient is given by:

where

and h20, h11 are given by

h20=(2 ⅈω 𝕀2×2-AA)-1BB(q,q), h11=-AA-1BB(q,q)

First, compute h20, h11 and C1 as follows:

 In[129]:=
 In[130]:=
 Out[131]=
 In[132]:=
 In[133]:=
 Out[134]=
 In[135]:=
 In[136]:=
 Out[136]=

Finally, we compute the first Lyapunov coefficient:

 In[137]:=
 In[138]:=
 Out[138]=

Clearly, the first Lyapunov coefficient is strictly negative for all combinations of the fixed parameters. Therefore, a unique limit cycle emerges from the non-trivial equilibrium via Hopf bifurcation for α<α0.

Compute the first Lyapunov coefficient for the following nonlinear feedback-control system of Lur'e type:

 In[139]:=
 In[140]:=
 Out[143]=

For all values of (α>0,β>0), the Lur'e system has two equilibria, the origin and (1,0,0). At the origin, this system exhibits a supercritical Hopf bifurcation when α=α0, where :

 In[144]:=
 In[145]:=
 Out[146]=

The Jacobian matrix and its transpose:

 In[147]:=
 In[148]:=
 Out[149]=
 In[150]:=
 In[151]:=
 Out[152]=

Analyse the local stability with the resource function BialternateSum, with β as control parameter:

 In[153]:=
 Out[153]=

The critical value of the Hopf bifurcation:

 In[154]:=
 In[155]:=
 Out[155]=

Then, the Lur'e system is locally asymptotically stable at X0(μ) for α>α0 and locally asymptotically unstable for α<α0 (appears a stable limit cycle surrounded the unstable equilibrium point). We verify the previous conclusion by the transversality condition:

 In[156]:=
 Out[156]=

The linear approximation at the origin and its transpose at and β=ω2:

 In[157]:=
 In[158]:=
 In[159]:=
 Out[160]=
 In[161]:=
 In[162]:=
 Out[163]=
 In[164]:=
 Out[164]=

The critical eigenvectors q, , p, :

 In[165]:=
 In[166]:=
 Out[170]=

The normalization 〈pn,q〉=1

 In[171]:=
 In[172]:=
 Out[172]=
 In[173]:=
 In[174]:=
 Out[175]=
 In[176]:=
 Out[176]=
 In[177]:=
 Out[177]=

The third-order Taylor approximation for the polynomial system

Linear function:

 In[178]:=
 In[179]:=
 Out[180]=

Bilinear function:

 In[181]:=
 In[182]:=
 Out[183]=

Trilinear function:

 In[184]:=
 In[185]:=
 Out[186]=

We verify that the Taylor series expansion of the Lur'e system is correct:

 In[187]:=
 Out[187]=

The first Lyapunov coefficient is given by:

where

and h20, h11 are given by

h20=(2 ⅈω 𝕀3×3-AA)-1BB(q,q), h11=-AA-1BB(q,q)

First, compute h20, h11 and C1

 In[188]:=
 In[189]:=
 Out[190]=
 In[191]:=
 In[192]:=
 Out[193]=
 In[194]:=
 In[195]:=
 Out[195]=

Finally, compute the first Lyapunov coefficient:

 In[196]:=
 In[197]:=
 Out[197]=
 In[198]:=
 In[199]:=
 Out[199]=
 In[200]:=
 Out[200]=

The first Lyapunov coefficient is strictly negative for all positive β. Thus, the Hopf bifurcation is nondegenerate and always supercritical.

#### Neimark-Sacker bifurcation analysis and first Lyapunov coefficient (19)

The recurrence equation 𝓊k+1=𝓇 𝓊k+1(1-𝓊k-1) is simple population dynamical model, where 𝓊k depict for the density of a population at time k, and 𝓇 is a growth rate. Introducing 𝓊k=𝓊k-1, the above equation can be rewritten as

𝓊k+1=𝓇 𝓊k(1-𝓋k), 𝓋k+1= 𝓋k,

which, in turn, defines the following two-dimensional discrete-time dynamical system

Define the discrete-time dynamical system (1) as follows:

 In[201]:=
 In[202]:=
 Out[204]=

Jacobian matrix:

 In[205]:=
 In[206]:=
 Out[207]=

The non-trivial fixed point:

 In[208]:=
 In[209]:=
 Out[210]=

The linear approximation at X0(r):

 In[211]:=
 Out[212]=

The eigenvalues of the linear approximation A:

 In[213]:=
 Out[213]=

For 𝓇>5/4 the eigenvalues are complex, so the following shift is made in the growth rate 𝓇 to handle this restriction, and then the eigenvalues of A are computed again:

 In[214]:=
 In[215]:=
 Out[215]=
 In[216]:=
 Out[217]=

The value 𝓇0 where the fixed point X0(𝓇0) loses its stability, giving rise to a Neimark-Sacker bifurcation, is given by:

 In[218]:=
 Out[218]=

Therefore, the fixed point X0(𝓇0) loses its stability at 𝓇=2 as verified below:

 In[219]:=
 Out[219]=

The linear approximation A(𝓇) at the critical bifurcation value 𝓇=2 and its transpose:

 In[220]:=
 Out[221]=
 In[222]:=
 Out[223]=

The critical multipliers are given by:

 In[224]:=
 Out[224]=
 In[225]:=

The transversality condition:

 In[226]:=
 Out[226]=

The nondegeneracy condition:

ζn1, for n=1,2,3,4.

 In[227]:=
 Out[227]=

The critical eigenvectors q, , p, :

 In[228]:=
 In[229]:=
 Out[233]=

The normalization 〈pn,q〉=1

 In[234]:=
 In[235]:=
 Out[235]=
 In[236]:=
 In[237]:=
 Out[238]=
 In[239]:=
 Out[239]=
 In[240]:=
 Out[240]=
 In[241]:=
 Out[241]=

The bilinear and trilinear forms to compute the first Lyapunov coefficient:

 In[242]:=
 In[243]:=
 Out[244]=
 In[245]:=
 In[246]:=
 Out[247]=

The first Lyapunov coefficient (additional nondegeneracy condition) is given by

Finally, compute the first Lyapunov coefficient:

 In[248]:=
 Out[249]=
 In[250]:=
 Out[251]=
 In[252]:=
 Out[252]=

Therefore, a unique and stable closed invariant curve bifurcates from the non-trivial fixed point X0(𝓇) for 𝓇>2.

#### Quadratic coefficients of the normal form for Bogdanov-Takens bifurcation (15)

Compute the quadratic coefficients of the Bogdanov-Takens bifurcation normal form for a predator-prey model with non-linear predator reproduction and prey competition:

 In[253]:=
 In[254]:=
 Out[105]=

The Jacobian matrix:

 In[255]:=
 Out[59]=

Look for the Bogdanov-Takens point:

 In[256]:=
 Out[256]=

To explicitly handle constraint , apply the following shift to get the Bogdanov-Takens point:

 In[257]:=
 Out[257]=

With the above shift in the predator population, the equilibrium point of coexistence and the critical value of bifurcation are as follows:

 In[258]:=
 In[259]:=
 Out[258]=
 In[260]:=
 Out[261]=

The linear approximation at x0(ζ0):

 In[262]:=
 In[263]:=
 Out[67]=

Verify that J0(ζ0) has a pair of null eigenvalues:

 In[264]:=
 Out[264]=

The critical right eigenvectors q0 and q1:

 In[265]:=
 Out[70]=
 In[266]:=
 Out[267]=

Verify the conditions 〈J0(ζ0),q0=0 y 〈J0(ζ0),q1=q0

 In[268]:=
 Out[268]=

The transition matrix Q with the critical right eigenvectors:

 In[269]:=
 Out[75]=

The critical left eigenvectors p0 and p1:

 In[270]:=
 Out[77]=
 In[271]:=
 Out[272]=
 In[273]:=
 Out[94]=

Verify the conditions 〈J0(ζ0)T,p1=0 y 〈J0(ζ0)T,p0=p1

 In[274]:=
 Out[274]=

Finally, verify the conditions 〈q0,p0=〈q1,p1=1 y 〈q0,p1=〈q1,p0=0 and that the matrix J0(ζ0) is similar to a simple Jordan block:

 In[275]:=
 Out[275]=
 In[276]:=
 Out[276]=

The quadratic coefficients, involved in the nondegeneracy condition, can be computed in the following two ways:

 In[277]:=
 In[278]:=
 Out[112]=
 In[279]:=
 Out[279]=
 In[280]:=
 Out[280]=
 In[281]:=
 In[282]:=
 Out[283]=
 In[284]:=
 Out[284]=
 In[285]:=
 Out[285]=

The Bogdanov-Takens bifurcation in this case is non-degenerate when ζ0!=2 and the unique point of degeneracy is:

 In[286]:=
 Out[286]=

### Properties and Relations (1)

Use DVectorField with the resource function SymbolToSubscript:

 In[287]:=
 Out[287]=
 In[288]:=
 Out[288]=

### Possible Issues (3)

Using the option "MultilinearFunction", DVectorField creates new indexed and unprotected variables from the original ones. This can be problematic if the “new” variables were previously assigned, as shown below:

 In[289]:=
 In[290]:=
 Out[290]=

To handle this possible problem, it is recommended to avoid preassigning the unprotected variables generated by DVectorField. In this way, if in the previous example we clean the assigned variables, we obtain the correct trilinear function:

 In[291]:=
 In[292]:=
 Out[292]=

When we want to copy our results to LaTeX code, the"MultilinearFunction" option is very useful in combination with the resource function SymbolToSubscript, but we must always keep a strict control of the new symbols generated so as not to pre-assign values to them.

If we are not interested in copying expressions to LaTeX code and want to avoid conflicts with unprotected symbols, DVectorField has the "PureMultilinearFunction" option to work with pure functions, for example:

 In[293]:=
 Out[293]=
 In[294]:=
 Out[294]=
 In[295]:=
 Out[295]=

## Publisher

Ramón Eduardo Chan López

## Version History

• 1.0.1 – 07 November 2022
• 1.0.0 – 14 October 2022