Example 1: Solve
that satisfies initial conditions
and
.
Solution: First we solve the homogeneous equation
.
> solve(r^2-1=0,r);
Hence
> y[1]:=x->exp(x);y[2]:=x->exp(-x);
> solve({y[1](x)*dc[1]+y[2](x)*dc[2] = 0, diff(y[1](x),x)*dc[1]+diff(y[2](x),x)*dc[2] = exp(2*x)},{dc[1],dc[2]});
Hence
> c[1]:=int(1/2*exp(x),x);c[2](x):=int(-1/2*exp(x)^3,x);
So the particular solution is
> 1/2*exp(x)*exp(x)+1/6*exp(x)^3*exp(-x);
> simplify(%);
Hence the general solution is
> y:=x->C[1]*exp(x)+C[2]*exp(-x)+2/3*exp(2*x);
No we solve the initial problem
> solve({y(0)=1,D(y)(0)=1},{C[1],C[2]});
Hence the solution is
> 1/3*exp(-x)+2/3*exp(2*x);