# How to solve a Differential Equation with DSolve with Function Coefficient?

Suppose I have

v[x_] = (1.453 Sech[x + 1])^2 + I  Sech[x + 1] Tanh[x + 1]


And I have to solve the equation:

mu1 u1[x] - u1''[x] - v[x] u1[x] == 0


for u1[x]. The conditions that are given are:

u1[-2] == 1, u1'[-2] == 0 .


I have tried DSolve but it shows errors:

Solve::inex: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help.

How can I Solve this equation in Mathematica symbolically?

• Which errors specifically?
– sarnold
Jun 14, 2012 at 2:19
• after giving the input : sol = DSolve[{mu1 u1[x] - u1''[x] - v[x] u1[x] == 0, u1[-2] == 1, u1'[-2] == 0}, u1, x] i got : " Solve::inex: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help. >>" and the output shows exactly the input Jun 14, 2012 at 4:06
• As to the error: simply use 1453/1000 instead of 1.453. Jun 15, 2012 at 5:31
• @belisarius, I did. But it didnt help me lot. Still i can not solve eigenfunction u1[x],eigenvalue mu1 symbolically. I have to calculate u1[x],mu1 and u2[x].mu2 and numerically integrate u1*u2 to get a resul6t. Jun 15, 2012 at 6:30
• You had the same mistake (Square) on stackoverflow, so you should have corrected it before posting here. Do you realize that this v is a complex-valued potential because it contains I? Just to make sure this isn't a mistake too. The problem you're having is probably that you're supposed to adjust the value of mu1 so that another boundary condition is satisfied, presumably at some x > -2. Only with that additional information will this become an eigenvalue problem.
– Jens
Jun 15, 2012 at 6:54

This simpler version solves:

sol = DSolve[{mu1*u1[x] - u1''[x] - Cos[x]* u1[x] == 0,
u1[-2] == 1,
u1'[-2] == 0},
u1, x];

GraphicsRow[Table[Plot[Evaluate[u1[x] /. sol], {x, 0, 20},
PlotRange -> All], {mu1, 1, 3}]]


But your equation with v included has problems, presumably mathematical:

DSolve[{mu1*u1[x] - u1''[x] -
((1.453*Sech[x + 1])^2 + I*Sech[x + 1]*Tanh[x + 1])* u1[x] == 0,
u1[-2] == 1,
u1'[-2] == 0},
u1, x]

• The equation of v[x] is V[x]=(A sech(x ±D/2 ))^2+i B sech(x ±D/2 )tanh(x ±D/2), where A=sqrt(2+(B^2) /9) and D is the separation between the two potentials. This is the equation of a Potential. Can this differential equation be solved for u1[x]??? Jun 14, 2012 at 17:42

In my opinion, NOT each differential equation has a explicit solution.

In your case, you didn't specify the value of mu1, I think.

• Thank you.but I have another problem, Here mu1 is the eigenvalue of the eigenfunction u1[x]. How can i calculate the mu1??? Jun 15, 2012 at 6:27
• Perhaps your equation cannot be solved analytically, i. e. no explicit closed form solution can be obtained. Jun 15, 2012 at 9:57