1
$\begingroup$

I have an equation and I have tried solving it to find values of b but it doesn't give me any values

The equation that I have tried to solve is :

 ArcTan[1/d*Sqrt[(a+b)/(1-b)]]-(Vi/h)*Integrate[Sqrt[(1+(x/h)^2)^(-1)],{x,(h/2)*Log[b],0}]+(Pi/4)+m*Pi=0 

I tried on it as following:

a = 0; m = 0; c = 0.98; d = c - (a*(1 - c));
bValue = Table[FindRoot[ArcTan[1/d*Sqrt[(a+b)/(1-b)]]-(Vi/h)*Integrate[Sqrt[(1+(x/h)^2)^(-1)],{x,(h/2)*Log[b],0}]+(Pi/4)+m*Pi,{b,0.5}], {Vi, 0.8, 5.0, 0.1}];
bValues = Re[b /. bValue]
bValuesList = Transpose[{Join[{b}, bValues]}]
bGrid = Grid[bValuesList, Frame -> All]
vValues = Table[i, {i, 0, 20, 0.1}]
vValuesList = Transpose[{Join[{V}, vValues]}]
vGrid = Grid[vValuesList, Frame -> All]
$\endgroup$

2 Answers 2

5
$\begingroup$
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

$\endgroup$
9
  • $\begingroup$ I tried your way to solve the equation but it does not give me as you have written here $\endgroup$
    – A.J.H
    Aug 17, 2022 at 15:45
  • $\begingroup$ If you copy and pasted my code and it didn't work, there must be a difference with Mma versions, presumably with NSolveValues. I used v13.1, what version are you using? $\endgroup$
    – Bob Hanlon
    Aug 17, 2022 at 19:07
  • $\begingroup$ yes i think the problem on NSolveValues , the version is 11.2 $\endgroup$
    – A.J.H
    Aug 18, 2022 at 4:17
  • $\begingroup$ Then use root[Vi_?NumericQ] := b /. FindRoot[expr[Vi, b] == 0, {b, 0.3}] $\endgroup$
    – Bob Hanlon
    Aug 18, 2022 at 5:05
  • $\begingroup$ ArcTan[1/dSqrt[(a+b)/(1-b)]]-(Vi/h)*Integrate[Sqrt[(1+(x/h)^2)^(-1)-b],{x,(h/2)*Log[b],0}]+(Pi/4)+mPi=0 .... there is an eddit in the equation can you see it please?! $\endgroup$
    – A.J.H
    Aug 19, 2022 at 14:37
3
$\begingroup$

Change the integration variable x to xdh=x/h , in this way parameter h dissappears

eq = ArcTan[1/d*Sqrt[(a + b)/(1 - b)]] - (Vi/h)*Integrate[Sqrt[(1 + (xdh)^2)^(-1)], {xdh,(1/2)*Log[b], 0}] h + (Pi/4) +m*Pi

ConturPlot shows possible real solutions {Vi,b}

pic=ContourPlot[0 == eq, {Vi, .8, 5}, {b, 0.0, .6}, FrameLabel -> {Vi, b}]

enter image description here

List of solutions found:

pic[[1, 1]][[1]]
(*{{0.8, 0.0416416},{0.804065,0.0422764}, 
{0.807732,0.0428571}, {0.8375,0.0477974}, 
{0.838872, 0.0480182},...}*)

Alternatively try direct solution NSolve

sol[Vi_] := {Vi, b} /. NSolve[{0 ==eq[[1]], 0 < b < 1}, b][[1]]   
Table[sol[Vi], {Vi, .8, 5, .1}]  
$\endgroup$
7
  • $\begingroup$ why when i put a=100 it doesn't give me any result ?! $\endgroup$
    – A.J.H
    Aug 18, 2022 at 4:18
  • $\begingroup$ Perhaps no real solution exists for a==100. Try to visualize with Plot3D[eq, {b, 0, 1}, {Vi, 0.8, 5}] $\endgroup$ Aug 18, 2022 at 5:48
  • $\begingroup$ I have used Plot3D before but it does not work, if it is does not have real solution and just imaginary ones how i can get the figure for the real part of the solutions?! $\endgroup$
    – A.J.H
    Aug 18, 2022 at 14:32
  • $\begingroup$ Plot3D[eq,...] shows a surface depending on b,Vi. If surface only shows points <0 there is no real solution! $\endgroup$ Aug 18, 2022 at 14:39
  • $\begingroup$ Restart your kernel and evaluate my code. Now Plot3D[eq, {b, 0, 1}, {Vi, 0.8, 5}] should show a surface? $\endgroup$ Aug 18, 2022 at 14:58

Your Answer

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

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