-1
$\begingroup$

Here's what I've done:math

Basically I want to differentiate an expression once, then twice and finally use these two results to calculate the expression $$y''-2y'+2y = 4e^x\sin(x)$$ where $y(x) = xe^x(A\cos(x)+B\sin(x))$. My goal is to find constants $A,B$ such that the equality holds. Now using walfram alpha I get that $B=0$ and $A=-2$ as you can see from here: math2

Where did I go wrong with Mathematica? Or is it a mistake in my way of solving it? (consider that I've already found the solution to the homogeneous equation)

$\endgroup$
  • $\begingroup$ Wait I've messed up in one of the lines somehow $\endgroup$ – Euler_Salter Feb 4 '17 at 13:08
  • 3
    $\begingroup$ Please do not post images of your work, especially when the images display at a size that make them difficult to read. Please post your actual Mathematica code in the form of text that can be copied and pasted into a Mathematica notebook. Without such, it will be difficult to reproduce your problem and to experiment with possible solutions. $\endgroup$ – m_goldberg Feb 4 '17 at 14:07
1
$\begingroup$

Try this:

    y''[x] - 2 y'[x] + 2 y[x] - 4 Exp[x]*Sin[x] /. 
  y -> (#*Exp[#]*(A*Cos[#] + B*Sin[#]) &) // Simplify

(* 2 E^x (B Cos[x] - (2 + A) Sin[x]) *)

from where B=0 and A=-2.

Have fun!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.