1% Three-field hierarchy: local Hamiltonian operator 2% 2017-10-10 3% Raffaele Vitolo 4 5load_package cde; 6 7% Initialization of the jet environment of the differential equation. 8indep_var:={t,x,y}$ 9dep_var:={u,v,w}$ 10odd_var:={p,q,r}$ 11deg_indep_var:={-1,-1,-1}$ 12deg_dep_var:={1,1,1}$ 13deg_odd_var:={1,1,1}$ 14total_order:=8$ 15% names for output of the state of cde and results of computations 16statename:="tfh_ho1_state.red"$ 17resname:="tfh_ho1_res.red"$ 18 19% Initialization of the differential equation. 20 21% left-hand side of the differential equation 22principal_der:={u_t,v_t,w_t}$ 23% right-hand side of the differential equation 24de:={ u_y + 2*v_x,u*v_x + 2*w_x,u_x*w + u*w_x}$ 25 26% same constructions for odd coordinates; 27principal_odd:={p_t,q_t,r_t}$ 28de_odd:={ 29p_y - q*v_x + r_x*w, 302*p_x + q*u_x + q_x*u, 312*q_x + r_x*u}$ 32 33% Calling cde's main routine 34cde({indep_var,dep_var,odd_var,total_order}, 35 {principal_der,de,principal_odd,de_odd})$ 36 37% Solving the determining equations through dimensional analysis 38cde_grading(deg_indep_var,deg_dep_var,deg_odd_var)$ 39 40% Saving cde state in a file 41save_cde_state(statename)$ 42 43% Initialize a counter for the vector of arbitrary constants 44% and vectors of equations and constants 45ctel:=0; 46operator c,equ; 47nc:=length(dep_var); 48 49% List of variables ordered by gradings 50l_grad_mon:=der_deg_ordering(0,all_parametric_der)$ 51l_grad_odd:={1} . der_deg_ordering(1,all_parametric_odd)$ 52% List of graded monomials of scale degree <= 10 53gradmon:=graded_mon(1,5,l_grad_mon)$ 54gradmon:={1} . gradmon$ 55% list of graded monomials which are linear in odd variables 56% and have total degree from 1 to 8 57linodd:=mkalllinodd(gradmon,l_grad_odd,1,3)$ 58% Ansatz for local Hamiltonian operators 59operator phi; 60for i:=1:nc do phi(i):=(for each el in linodd sum (c(ctel:=ctel+1)*el))$ 61 62% equation for shadows of nonlocal symmetries in \ell^*-covering 63mk_superfun(ltfh_sf,1,3); 64ltfh_sf(1):=p_t - p_y - 2*q_x$ 65ltfh_sf(2):= - p*v_x + q_t - q_x*u - 2*r_x$ 66ltfh_sf(3):= - p*w_x - p_x*w - r*u_x + r_t - r_x*u$ 67conv_superfun2cdiff(ltfh_sf,ltfh); 68 69for i:=1:nc do 70equ(i):=for j:=1:nc sum ltfh(i,j,phi(j)); 71 72% This is the list of variables, to be passed to the equation solver. 73 74vars:=append(indep_var,all_parametric_der)$ 75 76% This is the number of initial equation(s) 77 78tel:=3; 79 80% This command initialize the equation solver. 81% It passes the equation(s) togeher with their number `tel', 82% the constants'vector `c', its length `ctel', 83% an arbitrary constant `f' that may appear in computations. 84 85initialize_equations(equ,tel,{},{c,ctel,0},{f,0,0}); 86 87% Run the procedures splitext and splitvars 88% in order to obtain equations on coefficiens 89% of each monomial. 90 91tel:=splitext_opequ(equ,1,3); 92 93tel2:=splitvars_opequ(equ,4,tel,vars); 94 95% Next command tells the solver the total number of equations obtained 96% after running splitvars. 97 98put_equations_used tel2; 99 100% This command solves the equations for the coefficients. 101% Note that we have to skip the initial equations! 102 103for i:=tel+1:tel2 do integrate_equation i; 104 105off nat$ 106off echo$ 107out <<resname>>; 108write "operator phi;"; 109phi(1):=phi(1); 110phi(2):=phi(2); 111phi(3):=phi(3); 112write ";end;"; 113shut <<resname>>; 114on echo$ 115on nat$ 116 117% Generate a superfunction with the Hamiltonian operator 118mk_superfun(ham1_sf,1,3); 119for i:=1:nc do 120 ham1_sf(i):=df(phi(i),c(15)); 121conv_superfun2cdiff(ham1_sf,ham1); 122adjoint_cdiffop(ham1,ham1_star); 123for i:=1:nc do if ham1_star_sf(i) + ham1_sf(i) neq 0 then 124 write "Non self-adjoint operator"; 125 126% Conversion into bivector 127conv_genfun2biv(ham1_sf,biv1); 128 129% Computes the Schouten bracket followed by the Euler operator 130% to check if the expression is a total divergence; 131% returns the list of even and odd variational derivatives. 132iszero_schouten_bracket(biv1,biv1,thr11); 133 134;end; 135 136Local Variables: 137mode:reduce 138End: