0
$\begingroup$

I want to find minima. My code:

Formula = N[-{{{0.0, 0, 200.0} - 800.0 {0, 0, Cos[Tetha]}}.{Sin[Tetha] Cos[Phi], 
Sin[Tetha] Sin[Phi], Cos[Tetha]}}]

DensPlot = DensityPlot[Formula, {Tetha, 0, 180}, {Phi, 0, 360}, 
ColorFunction -> "SunsetColors", PlotLegends -> Automatic, 
FrameLabel -> {Style["θ0 (Degree)", FontSize -> 16], 
Style["ϕ0 (Degree) ", FontSize -> 16]}, Mesh -> 10];

DensPlot

So I plot graph: enter image description here

And now i'm trying to find minima. How we can see it is at 70 degree θ0.

Minimize[{Formula, 50 <= Tetha <= 100, 0 <= Phi <= 360}, {Tetha, Phi}]

I have next mistake:

Minimize::objfs: The objective function {0. -1. (200. -636620. Cos[Tetha]) 
Cos[Tetha]} should be scalar-valued. >>

If i tried to use FindMinimum:

FindMinimum[Formula, {{Tetha, #[[1]]}, {Phi, #[[2]]}}] & /@ 
{{0, 180}, {0, 360}}

I have next mistakes:

FindMinimum::nrnum: The function value {636420.} is not a real number at 
{Tetha,Phi} = {0.,180.}. >>

and

FindMinimum::nrnum: The function value {636420.} is not a real number at 
{Tetha,Phi} = {0.,360.}. >>

So my queation How I can find minima?

$\endgroup$
2
$\begingroup$

Just don't use too many braces:

Formula = N[-({0.0, 0, 200.0} - 800.0 {0, 0, Cos[θ]}).{Sin[θ] Cos[ϕ], Sin[θ] Sin[ϕ], Cos[θ]}];
Minimize[{Formula, 50 <= θ <= 100, 0 <= ϕ <= 360}, {θ, ϕ}]

{-12.5, {θ -> 89.4101, ϕ -> 114.632}}

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.