# How to register functions from an array in JuMP?

**URL:** <https://discourse.julialang.org/t/how-to-register-functions-from-an-array-in-jump/6884>\
**Category:** Optimization (Mathematical)\
**Tags:** question\
**Created:** [November 4, 2017, 7:42pm UTC](https://discourse.julialang.org/t/how-to-register-functions-from-an-array-in-jump/6884 "2017-11-04T19:42:55Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [November 5, 2017, 8:28pm UTC](https://discourse.julialang.org/t/how-to-register-functions-from-an-array-in-jump/6884/4 "2017-11-05T20:28:22Z")

</div>

related:

> [@Slurping and splatting in JuMP](https://discourse.julialang.org/t/slurping-and-splatting-in-jump/6892):
>
> I need to define a function that takes a large number of arguments. I am trying to follow JuMP documentation: All arguments to user-defined functions are scalars, not vectors. To define a function which takes a large number of arguments, you may use the splatting syntax f(x…) = … So did this, but it does not work: m = JuMP.Model(solver=Ipopt.IpoptSolver()) f(x...) = x[1] + x[2] JuMP.register(m, :f, 2, f, autodiff=true) JuMP.@variable(m, x[i=1:2], start = 0.) JuMP.@NLobjective(m, :Min, f(x..…

> <https://stackoverflow.com/questions/44710900/juliajump-variable-number-of-arguments-to-function>

---

_[View the full topic](https://discourse.julialang.org/t/how-to-register-functions-from-an-array-in-jump/6884)._
