kill(all)$

maxima  hamiltonian function ,version 1.0,part 2
peter.vlasschaert@gmail.com,29/03/2020

load : packages
============

load(lrats)$

system
=====
f:x
g:sin(x)-y

p1a:'diff(x,t)=x;
p1b:'diff(y,t)=sin(x)-y;

check : ∂f/∂x = -∂g/∂y
================
see: part 1:p10c1

→ constraint

p2a:f(x,y) =rhs(p1a);
p2a1:diff(p2a,x);
p2b:g(x,y) =rhs(p1b);
p2b1:diff(p2b,y)*(-1);

→ check

is(rhs(p2a1)=rhs(p2b1));

system :
======

a) 'diff(H(x,y),x,1) =- g(x,y)
b) 'diff(H(x,y),y,1) = f(x,y)

p3a:'diff(H(x,y),x,1) =- g(x,y);
p3b:'diff(H(x,y),y,1) = f(x,y);

p3a1:subst([p2a,p2b],p3a);
p3b1:subst([p2a,p2b],p3b);

simple :solve p3b1;
==============

p3b2:integrate(p3b1,y);

p3b2a:[%c1=h(x)];
p3b2b:subst(p3b2a,p3b2);

simple : p3a1
==========

p3a2a:diff(p3b2b,x);

relation between : p3a1 @ p3a2a

p3a2b:p3a1-p3a2a;

1e) solve ,'diff(h(x),x)

p3a2c:solve(p3a2b,'diff(h(x),x))[1];

2e) integrate,x

p3a2d:integrate(p3a2c,x);

  final :system
===========
use :p3b2b

p4a:subst([p3a2d],p3b2b);

check:use 'p3a,p3b'
-------------------------

p5a:diff(p4a,x);

same as: p3a

p5b:diff(p4a,y);

same as:p3b