# Optimization of nonlinear equation system

I am quite new to Mathematica and need to solve the following problem: The problam is dependent on two constants, namely lphi and rmax.

lphi = 2 (c + p/e)
p = b^2/a
e = c/a
b = Sqrt[a^2 - ((4*a^2)/(lphi^2))]
thetatangentline = ArcTan[e]
t = Sqrt[p^2 - (p/e)^2]
s = a*(Sin[
thetacircle] + (thetacircle -
Sin[thetacircle])*((b/a)^(2 - 0.216*thetacircle^2)))
f = 2 (t + s)


So, now I want to Maximize b

rmax = 151.42840717646078443148910480787
NMaximize[{b, lphi == 150, f == rmax, thetacircle < 90°},
{lphi, c, p, e, a, thetatangentline, t, s, thetacircle, f},
{lphi, c, p, e, a, thetatangentline, t, s, thetacircle, f, b} ∈ Reals]


Hold[NMaximize[{b, lphi == 150, f == rmax,
thetacircle < 90 \[Degree]}, {lphi, c, p, e, a, thetatangentline,
t, s, thetacircle,
f}, {lphi, c, p, e, a, thetatangentline, t, s, thetacircle, f,
b} \[Element] Reals]]


How can I tell Mathematica to solve this problem? I read through a bunch of questions, but none seems to address my problem.

I am aware of the fact, that there is a "circle dependency" between the equations, that's why I need mathematica!

• Replace infinite recursions by finite ones – Coolwater Jun 28 '17 at 12:21
• @Coolwater I would love to, but I have no clue how to tell Mathematica to evaluate the recursion just do a depth, for example, 20 and accept the result... – java4ever Jun 28 '17 at 12:24
• As written your code gives errors when it gets to b, can you please fix the definitions of lphi, p, e and b so they aren't circular. – KraZug Jun 28 '17 at 12:24
• I think you need to explain what you are trying to do mathematically. – KraZug Jun 28 '17 at 12:44

Writing your equations as a set of equations, rather than assignments:

eqns = Simplify[{lphi == 2 (c + p/e), p == b^2/a, e == c/a,
b == Sqrt[a^2 - ((4*a^2)/(lphi^2))], ttl == ArcTan[e],
t == Sqrt[p^2 - (p/e)^2], f == 2 (t + s),
s == a*(Sin[tc] + (tc - Sin[tc])*((b/a)^(2 - 0.216*tc^2)))}]


(where I've used tc and ttl instead of thetacircle and thetatangentline, you could also use greek letters in the variable names). You have eight equations in eleven unknowns. Two of which are f and lphi, which are parameters that you are giving.

You can now solve these first seven equations, to express them all in terms of e (other variables may be able to be used, particularly if you remove the ttl eqn which doesn't do anything here.)

sub = Solve[eqns[[1;;7]], {a, b, c, p, s, t, ttl}][]


You can then use NMaximize to solve maximize the value of b, given the remaining equation connecting e and tc

Maximize[{b, eqns[], tc <= \[Pi]/2} /. sub /. lphi -> 150 /.
f -> 151, {e, tc}]
(* {37.0431, {e -> 1.16977, tc -> 1.5193}} *)


Which I think is the kind of answer that you want. For some reason that I don't understand but is presumably an artefact of the maximisation routine, adding the restriction $\theta_c>0$ gives me a worse answer, even though the earlier one is still valid. That may be worthy of a new question, or someone who knows more details on Maximize can chip in.

Maximize[{b, eqns[], 0 <= tc <= \[Pi]/2} /. sub /. lphi -> 150 /.
f -> 151, {e, tc}]
(* {34.852, {e -> 1.473, tc -> 1.43206}} *)

• Thank you, will try this later. The equations from the paper are wrong, I developed a new set. – java4ever Jun 29 '17 at 12:07