The following implicitly defined equation has both real and complex roots:
$$ \frac{0.5}{(y + x)^2 - 0.3x^2} + \frac{0.5}{(y - x)^2 - 0.3x^2} - \frac{1}{x^2} = 1 $$
I am trying to solve it numerically using FindRoot
for a range of x-values. For the initial guesses, I am using Solve
. The equation has four solutions, namely, $y_1, y_2, y_3$, and $y_4$,
Here is my attempt:
F[y_, x_] := 0.5/((y - x)^2 - 0.3*x^2) + 0.5/((y - x)^2 - 0.3*x^2) - 1/x^2 - 1
Intialguess = Grid[y /. Table[Solve[F[y, K] == 0, y], {K, 0.1, 1, 0.1}]]
Table[FindRoot[F[y, k] == 0, {y, Intialguess}], {k, 0.1, 1, 0.1}]
Output:
Out[1] =
-0.19094 0. - 0.0236008 I 0. + 0.0236008 I 0.19094
-0.380117 0. - 0.0450256 I 0. + 0.0450256 I 0.380117
-0.566053 0. - 0.062029 I 0. + 0.062029 I 0.566053
-0.747747 0. - 0.0720716 I 0. + 0.0720716 I 0.747747
-0.924725 0. - 0.0715281 I 0. + 0.0715281 I 0.924725
-1.09698 0. - 0.0515827 I 0. + 0.0515827 I 1.09698
-1.26484 -0.0550617 0.0550617 1.26484
-1.42884, -0.112579 0.112579 1.42884
-1.58956 -0.163747 0.163747 1.58956
-1.74762 -0.214101 0.214101 1.74762
in search specification {y,Intialguess} is not a number or array of \
numbers. >>
{FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}],
FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}],
FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}],
FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}],
FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}],
FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}],
FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}],
FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}],
FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}],
FindRoot[F[y, k, U1, U2] == 0, {y, Intialguess}]}
The first, second, third, and fourth columns of the grid of initial guesses containing real and complex-valued solutions represents $y_1, y_2, y_3$, and $y_4$, respectively. How do I convert the initial guesses so that FindRoot
recognises each grid entry as a numeric value?
Goal: Produce a table of numerically solved-roots:
x y1 y2 y3 y4
0.1 -0.19494 0. - 0.0236008 I 0. + 0.0236008 I 0.19094
0.2 -0.380117 0. - 0.0450256 I 0. + 0.0450256 I 0.380117
0.3 -0.566053 0. - 0.062029 I 0. + 0.062029 I 0.566053
0.4 -0.747747 0. - 0.0720716 I 0. + 0.0720716 I 0.747747
0.5 -0.924725 0. - 0.0715281 I 0. + 0.0715281 I 0.924725
0.6 -1.09698 0. - 0.0515827 I 0. + 0.0515827 I 1.09698
0.7 -1.26484 -0.0550617 0.0550617 1.26484
0.8 -1.42884, -0.112579 0.112579 1.42884
0.9 -1.58956 -0.163747 0.163747 1.58956
1.0 -1.74762 -0.214101 0.214101 1.74762
and plot the results.
Root
objects can enumerate polynomial roots exactly? See documentation. $\endgroup$Grid
is only a formating option, don't use it inIntialguess = Grid[...]
$\endgroup$N
to any exact solution converts it to a numerical solution. $\endgroup$