I am trying to create a small function to determine the Hamiltonian flow when entering the functions that make up the Hamiltonian. For instance. I would like to identify
function makeThedH(f::Function,g::Function)
dH1(s,u) = cos(u[3]).*f(u[1],u[2]);
dH2(s,u) = sin(u[3]).*f(u[1],u[2]);
dH3(s,u) = dot( [1,2] , g(u[1],u[2]) ).*f(u[1],u[2]).^0.5 ;
dH4(s,u) = dot( [1,2] , g(u[1],u[2]) );
dH(s,u) = [dH1(s,u), dH2(s,u), dH3(s,u),dH4(s,u)];
return dH;
end
to give a dH function that I could use in an ODE solver. (Forget whether this system or something else is correctly defined).
No documentation seems to be found for functions that output other functions like this. Thanks for the help ~
Edit: it returns dH, but I cannot use it as a regular function, for example. dH (1, [1,2,3,4]) just returns an object (I think?) dH, but does not evaluate anything.
Edit: Thank you for helping me understand that I should introduce input types, that I would like f, g to be function descriptors.