# Building a symbolic Hessian function with ModelingToolkit.jl

**URL:** <https://discourse.julialang.org/t/building-a-symbolic-hessian-function-with-modelingtoolkit-jl/74746>\
**Category:** General Usage\
**Tags:** question, modelingtoolkit\
**Created:** [January 17, 2022, 9:46am UTC](https://discourse.julialang.org/t/building-a-symbolic-hessian-function-with-modelingtoolkit-jl/74746 "2022-01-17T09:46:00Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![adeyemiadeoye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adeyemiadeoye/32/32475_2.png) [@adeyemiadeoye](https://discourse.julialang.org/u/adeyemiadeoye)\
**Post date:** [January 17, 2022, 10:58pm UTC](https://discourse.julialang.org/t/building-a-symbolic-hessian-function-with-modelingtoolkit-jl/74746/8 "2022-01-17T22:58:41Z")

</div>

(EDIT) Oops… Yes! Constrained [OptimizationSystem](https://mtk.sciml.ai/stable/systems/OptimizationSystem/).  
The goal is to find an effective way to compute the Lagrangian Hessian (preferably symbolically store it as this is a large system).

A very similar description of the problem would be [this post](https://discourse.julialang.org/t/evaluating-the-hessian-of-the-lagrangian-efficiently/54659). I think the original poster settled with their approach (which works but may not be very efficient). For a system with a large number of parameters, I would prefer to store this Hessian symbolically in a function and provide the Lagrange multiplier (and other parameters) each time we call the function. This is what I attempt doing with `ModelingToolkit.jl`.

---

_[View the full topic](https://discourse.julialang.org/t/building-a-symbolic-hessian-function-with-modelingtoolkit-jl/74746)._
