1
$\begingroup$

I'm having some problems to find the root of an equation, but I'm solving this equation numerically with a list of numbers. I've got the following equation:

f(s)=1-a(s)+2irho(s)b(s)

where s is a list of complex numbers in the complex plane.

s=List{Re s,Im s}

a(s),b(s) and c(s) are also lists of complex numbers.

I have to find the values of s for which

f(s[Re s,Im s])==0

I've tried using FindRoot, NSolve... but both of them require to have a defined function and not a list of numbers, that's my case. I've also tried to interpolate the list of numbers and trying again with FindRoot or NSolve but they don't seem to work this way. UPDATE: here's the original code

m = 0.13957;
rho[s_] = 
Piecewise[{{Sqrt[1 - 4 m^2/s], Im[s] >= 0}, {-Sqrt[1 - 4 m^2/s], 
 Im[s] < 0}}];
k[s_] := Sqrt[s/4 - m^2];
step = 2/20;
si = Table[(i) step, {i, 1, 21}];
ai[a0_, a1_] = Table[{si[[i]], {a0 + a1 si[[i]]}}, {i, 1, 21}];
im = Table[0, {i, 1, 21}];
tol = 1;
While[tol > 0.001, 
bi[a0_, a1_] = 
Table[ai[a0, a1][[i, 2]], {i, 1, 21}] + 
1/Pi NIntegrate [
Table[si[[i]] im[[i]]/(s (s - si[[i]])), {i, 1, 21}], {s, 4 m^2,
2}, Method -> PrincipalValue, Exclusions -> Thread[si == s], 
AccuracyGoal -> 8];
a[a0_, a1_, b0_] = bi[a0, a1] + I im;
Ima[a0_, a1_, b0_] = 
Table[rho[si[[i]]] b0 (si[[i]] - 4 m^2)^(a0 + a1 si[[i]])/
Abs[Gamma[
a[a0, a1, b0][[i]] + 3/2]] Exp[-a1 si[[
i]] (1 - Log[a1]) + (si[[i]]/
Pi)  NIntegrate[(im[[
i]] Log[(si[[i]] - 4 m^2)/(s - 4 m^2)] + 
Arg[Gamma[a[0.520, 0.902, 0.520][[i]] + 3/2]])/(s (s - 
si[[i]])), {s, 4 m^2, 2}, Method -> PrincipalValue, 
Exclusions -> Thread[si == s], AccuracyGoal -> 8]], {i, 1, 
21}];
tol = Table[Ima[a0, a1, b0][[i]] - im[[i]], {i, 1, 21}];
im = Ima[a0, a1, b0]];

sp = Table[(i step - I i step), {i, 1, 21}];
ialpha[a0_, a1_] = 
Table[a0 + 
a1 sp[[i]] + (sp[[i]]/Pi) NIntegrate[
  Ima[0.520, 0.902, 0.520][[i]]/(s (s - sp[[i]])), {s, 4 m^2, 
   2}], {i, 1, 21}];
beta[a0_, a1_, b0_] = 
Table[Ima[a0, a1, b0][[i, 1]]/rho[sp[[i]]], {i, 1, 21}];

ti[a0_, a1_, b0_] = 
Table[beta[a0, a1, b0][[i]]/(1 - ialpha[a0, a1][[i]]), {i, 1, 21}];
tii[a0_, a1_, b0_] = 
 Table[beta[a0, a1, b0][[
 i]]/(1 - ialpha[a0, a1][[i]] + 
  2 I rho[si[[i]]] beta[a0, a1, b0][[i]]), {i, 1, 21}];
 f[a0_, a1_, b0_] = 
 Table[(1 - ialpha[a0, a1][[i]] + 
 2 I rho[si[[i]]] beta[a0, a1, b0][[i]]), {i, 1, 21}];
 f[0.520, 0.902, 0.520]

So, now that I posted the code (I didn't post it before because it's a bit tedious), I want to know for which values of sp (which is a complex number)

f[0.520, 0.902, 0.520]==0

If anyone could help me.

Thanks.

$\endgroup$
11
  • $\begingroup$ You could try ListInterpolation to convert the three functions into 2D InterpolatingFunctions, to which you then might apply FindRoot. To obtain more concrete advice, provide short versions of your three arrays, a, b, and c. $\endgroup$
    – bbgodfrey
    Commented Aug 29, 2016 at 18:19
  • $\begingroup$ You might also use ListContourPlot of the real and imaginary parts of f to see where the zero-contours of the two intersect. $\endgroup$
    – bbgodfrey
    Commented Aug 29, 2016 at 18:41
  • $\begingroup$ you really should use proper mathematica syntax. Its hard to tell if you are posting some sort of pseudocode, or maybe you problem is your syntax is all foobar. (every single bracket/parenthesis is of the wrong type in your expressions) $\endgroup$
    – george2079
    Commented Aug 29, 2016 at 23:39
  • $\begingroup$ @bbgodfrey I updated my original post with the code. Sorry for the inconvenience. I will try what you said. $\endgroup$
    – Jordi
    Commented Aug 30, 2016 at 9:47
  • 2
    $\begingroup$ I'm voting to close this question as off-topic because it is too localized; i.e, it applies only to the local situation and needs of its poster and answers will not benefit others. $\endgroup$
    – m_goldberg
    Commented Dec 21, 2016 at 17:07

0

Browse other questions tagged or ask your own question.