First of all, as mentioned in this comment, the answer for the 3rd question is, the new added boundary for Newode
should be
newbc = ode /. x -> 1
(* y'[1] == 1 *)
Then we can get the desired result:
ode = y'[x] == x + Integrate[y[r], {r, 1, x}];
bc = y[0] == 1;
sol = First@DSolve[{Newode, newbc, bc}, y, x]
(* {y -> Function[{x}, (E^-x (-E + 2 E^2 - E^x + 2 E^(2 x) - E^(2 + x) + E^(1 + 2 x)))/(
1 + E^2)]} *)
There seems to be no direct way to deduce the value of y'[0]
, so LaplaceTransform
isn't suitable for the original problem linked in the question .
Then let's deal with the first 2 questions. I think the initial value problem formed by the fake initial condition y'[0] == 0
is interesting, because it seems to expose a bug of InverseLaplaceTransform
. It fails to correctly handle unevaluated Integrate
with an assumption related to s
in this case:
teqn = LaplaceTransform[ode, x, s];
tsol = Solve[teqn, LaplaceTransform[y[x], x, s]][[1, 1, -1]] /. y@0 -> 1 // Apart
(* (1 + s^2)/(s (-1 + s^2))- Integrate[y[x], {x, 0, 1}, Assumptions-> s > 0]/(-1 + s^2) *)
If the assumption inside Integrate
is removed, then InverseLaplaceTransform
will evaluate correctly:
solgeneral = InverseLaplaceTransform[(1 + s^2)/(s (-1 + s^2)) -
Integrate[y[x], {x, 0, 1}]/(-1 + s^2), s, x]
(* -1 + (1/2)*E^x*(2 - Integrate[y[x], {x, 0, 1}]) +
((1/2)*(2 + Integrate[y[x], {x, 0, 1}]))/E^x *)
Notice
ode /. x -> 0 /. y'[0] -> 0
(* 0 == Integrate[y[r], {r, 1, 0}] *)
We find the final solution:
solgeneral /. HoldPattern@Integrate[__] :> 0 // Simplify
(* -1 + E^-x + E^x *)
It's the same as the result of Method 1.
Update
In v8.0.4 InverseLaplaceTransform
will return unevaluated, also, here's the response from WRI:
…… It does appear that InverseLaplaceTransform
is not behaving as
expected with the above function. I have forwarded an incident report
to our developers with the information you provided.……
So I think it's safe to call the current behavior of InverseLaplaceTransform
a bug.
Update 2
In v11.1 InverseLaplaceTransform
returns unevaluated again. Since the incorrect result is no longer returned, I think we can say the bug is fixed, though in a not that perfect way…