0
$\begingroup$

I want to solve the following equation

$\frac{Sin[a[x]]}{a[x]}$ - x = 0, for x in range {0,1}.

I tried the FindRoot method but it gives only one root. I want to find the roots for this equation for all x in the range {0,1}.

As I'm new to Mathematica I'm unable to solve this using some known answers like this one.

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) 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. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Apr 7 at 15:26
5
$\begingroup$

You can use Solve to find the roots. Here is a function that finds the roots between $-\pi$ and $\pi$:

f[x_] := a /. Solve[Sin[a]/a==x && -Pi < a < Pi, a, Reals]

Examples:

f[1/2]
f[1/10]

{Root[{-2 Sin[#1] + #1 &, -1.89549426703398094714}], Root[{-2 Sin[#1] + #1 &, 1.89549426703398094714}]}

{Root[{-10 Sin[#1] + #1 &, -2.8523418944500916483}], Root[{-10 Sin[#1] + #1 &, 2.8523418944500916483}]}

You can use N to obtain approximate answers:

N[f[1/100], 40]

{-3.110482807621505335413758229364966288043, 3.110482807621505335413758229364966288043}

$\endgroup$
  • $\begingroup$ I also tried your straightforward solution. I stopped my efforts because the evaluation is quite slow and MMA doesn't find the point x==1,a==0 and evaluates f[1] ==a (MMA version 11.0.1.) $\endgroup$ – Ulrich Neumann Apr 5 at 7:23
  • $\begingroup$ @UlrichNeumann The equation is undefined at a == 0, and f[1] should have no solution. Carl's method also works if you replace Sin[a]/a by Sinc[a], which would lead to f[1] returning {0}; however, the OP did not write Sinc[a] - x == 0. It's unclear just what the OP wants f[1] to return, but Carl's solution is easy to adjust. $\endgroup$ – Michael E2 Apr 5 at 11:35
  • 1
    $\begingroup$ I think this adjustment finds all the roots: ff[x_] := Replace[a /. Solve[Sinc[a] == x && Quiet[-Abs[1/x] <= a <= Abs[1/x], Power::infy], a, Reals], a -> {}]; Switch Sinc[a] to Sin[a]/a as desired. $\endgroup$ – Michael E2 Apr 5 at 11:42
  • $\begingroup$ @MichaelE2 Thank you for your answer. Knowing that Sinc[0]==1 I expected Solve to find this solution. I'm still wondering why the evaluation of f[x] is so much slower than the Contourplot-version. $\endgroup$ – Ulrich Neumann Apr 5 at 12:01
2
$\begingroup$

As your equation is Sinc[a] == x the formal solution is

A = InverseFunction[Sinc];

You can plot it with

Plot[A[x], {x, -0.21723362821122166`, 1}]

but as you see in the result you get a random branch of the solution:

enter image description here

Better to use something numeric: the $i^{\text{th}}$ branch is found numerically by starting a FindRoot at the quadratic approximation of the relevant branch (only positive branches $a>0$):

Clear[B];
B[0, x_?NumericQ] := a /. FindRoot[Sinc[a] == x, {a, Sqrt[6 (1 - x)]}]
B[i_?OddQ, x_?NumericQ] := a /. FindRoot[Sinc[a] == x,
  {a, ((3+2i)π((3+2i)^2*π^2-2(6+Sqrt[-12+(3+2i)π(8x+(3+2i)π(2-(3+2i)π*x))])))/(-16+2(3+2i)^2*π^2)}]
B[i_?EvenQ, x_?NumericQ] := a /. FindRoot[Sinc[a] == x,
  {a, ((1+2i)π((π+2i*π)^2+2(-6+Sqrt[-12+(1+2i)π((2+4i)π+8x-(π+2i*π)^2*x)])))/(2(-8+(π+2i*π)^2))}]

Table[B[i, 0.03], {i, 0, 10}]

{3.04997, 6.47879, 9.14681, 12.9659, 15.2333, 19.4735, 21.298, 26.0288, 27.3139, 32.8091, 33.1041}

With[{z = 0.03},
  Plot[Sinc[a], {a, 0, 35}, GridLines -> {None, {z}}, 
    Epilog -> {Red, Table[Point[{B[i, z], z}], {i, 0, 10}]}]]

enter image description here

$\endgroup$
2
$\begingroup$

In order to find all of the roots for $x$ in range $\{0,1\}$, (without placing a limit on the range of $a$), you should use reduce. Because the user specifically wrote the function as $\sin(a)/a = z$ we do not convert the equation to $\text{sinc}(a)$, and specifically exclude the point $a=0$ because this would put a zero in the denominator.

f[yMax_, x_] := f[yMax, x] =
    If[x != 1,
        If[x != 0 ,
            {ToRules[N[Reduce[Sin[a]/a == x, a, Reals]]]},
            DeleteCases[Flatten[Table[ FullSimplify[Solve[Sin[a]/a == 0, a, Reals], a != 0 && C[1] \[Element] Integers] /. C[1] -> iConst, {iConst, -IntegerPart[yMax],  IntegerPart[yMax]}], 1], {a -> 0}]],
{}]

Writing all of the solutions for a particular value of x, as an array of ordered pairs gives,

finalFunction[yMax_, x_] := If[f[yMax, x] != {},
    {x, a} /. f[yMax, x],
    Nothing]

We can list all of the roots for values $x$ in the range $\{0,1\}$ to an arbitrary resolution in values of $x$ using the function,

listAllRoots[yMax_, resolution_] := listAllRoots[yMax, resolution] = SortBy[Flatten[ParallelTable[N[finalFunction[yMax, x]], {x, -1,1,1/resolution}], 1], Last]

Plotting all of these values at different scales of $a(x)$ using the function,

finalPlot[yMax_, resolution_] := ListLinePlot[
    listAllRoots[yMax,resolution],
    AspectRatio -> .75,
    PlotRange -> {{Automatic,1.0554}, {-yMax - .1*yMax, +yMax + .1*yMax}},
    LabelStyle -> {FontFamily -> "Latex", FontSize -> 25},
    FrameLabel -> {"x", "a(x)"},
    FrameTicks -> {{Table[Round[i, 1], {i, -yMax, yMax, yMax/3}], None},{Automatic, None}},
    PlotTheme -> "Scientific", ImageSize -> 450]

Here we have plotted all of the roots to the transcendental equation. Note that at $x=0$ the full solution is $a=n\pi$ where $n$ is any positive or negative integer. Thus there are infinite solutions at $x=0$, so here we have used the parameter $\text{yMax}$ to only solve for values $a=\{-\text{yMax},\text{yMax}\}$, which are within the plotting window. This value may be arbitrarily adjusted to any value.

GraphicsRow[{finalPlot[3, 500], finalPlot[30, 500], finalPlot[90, 500]}]

enter image description here

$\endgroup$
1
$\begingroup$

The problem is symmetric in a , {x,a} and {x,-a} solve the equation. Try

pic= ContourPlot[(Sin[a ]/a ) - x == 0, {x, 0, 1}, {a, 0, Pi},FrameLabel -> {x, a}]

enter image description here

to see the solution of your equation. I don't think that an analytical solution exists.

Now you can get the solutionpoints from pic

xa = pic[[1, 1]];

and interpolate

ip = Interpolation[xa] (*ip[x]=a[x]*)
Show[{pic, Plot[ip[x], {x, 0, 1},PlotStyle -> {Thickness[.01], Opacity[.3], Red}]}]

enter image description here

$\endgroup$
  • $\begingroup$ Yes, it does not have any analytical solutions. But, is it possible to find the value of a[x] for each x in the range (0,1)? $\endgroup$ – Aru Apr 5 at 6:25
  • $\begingroup$ Ok , if the knowledge of the inverse problem x[a] isn't sufficient you can interpolate the solution points found in Contourplot. I'll edit my answer! $\endgroup$ – Ulrich Neumann Apr 5 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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