1
$\begingroup$

i want to solve the nolinear equations and $\phi1\in(0,\frac{\pi}{2})$ and $\phi2\in(0,\frac{\pi}{2})$ and $\phi1<\phi2$

I calculated the maximum and minimum on the left of the equal sign, and the value on the right of the equal sign between them, indicating that the root should exist, but the result doesn't exist,is it because when I use FindRoot to solve the problem, I take $\phi1$ and $\phi2$ a point instead of a range? for example

{ϕ1, π/4}, {ϕ2, π/4}

rather than

0 < ϕ1 < π/2 && 0 < ϕ2 < π/2 

How to calculate the root of this equation,

How to set a range of $\phi1$ and $\phi2$ rather a point of start

tried

h = 20;
l = 20*Sqrt[2];

FindRoot[{Csc[ϕ2] - 
Csc[ϕ1] == -1, (Log[Tan[ϕ2/2]] - 
  Log[Tan[ϕ1/2]])/((Cot[ϕ1] - Cot[ϕ2])) == 
   h/l}, {ϕ1, π/4}, {ϕ2, π/4}]
(*Power::infy: Infinite expression 1/0. encountered.*)
(*Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.*)
(*FindRoot::nlnum: The function value {1.,Indeterminate} is not a list of numbers with dimensions {2} at {ϕ1,ϕ2} = {0.785398,0.785398}.*)

and

NMaximize[{Csc[ϕ2] - Csc[ϕ1], 
  0 < ϕ1 < π/2 && 0 < ϕ2 < π/2}, {ϕ1, ϕ2}]
(*{9.29958*10^11, {ϕ1 -> 1.05644, ϕ2 -> 1.07532*10^-12}}*)

NMinimize[{Csc[ϕ2] - Csc[ϕ1], 
  0 < ϕ1 < π/2 && 0 < ϕ2 < π/2}, {ϕ1, ϕ2}]
(*{-5.52822*10^10, {ϕ1 -> 1.8089*10^-11, ϕ2 -> 0.0239192}}*)

NMaximize[{(Log[Tan[ϕ2/2]] - 
     Log[Tan[ϕ1/2]])/((Cot[ϕ1] - Cot[ϕ2])), 
  0 < ϕ1 < π/2 && 0 < ϕ2 < π/2}, {ϕ1, ϕ2}]
(*{1., {ϕ1 -> 1.57079, ϕ2 -> 1.57079}}*)

NMinimize[{(Log[Tan[ϕ2/2]] - 
     Log[Tan[ϕ1/2]])/((Cot[ϕ1] - Cot[ϕ2])), 
  0 < ϕ1 < π/2 && 0 < ϕ2 < π/2}, {ϕ1, ϕ2}]
(*{3.14135*10^-18, {ϕ1 -> 0.799769, ϕ2 -> 7.15307*10^-20}}*)
$\endgroup$
2
  • $\begingroup$ @HenrikSchumacher i think as i coded it,it is unnecessary to put it as formula again, and why it inequality? and is there really no roots and if exists,how to find all them? $\endgroup$
    – dcydhb
    May 25, 2018 at 8:49
  • $\begingroup$ I aborted FindInstance[eq, {ϕ1, ϕ2},Reals]. May be you can wait longer? $\endgroup$
    – Acus
    May 25, 2018 at 9:18

2 Answers 2

2
$\begingroup$

To solve your equations numerically use NMinimize:

gl = {Csc[ϕ2] - Csc[ϕ1] == -1, (Log[Tan[ϕ2/2]] -Log[Tan[ϕ1/2]])/(Cot[ϕ1] - Cot[ϕ2]) == h/l}

NMinimize[{1, gl, 0 < ϕ1 < π/2, 0 < ϕ2 < π/2, ϕ1 < ϕ2}, {ϕ1, ϕ2}]

(* Out: {1., {ϕ1 -> 0.511714, ϕ2 -> 1.28531}} *)
$\endgroup$
1
  • $\begingroup$ helps a lot and thanks a lot! $\endgroup$
    – dcydhb
    May 26, 2018 at 13:55
1
$\begingroup$
h = 20;
l = 20*Sqrt[2];

Use ContourPlot to find good starting values for use in FindRoot

ContourPlot[{Csc[ϕ2] - 
     Csc[ϕ1] == -1, (Log[Tan[ϕ2/2]] - 
       Log[Tan[ϕ1/2]])/((Cot[ϕ1] - Cot[ϕ2])) == 
    h/l}, {ϕ1, 0, π/2}, {ϕ2, 0, π/2}, 
  PlotLegends -> Placed["Expressions", {.6, .15}], 
  FrameLabel -> Automatic] // Quiet

enter image description here

FindRoot[{Csc[ϕ2] - 
    Csc[ϕ1] == -1, (Log[Tan[ϕ2/2]] - 
      Log[Tan[ϕ1/2]])/((Cot[ϕ1] - Cot[ϕ2])) == 
   h/l}, {ϕ1, .5}, {ϕ2, 1.3}]

(* {ϕ1 -> 0.511714, ϕ2 -> 1.28531} *)
$\endgroup$
1
  • $\begingroup$ great answer and thanks a lot! $\endgroup$
    – dcydhb
    May 26, 2018 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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