# Optimizing small systems of NonLinear equations with Optim.jl

Hello there I have a very small system of nonlinear equation and i do not quite understand how I can use this using Optim.jl. So far I have only figured out how to do one equation but I have a system (3 Equations):
The system is defined by:

``````function fb(x)
dco, dm, dcr = x*1e3

rco = dco
rm = dco + dm
rcr = dco + dm + dcr

ρco = 13e3 #kg/m^3
ρm = 4.5e3
ρcr = 2.9e3

R_planet = 6062e3 #m
M_planet = 4.88e24 #kg
C = 0.33*M_planet*R_planet^2

radius = dco + dcr + dm - R_planet
mass = 4/3*pi *( dco^3 * ρco + ((dco + dm)^3 - dm^3)*ρm + ρcr*((dco + dm + dcr)^3 - (dco + dm)^3)) - M_planet
MoI = 8/15*π*(ρco * rco^5 + ρm * (rm^5 - rco^5) + ρcr*(rcr^5 - rm^5)) - C
end
``````

How can I solve for possible solution vectors x with Optim.jl?
Also anyone know how to implement constraints?

What do you mean by minimize a system of equations?

If you’re doing constrained nonlinear optimization, you might want to use JuMP instead: Simple examples · JuMP

Sorry to be confusing what i mean with minimizing is searching for one or more solution vectors which let my functions vector output be close to 0 so. fb(xsol) ≈ [0,0,0].

Do I have to do this with JuMP as everything I have seen of JuMP seems to be quite more complicated than Optim.jl. Does Optim.jl not allow for “Solving” systems of equations?
I am sorry if any of what I am saying makes not much sense, I am trying to figure this out as I follow a course at my University.