1. Nájdite všeobecné riešenie diferenciálnej rovnice y'-xy=2x
a partikulárne riešenie, ktoré vyhovuje začiatočnej podmienke
y(-2)=1. Nakreslite farebne sústavu integrálnych kriviek, 
graf partikulárneho riešenia vyznačte hrubou čiernou čiarou.
Vypočítajte hodnotu partikulárneho riešenia y(1.25)=?

Clear All

DSolve[y'[x] - x*y[x] == 0, y[x], x]

Clear[y]
DSolve[y'[x]-x*y[x]==2x,y[x],x]

Clear[y]
DSolve[{y'[x]-x*y[x]==2x,y[-2]==1},y[x],x]//Simplify

f[x_]=-2+c*Exp[x^2/2]
fp[x_]=-2+3*Exp[-2+x^2/2]
fp[1.25]

t = Table[f[x], {c, -3, 3}]

g1 = 
      Plot[Evaluate[t], {x, -3, 3}, 
        PlotStyle -> {RGBColor[0.172549,  0.635294,  0.0156863], 
            RGBColor[0.0117647,  0.309804,  0.639216], 
            RGBColor[0.388235,  0.0196078,  0.627451], 
            RGBColor[0.023529,  0.0470588,  0.586275], 
            RGBColor[0.892157,  0.809804,  0.0235294], 
            RGBColor[1,  0.0431373,  0.0156863]}]

g2 = 
      Plot[fp[x], {x, -3, 3}, 
        PlotStyle -> Thickness[0.005]]

Show[g1,g2]

2. Nájdite všeobecné riešenie diferenciálnej rovnice (1+x)y'-x(1-y)=0
a partikulárne riešenie, ktoré vyhovuje začiatočnej podmienke
y(-1)=1. Nakreslite farebne sústavu integrálnych kriviek.

Clear All

DSolve[{(1+x)*y'[x]-x*(1-y[x])==0,y[-1]==1},y[x],x]//Simplify

Clear[y]
DSolve[(1 + x)*y'[x] - x*(1 - y[x]) == 0, y[x], 
      x]

f[x_] = 1 + c*(1 + x)*Exp[-x]

t = Table[f[x], {c, -3, 3}]

g1 = 
      Plot[Evaluate[t], {x, -3, 3}, 
        PlotStyle -> {RGBColor[0.172549,  0.635294,  0.0156863], 
            RGBColor[0.0117647,  0.309804,  0.639216], 
            RGBColor[0.388235,  0.0196078,  0.627451], 
            RGBColor[0.023529,  0.0470588,  0.586275], 
            RGBColor[0.892157,  0.809804,  0.0235294], 
            RGBColor[1,  0.0431373,  0.0156863]}]

3. Nájdite všeobecné riešenie diferenciálnej rovnice y'- 2*y/x = x^3 cos x
a partikulárne riešenie, ktoré vyhovuje začiatočným podmienkam
y(0)=0,y'(0)=0. Nakreslite farebne sústavu integrálnych kriviek, 
graf partikulárneho riešenia vyznačte hrubou čiernou čiarou.

Clear All
DSolve[y'[x]-2*y[x]/x==x^3*Cos[x],y[x],x]//Simplify

Clear[y]
DSolve[{y'[x]-2*y[x]/x==x^3*Cos[x],y[-2]==2},y[x],x]//Simplify

f[x_] = (x^2) (c + Cos[x] + x Sin[x])
fp[x_] = 
      (1/2) (x^2) (1 - 2 Cos[2] + 2 Cos[x] - 4 Sin[2] + 
            2 x Sin[x])

t = Table[f[x], {c, -3, 3}]

g1 = 
      Plot[Evaluate[t], {x, -9, 9}, 
        PlotStyle -> {RGBColor[0.172549,  0.635294,  0.0156863], 
            RGBColor[0.0117647,  0.309804,  0.639216], 
            RGBColor[0.388235,  0.0196078,  0.627451], 
            RGBColor[0.023529,  0.0470588,  0.586275], 
            RGBColor[0.892157,  0.809804,  0.0235294], 
            RGBColor[1,  0.0431373,  0.0156863]}]

g2 = 
      Plot[fp[x], {x, -9, 9}, 
        PlotStyle -> Thickness[0.005]]

Show[g1, g2]

4. Nájdite všeobecné riešenie diferenciálnej rovnice y''-y'+y=cos x
a partikulárne riešenie, ktoré vyhovuje začiatočným podmienkam
y(0)=0,y'(0)=0. Nakreslite farebne sústavu integrálnych kriviek pre rôzne hodnoty konštánt.

Clear All

DSolve[y''[x]-y'[x]+y[x]==Cos[x],y[x],x]//Simplify

Clear[y]
DSolve[{y''[x]-y'[x]+y[x]==Cos[x],y[0]==0,y'[0]==0},y[x],x]//Simplify

f[x_]= c1*Exp[x/2]*Cos[Sqrt[3]*x/2]-Sin[x]+c2*Exp[x/2]*Sin[Sqrt[3]*x/2]
fp[x_]=-Sin[x]+2*Exp[x/2]*Sin[Sqrt[3]*x/2]/Sqrt[3]

t1 = Table[f[x], {c1, -3, 3}, {c2, 0, 0}]

g1 = 
      Plot[Evaluate[t1], {x, -9, 9}, 
        PlotStyle -> {RGBColor[0.172549,  0.635294,  0.0156863], 
            RGBColor[0.0117647,  0.309804,  0.639216], 
            RGBColor[0.388235,  0.0196078,  0.627451], 
            RGBColor[0.023529,  0.0470588,  0.586275], 
            RGBColor[0.892157,  0.809804,  0.0235294], 
            RGBColor[1,  0.0431373,  0.0156863]}]

t2 = Table[f[x], {c1, 0, 0}, {c2, -3, 3}]

g2 = 
      Plot[Evaluate[t2], {x, -9, 9}, 
        PlotStyle -> {RGBColor[0.172549,  0.635294,  0.0156863], 
            RGBColor[0.0117647,  0.309804,  0.639216], 
            RGBColor[0.388235,  0.0196078,  0.627451], 
            RGBColor[0.023529,  0.0470588,  0.586275], 
            RGBColor[0.892157,  0.809804,  0.0235294], 
            RGBColor[1,  0.0431373,  0.0156863]}]

t3 = Table[f[x], {c1, -3, 3}, {c2, -3, 3}]

g3 = 
      Plot[Evaluate[t3], {x, -9, 9}, 
        PlotStyle -> {RGBColor[0.172549,  0.635294,  0.0156863], 
            RGBColor[0.0117647,  0.309804,  0.639216], 
            RGBColor[0.388235,  0.0196078,  0.627451], 
            RGBColor[0.023529,  0.0470588,  0.586275], 
            RGBColor[0.892157,  0.809804,  0.0235294], 
            RGBColor[1,  0.0431373,  0.0156863]}]

5. Nájdite všeobecné riešenie diferenciálnej rovnice y''+2y'+y=x e^(- x) 
a partikulárne riešenie, ktoré vyhovuje začiatočným podmienkam y(1)=0, y'(1)=2. 
Nakreslite farebne sústavu integrálnych kriviek pre rôzne hodnoty parametrov, 
graf partikulárneho riešenia vyznačte hrubou čiernou farbou.

Clear All
DSolve[y''[x] + 2  y'[x] + y[x] == x *Exp[-x], y[x], 
        x] // Simplify

Clear[y]
DSolve[{y''[x] + 2  y'[x] + y[x] == x*Exp[-x], 
          y[1] == 0, y'[1] == 2}, y[x], x] // 
      Simplify

f[x_] = 
      Exp[-x]*(x^3 + 6*c1 + 6*x*c2)/6
fp[x_] = Exp[-x]*(x - 1)*(x^2 + x + 12*E - 2)/6

t1 = Table[f[x], {c1, -3, 3}, {c2, 0, 0}]

g1 = 
      Plot[Evaluate[t1], {x, -3, 3}, 
        PlotStyle -> {RGBColor[0.172549,  0.635294,  0.0156863], 
            RGBColor[0.0117647,  0.309804,  0.639216], 
            RGBColor[0.388235,  0.0196078,  0.627451], 
            RGBColor[0.023529,  0.0470588,  0.586275], 
            RGBColor[0.892157,  0.809804,  0.0235294], 
            RGBColor[1,  0.0431373,  0.0156863]}]

t2 = Table[f[x], {c1, 0, 0}, {c2, -3, 3}]

g2 = 
      Plot[Evaluate[t2], {x, -3, 3}, PlotRange -> {-10, 15}, 
        PlotStyle -> {RGBColor[0.172549,  0.635294,  0.0156863], 
            RGBColor[0.0117647,  0.309804,  0.639216], 
            RGBColor[0.388235,  0.0196078,  0.627451], 
            RGBColor[0.023529,  0.0470588,  0.586275], 
            RGBColor[0.892157,  0.809804,  0.0235294], 
            RGBColor[1,  0.0431373,  0.0156863]}]

t3 = Table[f[x], {c1, -3, 3}, {c2, -3, 3}]

g3 = 
      Plot[Evaluate[t3], {x, -3, 3}, PlotRange -> {-10, 20}, 
        PlotStyle -> {RGBColor[0.172549,  0.635294,  0.0156863], 
            RGBColor[0.0117647,  0.309804,  0.639216], 
            RGBColor[0.388235,  0.0196078,  0.627451], 
            RGBColor[0.023529,  0.0470588,  0.586275], 
            RGBColor[0.892157,  0.809804,  0.0235294], 
            RGBColor[1,  0.0431373,  0.0156863]}]

g4 = 
      Plot[fp[x], {x, -3, 3}, 
        PlotStyle -> Thickness[0.005]]

Show[g3, g4]