%First integrals of the Toda lattice; %Program name: hamin.our; linelength 72; off nat$ out haminl$ operator h, q, p, qt, pt; depend h, q(j), p(j); %This is the Hamilton function; H := (p(1)^2 + p(2)^2 + p(3)^2)/2 + E^(q(1)-q(2)) + E^(q(2)-q(3)) + E^(q(3)-q(1)); for j := 1:3 do <>; %Examle 1: Ansatz for a first integral; I1 := p(1) + p(2) + p(3); R1 := for l := 1:3 sum (pt(l)*df(I1,p(l)) + qt(l)*df(I1,q(l))); If R1=0 then write "I1 is a first integral" else write "I1 is not a first integral"; %Example 2: Ansatz for a first integral; I2 := p(1)*p(2)*p(3) - p(1)*E^(q(2)-q(3)) - p(2)*E^(q(3)-q(1)) -p(3)*E^(q(1)-q(2)); R2 := for l := 1:3 sum (pt(l)*df(I2,p(l)) + qt(l)*df(I2,q(l))); If R2=0 then write "I2 is a first integral" else write "I2 is not a first integral"; write ";end"$ shut haminl$ on nat$