# How to define and integrate a HamiltonianProblem?

**URL:** <https://discourse.julialang.org/t/how-to-define-and-integrate-a-hamiltonianproblem/81303>\
**Category:** General Usage\
**Tags:** package, diffeq, forwarddiff\
**Created:** [May 19, 2022, 9:07am UTC](https://discourse.julialang.org/t/how-to-define-and-integrate-a-hamiltonianproblem/81303 "2022-05-19T09:07:55Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![cdawg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdawg/32/9811_2.png) [@cdawg](https://discourse.julialang.org/u/cdawg)\
**Post date:** [May 21, 2022, 6:51pm UTC](https://discourse.julialang.org/t/how-to-define-and-integrate-a-hamiltonianproblem/81303/6 "2022-05-21T18:51:49Z")

</div>

very cool. @genkuroki. just read your post about the [**Problem-Algorithm-Solver pattern**](https://discourse.julialang.org/t/function-depending-on-the-global-variable-inside-module/64322/10) As someone who never uses globals, or modules outside of the parent source file in a package, I am amazed at your awareness and control of Julia scope.

However, I wonder if there is an irremovable disadvantage to your pattern in the case where you want to have multiple actors acting in parallel, each with different state, each changing this potential parameter 😅. I think I need this “update(state, action) → state” mapping as a closed, stateless function.

Sadly for my use case, the transparency of a hard coded Euler solver may ultimately be unbeatable here. 😶 But I still learned a lot and hope this post will be helpful for HamiltonianProblem users in the future. Thanks very much!

---

_[View the full topic](https://discourse.julialang.org/t/how-to-define-and-integrate-a-hamiltonianproblem/81303)._
