So I solved following ODE $$\frac{d^2y}{dx^2}+(a^2 (5+4\tanh( x))+b^2)y=0$$ in Mathematica. Now I need to create a list for further manipulation using the above solution. I wrote the following code:
list = {}
s = ParametricNDSolve[{y''[x] + (a*a + b*b*(5 + 1 Tanh[x]))*y[x] == 0,
y[-10] == Exp[I*10*Sqrt[a*a + 4*b*b]], y'[-10] == (-I)*Sqrt[a*a + 4*b*b]*Exp[I*10*Sqrt[a*a + 4*b*b]]}, y, {x, -10, 10}, {a, b}]
For[i = -1, i <= 1, i = i + .1,
For[j = -1, j <= 1, j = j + .1,
y1 = y[i, j] /. s;
list = Append[list, {i, j, Abs[y1[0]]}]
]
]
I know the error lies in the last part of Append function i.e. Abs[y1[0]] but I cannot come with any solution to this issue. How should I resolve this issue?
Tableinstead ofFor. https://mathematica.stackexchange.com/questions/134609/why-should-i-avoid-the-for-loop-in-mathematica – Szabolcs Mar 05 '20 at 14:30