1
$\begingroup$

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?

$\endgroup$
5
  • $\begingroup$ 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 $\endgroup$
    – bmf
    Apr 11 at 0:22
  • $\begingroup$ Another comment: you should NOT be using K --- see this answer. $\endgroup$
    – bmf
    Apr 11 at 0:25
  • $\begingroup$ 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. $\endgroup$
    – Nasser
    Apr 11 at 1:34
  • $\begingroup$ 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. $\endgroup$
    – Nasser
    Apr 11 at 1:41
  • $\begingroup$ 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. $\endgroup$
    – ensue
    Apr 11 at 18:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.