1
$\begingroup$

I have solved following equation using ParametricNDSolve $$ \frac{\mathrm d^2y}{\mathrm dx^2} + \left(a + \frac{2}{\pi} b\ \arctan x\right)y = 0 $$

s = ParametricNDSolveValue[{y''[x] + (a + b*((2/Pi)*ArcTan[x]))*
  y[x] == 0, y[-10] == Exp[I*10*Sqrt[a + b]], y'[-10] == (-I)*Sqrt[a + b]*Exp[I*10*Sqrt[a + b]]}, y, {x, -10, 10}, {a, b}]

Now I want to plot $ y(x) $ for $ a = 3, b = 1 $ so I have to add following lines to above code

y1 = y[3, 1] /. s
AbsArgPlot[y1[x] /. s, {x, -5, 5}]

Instead of working it is giving me the following resultenter image description here

A similar question is already posted here but the answer to that question is that since the output generated is complex so we have to plot real and imaginary parts separately but here I am already aware of that point. Is it not working because of some output type mismatch in the AbsArgPlot function?

EDIT: I found out my mistake I am using Kernel 11.0 while AbsArgPlot works for Kernel 12.0

$\endgroup$
  • $\begingroup$ The code you've pasted just spews errors for me when I run it $\endgroup$ – ktm Feb 26 at 15:19
4
$\begingroup$

How about:

y1 = s[3, 1]
AbsArgPlot[y1[x], {x, -5, 5}]
|improve this answer|||||
$\endgroup$
  • $\begingroup$ It is still not working. I am getting the same result $\endgroup$ – aitfel Feb 26 at 17:28

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