I have been looking on wolfram reference and here regarding a method to develop solutions for an ODE based on forming an Ansatz and use Mathematica to find the coefficients.
I take the example.
$y''+4y=x^3$
I want to find the unknown coefficients of the Ansatz. We know the ansatz for $y_p$ is $Ax^3+Bx^2+Cx+D$.
So I compute the following:
VL1[y_] := D[y, x, x] + 4 y yp = A1 + B1*x + C1*x^2 + D1*x^3 (*Ansatz*) VL1[yp1] VL1[yp] == x^3 /. {{x -> 1}, {x -> 2}, {x -> 3}, {x -> 0}} sol = Solve[%, {A1, B1, C1, D1}] yp /. sol This works well and give the particular solution
$y_p=-\frac{3x}{8} + \frac{x^3}{4}$
However, when I want to develop this into the variation of parameters method for the example:
$y''+4y'-8y=\cos x$
I am stuck. The problem is that the Ansatz is no longer containing variables and coefficients, but unknown functions. The ansatz for this is $y_p=u\cos x+v\sin x$, where $u$ and $v$ are the unknown functions to be found.
Any ideas?
Thanks



