I have two functions, fun1[a1,a2,b1,b2,b] and fun2[a1,a2,b1,b2,b]=0. Where both equations are nonlinear. I am trying to optimize fun1 using differential evolution where b is root of fun2 for the current values of a1, a2, b1 and b2. I tried replacing b=FindRoot[fun2==0,{b,-1}] into fun1 however, I get an error.
How should I go about implementing this in Mathematica?
Reading the documentation for NMaximize, it says
NMaximize[{f,cons},{x,y,…}]
maximizes f numerically subject to the constraints cons.
so I am guessing from your description that you might try
NMaximize[{fun1,fun2==0},b]
but I can’t test this to be certain because I’m guessing your α1, α2, β1, β2 have been assigned values and I don’t know what those values are.
Try it and see if we are both very lucky and it works.
If it doesn’t work then please edit your post to show all the assignments to variables and the exact code that you used and the error messages that you got and people can try to reproduce what you did and see if they can find a way to make it work for you.