I must advise you that I am an almost total novice in mathematica.. However here is my very simple question..

I know the command FindMaximum[{f},{x}] to find the maximum point and maximum value of a function, but I'm in a situation in which I can't use it properly

In particular: let's say I have a function $\phi(\omega,\theta,\varphi)$ defined on $0\le\omega<2\pi$, $0\le \theta,\varphi <\pi/4$ and with values in $\mathbb{R}^+$. Let's also consider another function, $l(\theta,\varphi)$, defined on $0\le \theta,\varphi <\pi/4$ and with values in $\mathbb{R}^+$.

My question is: what is the command to find the intervals of $\theta$ and $\varphi$ for which the maximum value on $\omega$ of $\phi(x,y,,\theta,\varphi)$ is smaller than $l(\theta,\varphi)$?

Thank you very much

• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. – bbgodfrey Jun 23 '15 at 23:49
• It might make your problem easier to use the trigonometric parametrization of the circle; $\phi$ will now explicitly depend on just three variables. – J. M. will be back soon Jun 23 '15 at 23:50

Suppose

λ[ω_, θ_, ϕ_] := Sin[ω - θ] Cos[ϕ]
l[θ_, ϕ_] := 10 Sin[θ] Sin[ϕ]


then

Plot3D[{(ω /. Last@FindMaximum[λ[ω, θ, ϕ], {ω, π}]), l[θ, ϕ]},
{θ, 0, π/4}, {ϕ, 0, π/4}]


The desired answer is the orange surface when it is above the blue surface, which is obtained from

 Plot3D[If[(ω /. Last@FindMaximum[λ[ω, θ, ϕ], {ω, π}]) > l[θ, ϕ],
(ω /. Last@FindMaximum[λ[ω, θ, ϕ], {ω, π}])], {θ, 0, π/4}, {ϕ, 0, π/4}]


Edited Note: FindMaximum finds local maxima. Use Maximize instead to find global maxima but be aware that it can be much slower, two orders of magnitude for this simple case.

In answer to a further question posed in a comment below, a function describing the boundary curve can be obtained by plotting the curve, extracting its internal representation, a List of points, and converting the list to an InterpolatingFunction.

cp = ContourPlot[(ω /. Last@FindMaximum[λ[ω, θ, ϕ], {ω, π}]) == l[θ, ϕ],
{θ, 0, π/4}, {ϕ, 0, π/4}] // Quiet;
f = Interpolation[First@Cases[cp, GraphicsComplex[z_, __] -> z, Infinity]]


Although not a closed-form solution, f can be used like other functions in later calculations. As a simple example, it can be used to recover a Plot of the curve.

Plot[f[θ], {θ, f["Domain"][[1, 1]], f["Domain"][[1, 2]]}, AspectRatio -> 1,
PlotRange -> {{0, π/4}, {0, π/4}}, AxesLabel -> {θ, ϕ}]


Note that f["Domain"] simply provides the range in θ over which f is valid.

• thank you! but can I also find equations for my orange surface? (this is what I really need) – user61720 Jun 24 '15 at 1:40
• In general, the range of θ, ϕ will not exist in closed form and can only be shown as a plot of some sort. – bbgodfrey Jun 24 '15 at 1:45
• yes, but what you call "plot of some sort" is a surface (or a curve, or points) which must have an equation (at least locally). well I'm asking if I can have this equation – user61720 Jun 24 '15 at 1:48
• You could try doing a numerical fit to the boundary, which in general could be quite complicated. – bbgodfrey Jun 24 '15 at 1:52
• can you explain me how do I do that in your example? – user61720 Jun 24 '15 at 1:53