# Constrained optimization for non-linear equations in octaveGNU

I have installed Optim1.6.1 package. I would like to solve a system of equations in non linear finite element analysis using constraints as u=1 at certain nodes. u=0 at certain nodes. Typically I find kmat and res as below

[kmat,res]=systemmatrices(u,load,boundarycondition,material,constraints) The optimisation syntax in octave is as follows [x, obj, info, iter, nf, lambda]=sqp(x0, @g, @h, upperbound, lowerbound, iter, tol)

1. Here, 'g' seems to be the objective function which is given as a function of variables and equations. Similarly 'h' is considered the system of equations in symbolised form such as x1, x2 etc. I see several examples in this template. I'm not clear on how to input the stiffness matrix, residual matrix, since the matrices are computed in a separate script as a function of several variables.
2. In general what is the objective function in a non linear FEA problem with mechanical loading? It the energy residual? Can I find a simple example of a simple mesh?

I feel quite stuck with this problem for quite a long time. If these are too basic please suggest me some reading material.

• IF you want to solve a system of equations with an optimizer, just use a dummy objective. E.g. use a function that always returns 0. Jun 10 at 23:01
• Thanks. Can you please elaborate with a simple example. Like applying displacement boundary condition using Lagrange. All I see is integral forms. I could not find any numerical implementation. And I am having trouble in converting integrals to numerical form. Jun 12 at 5:29
• You might also minimize the sum of the squares of the equation residuals- this is an unconstrained problem, but if you get the sum of squares down to 0, then you've found a solution. Jul 1 at 4:41
• @BrianBorchers I understand the theory. We take the residual to 0. But I need information on how to input matrices in octave or matlab on using constraints. Especially if I want to constrain the solution variable between 0 and 1 on certain nodes. The constrain is simply 0<g<1. But how to input this in matrix form of FEA? I am using my own FEA code. Most examples use "sym" and easily explain x1^2 =0 as constrain on a simple 3 equation system. But as you know for all practical purposes, such symbolic representations don't work. I need a simple example where I give input as matrices. Jul 3 at 15:13