1% KdV equation: local Hamiltonian operators, verification of skew-adjointness 2% and computation of Schouten bracket 3% 2015-10-08 4% Raffaele Vitolo 5 6load_package cde; 7 8% Initialization of the jet environment of the differential equation. 9indep_var:={x,t}$ 10dep_var:={u}$ 11odd_var:={p}$ 12total_order:=10$ 13% names for output of the state of cde and results of computations 14statename:="kdv_ho3_state.red"$ 15resname:="kdv_ho3_res.red"$ 16 17% Initialization of the differential equation. 18% The system must be in passive orthonomic form; 19% this also means that there will be no nontrivial integrability conditions 20% between parametric derivatives. 21 22% left-hand side of the differential equation 23principal_der:={u_t}$ 24% right-hand side of the differential equation 25de:={u*u_x+u_3x}$ 26 27% same construction for odd coordinates 28principal_odd:={p_t}$ 29de_odd:={u*p_x+p_3x}$ 30 31% Calling cde's main routine 32cde({indep_var,dep_var,odd_var,total_order}, 33 {principal_der,de,principal_odd,de_odd})$ 34% Saving cde state in a file 35save_cde_state(statename)$ 36 37% Define the two Hamiltonian operators for KdV 38mk_cdiffop(ham1,1,{1},1); 39for all psi1 let ham1(1,1,psi1)=td(psi1,x); 40mk_cdiffop(ham2,1,{1},1); 41for all psi2 let ham2(1,1,psi2)=(1/3)*u_x*psi2 + td(psi2,x,3) 42 + (2/3)*u*td(psi2,x); 43% Note: one could equivalently load the operators as superfunctions 44% and convert them to operators. 45 46% Convert the two Hamiltonian operators to superfunctions: 47conv_cdiff2superfun(ham1,sym1); 48conv_cdiff2superfun(ham2,sym2); 49 50% Computes the adjoint and verify skew-adjointness: 51adjoint_cdiffop(ham1,ham1_star); 52adjoint_cdiffop(ham2,ham2_star); 53ham1_star_sf(1)+sym1(1); 54ham2_star_sf(1)+sym2(1); 55 56% The last two commands must return 0. 57 58% Defines the previously computed Hamiltonian operators, 59% the user may check that they are the same as sym1(1) and sym2(1) 60sym1_odd := {p_x}; 61sym2_odd := {(1/3)*p*u_x + p_3x + (2/3)*p_x*u}; 62 63% Converts the two operators to bivectors 64conv_genfun2biv(sym1,biv1); 65conv_genfun2biv(sym2,biv2); 66 67% Check the expressions of the bivectors 68biv1(1); 69biv2(1); 70 71% Computes variational derivatives 72pvar_df(0,biv1(1),u); 73pvar_df(1,biv1(1),p); 74pvar_df(0,biv2(1),u); 75pvar_df(1,biv2(1),p); 76 77% Computes the Schouten bracket of the operators; 78schouten_bracket(biv1,biv1,thr11); 79thr11(1); 80schouten_bracket(biv1,biv2,thr12); 81thr12(1); 82schouten_bracket(biv2,biv2,thr22); 83thr22(1); 84 85% Check if the above third nonzero bracket expression is 86% zero in cohomology, i.e., is a total divergence 87euler_df(thr22(1)); 88 89% Computes the Schouten bracket followed by the Euler operator 90% to check if the expression is a total divergence; 91% returns the list of even and odd variational derivatives. 92iszero_schouten_bracket(biv1,biv1,thr11b); 93iszero_schouten_bracket(biv1,biv2,thr12b); 94iszero_schouten_bracket(biv2,biv2,thr22b); 95 96% Here we write results of the computation in a file. 97 98off nat$ 99off echo$ 100out <<resname>>$ 101write "thr11:=",thr11; 102write "thr12:=",thr12; 103write "thr22:=",thr22; 104write ";end;"; 105shut <<resname>>$ 106on echo$ 107on nat$ 108 109;end; 110 111