### Can FEniCS solve a nonlinear curve fitting problem?

82

views

0

I hope this is an OK question for this forum. If not, feel free to close!

A simple example would be:

I need to find four unknown spatially defined functions `a, b, c, d` from a set of known functions `f_i`. I then would like to use these functions to define a PDE. Described in a least-squares formulation it is:

$\sum_{i=1}^n\left[\left(a+bc\right)^d-f_i\right]^2=0$∑

where `n > 4`. Is there any way a

A simple example would be:

I need to find four unknown spatially defined functions `a, b, c, d` from a set of known functions `f_i`. I then would like to use these functions to define a PDE. Described in a least-squares formulation it is:

$\sum_{i=1}^n\left[\left(a+bc\right)^d-f_i\right]^2=0$∑

_{i=1}^{n}[(`a`+`b``c`)^{d}−`ƒ`_{i}]^{2}=0where `n > 4`. Is there any way a

`NonlinearVariationalProblem`

could be used to describe and solve this?
Community: FEniCS Project

### 1 Answer

2

You can see your problem as a PDE optimization problem, where your objective is this least squares, and the constraint is the pde, with these functions in it. Write the weak lagrangian of the optimization problem, take a derivative with respect to the parameters of the Lagrangian, and then solve the Lagrangian equal to 0 with nonlinear variational solver.

https://fenicsproject.org/qa/9936/problem-constraint-optimization-nonlinearvariationalsolver/

https://fenicsproject.org/qa/9936/problem-constraint-optimization-nonlinearvariationalsolver/

Please login to add an answer/comment or follow this question.