I'm trying to adapt the following piece to the part where PowerF is a function of amax.
Z = Max[Z /. Solve[FullSimplify[PowerF, Z ∈ Reals] == P0, Z]]
Now I have modified my code because I want to also make a plot that depends on the parameter amax.
However the following does not work:
Z[amax_] := Max[Z[amax] /. Solve[FullSimplify[PowerF[amax], Z ∈ Reals] == P0, Z]]
How to fix this?


