Skip to main content
Added optional use of FindRoot
Source Link
Bob Hanlon
  • 162.7k
  • 7
  • 81
  • 205
Clear["Global`*"]

Evaluate the integral once

int = Assuming[0 < b < 1,
  Integrate[Sqrt[(1 + (x/h)^2)^(-1)], {x, (h/2)*Log[b], 0}]]

(* -h ArcSinh[Log[b]/2] *)

a = 0; m = 0; c = 98/100; d = c - (a*(1 - c));

expr[Vi_, b_] = ArcTan[1/d*Sqrt[(a + b)/(1 - b)]] -
   (Vi/h)*int + (Pi/4) + m*Pi;

root[Vi_?NumericQ] :=
 NSolveValues[{expr[Vi, b] == 0, 0 < b < 1}, b][[1]]

EDIT: Or use

root[Vi_?NumericQ] := b /. 
 FindRoot[expr[Vi, b] == 0, {b, 0.3}]

viList = {4/5, 2, 4, 8};

Plot[Evaluate@
  Table[Tooltip[expr[Vi, b],
    StringForm["Vi = ``", Vi]], {Vi, viList}],
 {b, 0, 1},
 AxesLabel -> {b, HoldForm@expr[Vi, b]},
 Epilog -> {Red, AbsolutePointSize[4],
   Tooltip[Point[pt = {root[#], 0}], pt[[1]]] & /@ viList},
 PlotLegends -> Placed[
   LineLegend[viList, LegendLabel -> Vi],
   {.7, .3}]]

enter image description here

step = 0.4; (* change to desired granularity *)

Grid[
 Prepend[
  Table[{Vi, root[Vi]}, {Vi, 0.8, 8, step}],
  {Vi, b}],
 Frame -> All]

enter image description here

Clear["Global`*"]

Evaluate the integral once

int = Assuming[0 < b < 1,
  Integrate[Sqrt[(1 + (x/h)^2)^(-1)], {x, (h/2)*Log[b], 0}]]

(* -h ArcSinh[Log[b]/2] *)

a = 0; m = 0; c = 98/100; d = c - (a*(1 - c));

expr[Vi_, b_] = ArcTan[1/d*Sqrt[(a + b)/(1 - b)]] -
   (Vi/h)*int + (Pi/4) + m*Pi;

root[Vi_?NumericQ] :=
 NSolveValues[{expr[Vi, b] == 0, 0 < b < 1}, b][[1]]

viList = {4/5, 2, 4, 8};

Plot[Evaluate@
  Table[Tooltip[expr[Vi, b],
    StringForm["Vi = ``", Vi]], {Vi, viList}],
 {b, 0, 1},
 AxesLabel -> {b, HoldForm@expr[Vi, b]},
 Epilog -> {Red, AbsolutePointSize[4],
   Tooltip[Point[pt = {root[#], 0}], pt[[1]]] & /@ viList},
 PlotLegends -> Placed[
   LineLegend[viList, LegendLabel -> Vi],
   {.7, .3}]]

enter image description here

step = 0.4; (* change to desired granularity *)

Grid[
 Prepend[
  Table[{Vi, root[Vi]}, {Vi, 0.8, 8, step}],
  {Vi, b}],
 Frame -> All]

enter image description here

Clear["Global`*"]

Evaluate the integral once

int = Assuming[0 < b < 1,
  Integrate[Sqrt[(1 + (x/h)^2)^(-1)], {x, (h/2)*Log[b], 0}]]

(* -h ArcSinh[Log[b]/2] *)

a = 0; m = 0; c = 98/100; d = c - (a*(1 - c));

expr[Vi_, b_] = ArcTan[1/d*Sqrt[(a + b)/(1 - b)]] -
   (Vi/h)*int + (Pi/4) + m*Pi;

root[Vi_?NumericQ] :=
 NSolveValues[{expr[Vi, b] == 0, 0 < b < 1}, b][[1]]

EDIT: Or use

root[Vi_?NumericQ] := b /. 
 FindRoot[expr[Vi, b] == 0, {b, 0.3}]

viList = {4/5, 2, 4, 8};

Plot[Evaluate@
  Table[Tooltip[expr[Vi, b],
    StringForm["Vi = ``", Vi]], {Vi, viList}],
 {b, 0, 1},
 AxesLabel -> {b, HoldForm@expr[Vi, b]},
 Epilog -> {Red, AbsolutePointSize[4],
   Tooltip[Point[pt = {root[#], 0}], pt[[1]]] & /@ viList},
 PlotLegends -> Placed[
   LineLegend[viList, LegendLabel -> Vi],
   {.7, .3}]]

enter image description here

step = 0.4; (* change to desired granularity *)

Grid[
 Prepend[
  Table[{Vi, root[Vi]}, {Vi, 0.8, 8, step}],
  {Vi, b}],
 Frame -> All]

enter image description here

Source Link
Bob Hanlon
  • 162.7k
  • 7
  • 81
  • 205

Clear["Global`*"]

Evaluate the integral once

int = Assuming[0 < b < 1,
  Integrate[Sqrt[(1 + (x/h)^2)^(-1)], {x, (h/2)*Log[b], 0}]]

(* -h ArcSinh[Log[b]/2] *)

a = 0; m = 0; c = 98/100; d = c - (a*(1 - c));

expr[Vi_, b_] = ArcTan[1/d*Sqrt[(a + b)/(1 - b)]] -
   (Vi/h)*int + (Pi/4) + m*Pi;

root[Vi_?NumericQ] :=
 NSolveValues[{expr[Vi, b] == 0, 0 < b < 1}, b][[1]]

viList = {4/5, 2, 4, 8};

Plot[Evaluate@
  Table[Tooltip[expr[Vi, b],
    StringForm["Vi = ``", Vi]], {Vi, viList}],
 {b, 0, 1},
 AxesLabel -> {b, HoldForm@expr[Vi, b]},
 Epilog -> {Red, AbsolutePointSize[4],
   Tooltip[Point[pt = {root[#], 0}], pt[[1]]] & /@ viList},
 PlotLegends -> Placed[
   LineLegend[viList, LegendLabel -> Vi],
   {.7, .3}]]

enter image description here

step = 0.4; (* change to desired granularity *)

Grid[
 Prepend[
  Table[{Vi, root[Vi]}, {Vi, 0.8, 8, step}],
  {Vi, b}],
 Frame -> All]

enter image description here