# Array of @NLexpression

**URL:** <https://discourse.julialang.org/t/array-of-nlexpression/62324>\
**Category:** Optimization (Mathematical)\
**Tags:** question\
**Created:** [June 3, 2021, 8:34am UTC](https://discourse.julialang.org/t/array-of-nlexpression/62324 "2021-06-03T08:34:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![manoj.centura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manoj.centura/32/216443_2.png) [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Post date:** [June 3, 2021, 8:34am UTC](https://discourse.julialang.org/t/array-of-nlexpression/62324/1 "2021-06-03T08:34:18Z")

</div>

can we add array of nl expressions with name in macro

```julia
using JuMP
mm=Model()
for i in 1:5
       @NLexpression(mm,pp[i],i)
       end

```

ERROR: An object of name pp is already attached to this model. If this is intended, consider using the anonymous construction syntax, e.g., x = @variable(model, [1:N], …) where the name of the object does not appear inside the macro.  
Stacktrace:  
[1] error(::String) at .\error.jl:33  
[2] \_error\_if\_cannot\_register(::Model, ::Symbol) at C:\Users\manojkumar.ram.julia\packages\JuMP\YXK4e\src\macros.jl:52  
[3] top-level scope at C:\Users\manojkumar.ram.julia\packages\JuMP\YXK4e\src\macros.jl:75  
[4] top-level scope at REPL[4]:2

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [June 3, 2021, 8:43am UTC](https://discourse.julialang.org/t/array-of-nlexpression/62324/2 "2021-06-03T08:43:31Z")

</div>

```nohighlight
using JuMP
model = Model()
@NLexpression(model, pp[i=1:5], i)

```

Current documentation: [Nonlinear Modeling · JuMP](https://jump.dev/JuMP.jl/stable/manual/nlp/#Create-a-nonlinear-expression)

Issue to make better documentation: [https://github.com/jump-dev/JuMP.jl/issues/2200](https://github.com/jump-dev/JuMP.jl/issues/2200)
