I'm trying to get maximization result from Maximize function to use it in later calculations. At the moment I use the following code:
c := 4
p[q1_, q2_] := 12 - q1 - q2
pi[p_, q_] := p*q - c*q
q2optimal := Maximize[pi[p[q1, q2], q2], q2][[2]][[1]][[2]]
q2optimal
poptimal := Simplify[p[q1, q2optimal]]
poptimal
Is there any other way to get the same result without that ugly [[2]][[1]][[2]]
?