4.1.39 \(y'(x)=f(x)+g(x) y(x)\)

ODE
\[ y'(x)=f(x)+g(x) y(x) \] ODE Classification

[_linear]

Book solution method
Linear ODE

Mathematica
cpu = 0.486403 (sec), leaf count = 44

\[\left \{\left \{y(x)\to e^{\int _1^x g(K[1]) \, dK[1]} \left (\int _1^x f(K[2]) e^{-\int _1^{K[2]} g(K[1]) \, dK[1]} \, dK[2]+c_1\right )\right \}\right \}\]

Maple
cpu = 0.06 (sec), leaf count = 24

\[ \left \{ y \left ( x \right ) = \left ( \int \!f \left ( x \right ) {{\rm e}^{-\int \!g \left ( x \right ) \,{\rm d}x}}\,{\rm d}x+{\it \_C1} \right ) {{\rm e}^{\int \!g \left ( x \right ) \,{\rm d}x}} \right \} \] Mathematica raw input

DSolve[y'[x] == f[x] + g[x]*y[x],y[x],x]

Mathematica raw output

{{y[x] -> E^Integrate[g[K[1]], {K[1], 1, x}]*(C[1] + Integrate[f[K[2]]/E^Integra
te[g[K[1]], {K[1], 1, K[2]}], {K[2], 1, x}])}}

Maple raw input

dsolve(diff(y(x),x) = f(x)+g(x)*y(x), y(x),'implicit')

Maple raw output

y(x) = (Int(f(x)*exp(-Int(g(x),x)),x)+_C1)*exp(Int(g(x),x))