Group Abstract Group Abstract

Message Boards Message Boards

How can I correct the following code to produce the expected result?

Posted 1 month ago

I am reading the article "First few overtones probe the event horizon geometry". I want to replicate the results of Table 1 in the above article using the analytical continuation method as mentioned in the article. However, my code doesn't run out of any results. I don't know what's wrong with it, because there is no warning message.

Any suggestions would be greatly appreciated. Thanks very much.

The code is as follows:

M = 1/2; x = 1 - r0/r; \[Epsilon] = (2 M - r0)/r0; a0 = b0 = 0;
A[r_] = 1 - \[Epsilon] (1 - x) + (a0 - \[Epsilon]) (1 - x)^2 + 
   Al[r] (1 - x)^3;
B[r_] = 1 + b0 (1 - x) + Bl[r] (1 - x)^2;
Nm[r_] = Sqrt[x A[r]];
Al[r_] = 1/x ContinuedFractionK[a[n] x, 1, {n, 3}];
Bl[r_] = 1/x ContinuedFractionK[b[n] x, 1, {n, 3}];
f[r_] = Nm[r]^2/B[r];
V[r_] = Nm[r]^2 l (l + 1)/r^2 + (1 - s)/2/r D[f[r]^2, r];
eq = f[r] D[f[r] D[R[r], r], r] + (\[Omega]^2 - V[r]) R[r];
R[r_] = Exp[\[Sigma] r] x^\[Rho] (x - 1)^\[Lambda] y[r];
a[1] = 1/2; a[2] = 100; a[3] = 0; b[1] = 0; \[Epsilon] = 0; r0 = 1;
fctor = Coefficient[R[r], y[r]];
eqr = eq/fctor // Simplify;
eqrr = Collect[
   eqr, { y[r], Derivative[1][y][r], (y^\[Prime]\[Prime])[r]}];
epeq = Series[eqrr, {r, Infinity, 3}];
epf = Solve[
   Coefficient[Coefficient[epeq, y[r]], r, 0] == 0 && 
    Coefficient[Coefficient[epeq, y[r]], r, -1] == 
     0, {\[Sigma], \[Lambda]}];
(*solve the parameter {\[Sigma],\[Lambda]} using the boundary \
condition at infinity*)
eqnr = Collect[eqr, (-1 + r)] // Together // Simplify;
eqrho = eqnr /. r -> 1;
rho = Solve[Coefficient[eqrho, y[1]] == 0, \[Rho]];
(*solve the parameter \[Rho] using the boundary condition at the \
event horizon*)
Equation = Simplify[eqr /. rho[[1]] /. epf[[2]]];
(*the radial function with rho[[1]] and epf[[2]] will satisfy the \
quasinormal boundary conditions*)
r[z_] = First[r /. Solve[z == 1 - 1/r, r]];
CompactCoordinateEquation = 
  Equation /. (y^\[Prime]\[Prime])[r] -> 
        D[D[y[z], z]/D[r[z], z], z]/D[r[z], z] /. 
      Derivative[1][y][r] -> D[y[z], z]/D[r[z], z] /. y[r] -> y[z] /. 
    r -> r[z] // Expand;
y2Coeff = Coefficient[CompactCoordinateEquation, y''[z]] // Together;
y1Coeff = Coefficient[CompactCoordinateEquation, y'[z]] // Together;
yCoeff = Coefficient[CompactCoordinateEquation, y[z]] // Together;
fr = PolynomialGCD[y2Coeff, y1Coeff, yCoeff];
y2RCoeff = Simplify[y2Coeff/fr]; y1RCoeff = 
 Simplify[y1Coeff/fr]; yRCoeff = Simplify[yCoeff/fr];
PolynomialQ [y2RCoeff, z] && PolynomialQ [y1RCoeff, z] && 
  PolynomialQ [yRCoeff, z];
CoefficientListMatrix = 
  CoefficientList[{y2RCoeff/z, y1RCoeff, z yRCoeff}, z];

z1 = 15/1000; z2 = 30/1000; z3 = 60/1000; z4 = 120/1000; z5 = 
 240/1000; z6 = 480/1000; z7 = 960/1000;
(*midpoints for continuation*)
y2RCoeffst = y2RCoeff /. z -> t + z1;
y1RCoeffst = y1RCoeff /. z -> t + z1;
yRCoeffst = yRCoeff /. z -> t + z1;
CoefficientListMatrix1 = 
  CoefficientList[{y2RCoeffst, t y1RCoeffst, t^2 yRCoeffst}, t];
y2RCoeffnd = y2RCoeff /. z -> t + z2;
y1RCoeffnd = y1RCoeff /. z -> t + z2;
yRCoeffnd = yRCoeff /. z -> t + z2;
CoefficientListMatrix2 = 
  CoefficientList[{y2RCoeffnd, t y1RCoeffnd, t^2 yRCoeffnd}, t];
y2RCoeffrd = y2RCoeff /. z -> t + z3;
y1RCoeffrd = y1RCoeff /. z -> t + z3;
yRCoeffrd = yRCoeff /. z -> t + z3;
CoefficientListMatrix3 = 
  CoefficientList[{y2RCoeffrd, t y1RCoeffrd, t^2 yRCoeffrd}, t];
y2RCoefffr = y2RCoeff /. z -> t + z4;
y1RCoefffr = y1RCoeff /. z -> t + z4;
yRCoefffr = yRCoeff /. z -> t + z4;
CoefficientListMatrix4 = 
  CoefficientList[{y2RCoefffr, t y1RCoefffr, t^2 yRCoefffr}, t];
y2RCoefffv = y2RCoeff /. z -> t + z5;
y1RCoefffv = y1RCoeff /. z -> t + z5;
yRCoefffv = yRCoeff /. z -> t + z5;
CoefficientListMatrix5 = 
  CoefficientList[{y2RCoefffv, t y1RCoefffv, t^2 yRCoefffv}, t];
y2RCoeffsx = y2RCoeff /. z -> t + z6;
y1RCoeffsx = y1RCoeff /. z -> t + z6;
yRCoeffsx = yRCoeff /. z -> t + z6;
CoefficientListMatrix6 = 
  CoefficientList[{y2RCoeffsx, t y1RCoeffsx, t^2 yRCoeffsx}, t];
y2RCoeffsh = y2RCoeff /. z -> t + z7;
y1RCoeffsh = y1RCoeff /. z -> t + z7;
yRCoeffsh = yRCoeff /. z -> t + z7;
CoefficientListMatrix7 = 
  CoefficientList[{y2RCoeffsh, t y1RCoeffsh, t^2 yRCoeffsh}, t];
terms = CoefficientListMatrix // Dimensions // Last; rcf = 
 Function[{i, 
   n}, (n + 2 - i) (n + 1 - i) CoefficientListMatrix[[1, 
     i]] + (n + 2 - i) CoefficientListMatrix[[2, i]] + 
   CoefficientListMatrix[[3, i]]];
terms1 = CoefficientListMatrix1 // Dimensions // Last; rcf1 = 
 Function[{i, 
   n}, (n + 3 - i) (n + 2 - i) CoefficientListMatrix1[[1, 
     i]] + (n + 3 - i) CoefficientListMatrix1[[2, i]] + 
   CoefficientListMatrix1[[3, i]]];
terms2 = CoefficientListMatrix2 // Dimensions // Last; rcf2 = 
 Function[{i, 
   n}, (n + 3 - i) (n + 2 - i) CoefficientListMatrix2[[1, 
     i]] + (n + 3 - i) CoefficientListMatrix2[[2, i]] + 
   CoefficientListMatrix2[[3, i]]];
terms3 = CoefficientListMatrix3 // Dimensions // Last; rcf3 = 
 Function[{i, 
   n}, (n + 3 - i) (n + 2 - i) CoefficientListMatrix3[[1, 
     i]] + (n + 3 - i) CoefficientListMatrix3[[2, i]] + 
   CoefficientListMatrix3[[3, i]]];
terms4 = CoefficientListMatrix4 // Dimensions // Last; rcf4 = 
 Function[{i, 
   n}, (n + 3 - i) (n + 2 - i) CoefficientListMatrix4[[1, 
     i]] + (n + 3 - i) CoefficientListMatrix4[[2, i]] + 
   CoefficientListMatrix4[[3, i]]];
terms5 = CoefficientListMatrix5 // Dimensions // Last; rcf5 = 
 Function[{i, 
   n}, (n + 3 - i) (n + 2 - i) CoefficientListMatrix5[[1, 
     i]] + (n + 3 - i) CoefficientListMatrix5[[2, i]] + 
   CoefficientListMatrix5[[3, i]]];
terms6 = CoefficientListMatrix6 // Dimensions // Last; rcf6 = 
 Function[{i, 
   n}, (n + 3 - i) (n + 2 - i) CoefficientListMatrix6[[1, 
     i]] + (n + 3 - i) CoefficientListMatrix6[[2, i]] + 
   CoefficientListMatrix6[[3, i]]];
terms7 = CoefficientListMatrix7 // Dimensions // Last; rcf7 = 
 Function[{i, 
   n}, (n + 3 - i) (n + 2 - i) CoefficientListMatrix7[[1, 
     i]] + (n + 3 - i) CoefficientListMatrix7[[2, i]] + 
   CoefficientListMatrix7[[3, i]]];

NITMAX = 100;
\[Alpha] = rcf[#1, #2] &;
fs = Table[
   If[i > j + 2, 0, \[Alpha][i, j]], {j, 0, NITMAX}, {i, 1, 10}];

Do[fs = FoldList[
   If[PossibleZeroQ[#2 // Last], #2 // 
      Most, (Most[#2] - (#2 // Last)/(#1 // Last)*
         Prepend[#1 // Most, 0]) // Together] &, fs // First // Most, 
   fs // Rest], {7}]
(*Gauss elimination*)
Attachments:
POSTED BY: Xu Xu
8 Replies
POSTED BY: Gianluca Gorni
Posted 1 month ago

I don't understand why

CoefficientListMatrix[[1]] is empty.

I have ckecked that enter image description here

Your clarifications are welcome.

POSTED BY: Xu Xu

I am running the code in your first post:

In[71]:= CoefficientListMatrix

Out[71]= {{}, {-27 I (3 I + 4 \[Omega]), -1773 I (3 I + 4 \[Omega]) - 
   36 I (291 I + 482 \[Omega]), -27 I (3 I + 4 \[Omega]) - 
   2364 I (291 I + 482 \[Omega]) - 18 I (28386 I + 34451 \[Omega]), 
  9 I (3 I + 4 \[Omega]) - 36 I (291 I + 482 \[Omega]) + 
   702 I (1478 I + 4973 \[Omega]) - 1182 I (28386 I + 34451 \[Omega]),
   12 I (291 I + 482 \[Omega]) + 46098 I (1478 I + 4973 \[Omega]) - 
   18 I (28386 I + 34451 \[Omega]) - 
   27 I (18217 I + 63550 \[Omega]), -18 I (1794 I + 2495 \[Omega]) + 
   702 I (1478 I + 4973 \[Omega]) + 6 I (28386 I + 34451 \[Omega]) - 
   1773 I (18217 I + 63550 \[Omega]), 
  900 I (9 I + 10 \[Omega]) - 1182 I (1794 I + 2495 \[Omega]) - 
   234 I (1478 I + 4973 \[Omega]) - 27 I (18217 I + 63550 \[Omega]), 
  59100 I (9 I + 10 \[Omega]) - 18 I (1794 I + 2495 \[Omega]) + 
   9 I (18217 I + 63550 \[Omega]), 
  900 I (9 I + 10 \[Omega]) + 
   6 I (1794 I + 2495 \[Omega]), -300 I (9 I + 
     10 \[Omega])}, {0, -81 - 54 l - 54 l^2 + 81 s + 
   2124 I \[Omega] + 2832 \[Omega]^2, -15876 - 14346 l - 14346 l^2 + 
   15876 s + 174558 I \[Omega] + 539756 \[Omega]^2, -1214829 - 
   1249254 l - 1249254 l^2 + 1214829 s + 4034211 I \[Omega] + 
   27573316 \[Omega]^2, -33739974 - 35470782 l - 35470782 l^2 + 
   33739974 s + 111814305 I \[Omega] + 190857791 \[Omega]^2, 
  33393555 - 536400 l - 536400 l^2 - 33393555 s - 
   111054300 I \[Omega] - 91429580 \[Omega]^2, 
  2270394 + 180000 l + 180000 l^2 - 2270394 s - 6692148 I \[Omega] - 
   4858670 \[Omega]^2, -679725 + 679725 s + 1686825 I \[Omega] + 
   933200 \[Omega]^2, -16164 + 16164 s + 40425 I \[Omega] + 
   19975 \[Omega]^2, 
  2700 - 2700 s - 6000 I \[Omega] - 2500 \[Omega]^2}}
POSTED BY: Gianluca Gorni
Posted 1 month ago

Thank you for your check. You can use the notebook in the attachment.

POSTED BY: Xu Xu

From a casual reading on my phone, I don't see where you asked for an output, as you ended the functions with semicolon. You could assign them to a variable and have a print statement write them. That shouldn't hurt anything.

Posted 1 month ago

Hi, I removed the semicolon and used the Echo command, but there are still no expected results related to Gaussian elimination. enter image description here

POSTED BY: Xu Xu

Try the Notebook Assistant:

Posted 1 month ago

Thanks! I improved the code using the suggestions from Chat Notebooks. However, the result remains the same — there's still no output. Also, I don’t subscribe to Wolfram’s LLM Kit because it's too expensive for me.

POSTED BY: Xu Xu
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard