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.
a = :(F = x + x -1) b = :(F = x*(1-x) + x * (1-x) - 0.5) c = :(F = getindex(K,1)*x - x) d = :(F = getindex(K,2)*(1-x) - (1-x)) 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,