Qurak

D solve initial and boundary value problems ivps with piecewise coefficients

Tutorial 15 steps, run in order in one session. Every step was executed against the engine and the output below is what it produced.

Step 1
PiecewiseExpand[UnitStep[x] + Max[x, x ^ 2]]
Output
Max[x, x^2] + UnitStep[x]
Step 2
DSolve[y'[x] == UnitStep[x], y, x]
Output
{{y -> Function[{x}, C[1] + Integrate[UnitStep[x], x]]}}
Step 3
eqn = {y'[x] == UnitStep[x], y[0] == 1};

No output - this step sets something up for the next one.

Step 4
sol = DSolve[eqn, y, x]
Output
{{y -> Function[{x}, 1 - Integrate[1, 0] + Integrate[UnitStep[x], x]]}}
Step 5
Plot[y[x] /. sol, {x, -3, 3}]
Output
-Graphics-
Step 6
Simplify[eqn /. sol[[1]], x  > 0 || x  < 0]
Output
{Derivative[1, Function[{x}, 1 - Integrate[1, 0] + Integrate[UnitStep[x], x]], x] == UnitStep[x], True}
Step 7
sol = DSolve[ {y'[x] + Max[x, 1] y[x] == 0, y[0] == 1}, y[x], x ]
Output
{{y[x] -> E^(Integrate[1, 0] - Integrate[Max[1, x], x])}}
Step 8
Plot[y[x] /. sol, {x, -3, 3}]
Output
-Graphics-
Step 9
FinalSol  = DSolve[ {y'[t] == If[ t ≤ 2, y[t], -y[t] / 2], y[0] == 1}, y, t]
Output
DSolve[{Derivative[1][y][t] == If[t <= 2, y[t], -(y[t]/2)], y[0] == 1}, y, t]
Step 10
SolFromMinusInfinityToTwo = DSolve[{y'[t] == y[t], y[0] == 1}, y, t]
Output
{{y -> Function[{t}, E^t]}}
Step 11
SolFromTwoToInfinity = DSolve[{y'[t] == -y[t] / 2, y[2] == E ^ 2}, y, t]
Output
{{y -> Function[{t}, E^(3 - t/2)]}}
Step 12
eqn = {y''[t] + y[t] == Piecewise[{{-1, t < 0}, {1, t < 1}, {Sin[t], t < 2}}], y[0] == 1, y'[0] == 1};

No output - this step sets something up for the next one.

Step 13
sol = DSolve[ eqn, y, t ]
Output
DSolve[{y[t] + Derivative[2][y][t] == Piecewise[{{-1, t < 0}, {1, t < 1}, {Sin[t], t < 2}}, 0], y[0] == 1, Derivative[1][y][0] == 1}, y, t]
Step 14
eqn = {y''[x]  - Clip[x] * y[x] == 0, y[0] == 0, y'[0] == -1};

No output - this step sets something up for the next one.

Step 15
DSolve[eqn, y, x]
Output
DSolve[{-(Clip[x]*y[x]) + Derivative[2][y][x] == 0, y[0] == 0, Derivative[1][y][0] == -1}, y, x]

Functions used

Related recipes

All recipes · Function reference · Use this from an MCP client