NDSolve[{u'[y] + (k + y) u''[y] - Ha^2 (k + y) u[y] -
u[y]/(-k + y) == -k, u[-1] == 0, u[1] == 0}, u[y], y]
gives the error
NDSolve::ndnum: Encountered non-numerical value for a derivative at y == -1..
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityBeing new, you should be aware built-in Mathematica functions and commands begin with upper-case letters including the single-letter commands: C,D, E, I, K,N O. If you were to begin a user-defined variable with an upper-case letter, it could conflict with built-in commands. Best then to always start user-defined variables with a lower-case letter. Need also to assign values to constants in equation to numerically integrate it. It's also simpler in my opinion to use NDSolveValue
which returns the function directly. Here's a test case:
Ha = 1.5;
k = 2.3;
theSol =
NDSolveValue[{u'[y] + (k + y) u''[y] - Ha^2 (k + y) u[y] -
u[y]/(-k + y) == -k, u[-1] == 0, u[1] == 0}, u, y]
Plot[theSol[y], {y, -1, 1}]
NDSolve
but several parameters are left arbitrary $\endgroup$k
etc $\endgroup$