# Request: Help with NLE System - variable number of equations

**URL:** <https://discourse.julialang.org/t/request-help-with-nle-system-variable-number-of-equations/23446>\
**Category:** General Usage\
**Created:** [April 23, 2019, 2:31pm UTC](https://discourse.julialang.org/t/request-help-with-nle-system-variable-number-of-equations/23446 "2019-04-23T14:31:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ulrich](https://avatars.discourse-cdn.com/v4/letter/u/dbc845/32.png) [@Ulrich](https://discourse.julialang.org/u/Ulrich)\
**Post date:** [April 23, 2019, 2:31pm UTC](https://discourse.julialang.org/t/request-help-with-nle-system-variable-number-of-equations/23446/1 "2019-04-23T14:31:14Z")

</div>

Hello,

I am trying to write a program for the Calculation of Vapor Liquid Equilibrium by using energy and mass balances. I am currently using NLsolve.jl.  
My problem is that I want the system of equations to be created automatically. Whenever I add a new component to my mixture, I increase the number of entries in the solution vector by 2 ( 2 extra equations ).  
The first thing I am trying to do (and failing to do) is create the function for NLsolve without writing the balances into this said function.

```julia
a = :(F[1] = x[1] + x[2] -1)
b = :(F[2] = x[1]*(1-x[3]) + x[2] * (1-x[4]) - 0.5)
c = :(F[3] = getindex(K,1)*x[3] - x[4])
d = :(F[4] = getindex(K,2)*(1-x[3]) - (1-x[4]))

function nlsolve!(F, x)
    a 
    b 
    c 
    d
end

```

This probably doesn`t make sense since I will also need a function with variable length, but I did not know where to start.  
I am new to writing code and I am sorry if this is a stupid question.

Thanks a lot,  
Ulrich
