How to insert Integral in a NonLinearProblem

If I want to have an integral inside a Non Linear System of equations how would I do it with ModelingToolkit.jl and NonLinearSolver.jl?

e.x. I have an integral from 0 to 1 of sin(a*x) which equals to 1, how would I solve for a using NonLinearSolve?

My problem is actually more complex (a lot).

You can’t do this with ModelingToolkit’s interface right now, you’ll need to directly write the code for NonlinearSolve.jl until this is supported in the symbolic language.

Thanks!, is it on the roadmap?

Note that you can just implement this as a numeric integral using any quadrature package, and then pass the resulting function to any root-finding package. For example:

using QuadGK, Roots, ForwardDiff
D(f) = x -> ForwardDiff.derivative(f,float(x))
f(a) = quadgk(x -> sin(a*x), 0, 1, atol=1e-11)[1]
find_zero((f, D(f)), 3, Roots.Newton(), xatol=1e-8)

returns \approx 2\pi. (Be sure to specify an absolute tolerance for any quadrature routine, since you will be looking at parameters where the integral is nearly zero.)

It is on the roadmap. So do what Steven says for now, and there’s a lot of other random stuff ModelingToolkit is growing into so I won’t guarantee it’s happening soon but the connections between system types is one of the big focuses.