# Implementing the log-sum-exp function

**URL:** <https://discourse.julialang.org/t/implementing-the-log-sum-exp-function/122946>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [November 22, 2024, 10:31am UTC](https://discourse.julialang.org/t/implementing-the-log-sum-exp-function/122946 "2024-11-22T10:31:16Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [November 22, 2024, 3:28pm UTC](https://discourse.julialang.org/t/implementing-the-log-sum-exp-function/122946/8 "2024-11-22T15:28:41Z")

</div>

What Convex.jl does is reformulate `logsumexp` as a conic programming problem, where you add a constraint that a particular expression belongs to an exponential cone. This is in some ways quite different to a rewriting of the formula, because with this approach, the solver does not execute the function you wrote, but rather receives an algebraic formulation of the problem (not e.g. a function pointer). To do a conic reformulation of logsumexp in JuMP, see: [How to implment `logsumexp` function in JuMP? - #2 by odow](https://discourse.julialang.org/t/how-to-implment-logsumexp-function-in-jump/84376/2)

Your solver needs to be able to handle exponential cones for this approach to work (both for Convex.jl and for JuMP.jl). I’m not sure if many nonlinear solvers can handle conic constraints, and I don’t think Ipopt can. So this approach unfortunately probably is not suitable.

---

_[View the full topic](https://discourse.julialang.org/t/implementing-the-log-sum-exp-function/122946)._
