# Solve symbolic ODE with symbolic initial condition

I have the following ODE

c + (p + r) y[p] == p (u + (-1 + p) y'[p])

where car and u are parameters of the problem. I want to solve the ODE using a symbolic initial condition y(0)=x for some x, or also to impose an initial condition of the form y(z)=x where both x and y are symbols. For both these issues I tried to do DSolve, getting the solution with the constant C[1] and then using Solve[y(0)==x, c[1]] but I get error. I guess I should define a function y which maps p and c[1] and use that in Solve. Is there any straightforward way to do this?

• There are some mistakes in the code. If you try the o.d.e without a boundary condition you get an answer sol = DSolveValue[{c + (p + r) y[p] == p (u + (-1 + p) y'[p])}, y[p], {p, 0, 1}] // FullSimplify and then taking the limit Limit[sol, p -> 0] you should be able to see something
– bmf
Apr 11 at 0:22
• Another comment: you should NOT be using K --- see this answer.
– bmf
Apr 11 at 0:25
• Your syntax is also wrong. You need {...} around the ode and the bc. Also you really do not need to say {p,0,1} as this is analytical solution. You are not using NDSolve here. Try this from clean systemode = c + (p + r) y[p] == p (u + (-1 + p) y'[p]); ic = y[0] == k; DSolve[{ode, ic}, y[p], p] which gives {} as solution. Apr 11 at 1:34
• Your IC does not give solution. If you do this sol = DSolveValue[ode, y[p], p] then eq = k == Limit[sol, p -> 0] // InputForm it will give ConditionalExpression[k == ComplexInfinity, Element[c | u, Reals] && r > 1 && C[1] > 0] so it is not possible to solve the constant for the integration C[1] that is why Mathematica can't find solution. If you copied from this a book, make sure you copied the IC correctly. Apr 11 at 1:41
• thank you for your comments. I am totally new to mathematic and I need this for my research. I edited the question to make it more meaningful. Apr 11 at 18:10