DSolve
is not set up to solve BVPs with parameters, even though theoretically it could.
Below is a modification of the Todd-Gayley trick used in Accessing Reduce from DSolve that hacks the algorithm at the point Solve
is used to solve the BCs for the integration constant(s):
Internal`InheritedBlock[{Solve}, Unprotect[Solve];
Solve[eq_, v_, opts___] /; ! TrueQ[$in] := Block[{$in = True, $res1, $res2},
If[MemberQ[v, _C],(* assumes generated parameters are C[k] *)
Solve[eq, Append[v, c], opts],
Solve[eq, v, opts]
]
];
Protect[Solve];
DSolve[{y'[x] == c x, y[1] == 1 && y[0] == 0}, y[x], x]
]
(* {{y[x] -> x^2}} *)
We could wrap it up in a superfunction:
parametricBVP // Options = Options@DSolve;
parametricBVP[sys_, y_, x_, p_, opts : OptionsPattern[]] :=
Internal`InheritedBlock[{Solve}, Unprotect[Solve];
Solve[eq_, v_, rest___] /; ! TrueQ[$in] := Block[{$in = True, $res1, $res2},
If[MemberQ[v, _C],(* assumes generated parameters are C[k] *)
Solve[eq, Flatten@{v, p}, rest],
Solve[eq, v, rest]
]
];
Protect[Solve];
DSolve[sys, y, x, opts]
];
Example:
parametricBVP[{y'[x] == c x, y[1] == 1 && y[0] == 0}, y[x], x, c]
(* {{y[x] -> x^2}} *)
Guarantee: This has been thoroughly tested on the OP's single example and on no others. :) You're probably better off using @Sjoerd's, @Michael's, or @Okkes's approach, even though such approaches should be unnecessary. However, I think parametricBVP
could give WRI a good idea how to extend DSolve
. The parameters to be eliminated could be specified with an option. In the above, I followed the syntax of ParametricNDSolve
.