# How can I get Mathematica to solve an equation with multiple variables?

How can I get mathematica to solve the non-homogeneous differential equation with undetermined coefficients listed below?

Solve $\ y''(t)+3y'(t) = 2t^4$, using: $\ y_p(t) = t(A_0t^4+A_1t^3+A_2t^2+A_3t+A_4)$

where $\ y_p(t)$ is a particular solution

incidentally, $\ y'(t) = A_4 + 2 A_3 t + 3 A_2 t^2 + 4 A_1 t^3 + 5 A_0 t^4$ and $\ y''(t) = 2 A_3 + 6 A_2 t + 12 A_1 t^2 + 20 A_0 t^3$

I'd like a solution that doesn't use `DSolve` because I can already solve the entire differential equation with that. I just need to see this particular part for verification of my work. Any suggestions?

-

1
I don't understand. Initially, you're giving us a differential equation, what's $y(t)$, an ansatz? And how are the initial conditions working here, you're giving us a) some functions where there should be points and b) the first/second derivative are not suitable initial conditions, zero-th and first are. And finally, what's wrong with DSolve? – David Feb 26 '12 at 19:47
ah. @David, so this question comes from a larger question. involving a non-homogenous differential equation with undetermined coefficients: $\ y''(t)+3y'(t)=2t^4 + t^2e^{-3t} + Sin(3t)$ Right now i'm focusing on the particular solution with the term $\ 2t^4$ hence the above question. As for why I'm not using `DSolve` I want to check my handwritten work. – franklin Feb 26 '12 at 20:30

## 2 Answers

If I understand the question correctly, you are looking for the solution of the differential equation

$$y''(t)+3y'(t) = 2t^4$$

in the form

$$y(t) = t(A_0t^4+A_1t^3+A_2t^2+A_3t+A_4).$$

That is, you need to find the values of the $A_i$ constants that satisfy this equation. Please clarify if this is what you are asking.

To do this in Mathematica, we can define

````y[t_] := t (t^4 Subscript[A, 0] + t^3 Subscript[A, 1] + 
            t^2 Subscript[A, 2] + t Subscript[A, 3] + Subscript[A, 4])
````

then use `SolveAlways`:

````SolveAlways[y''[t] + 3 y'[t] == 2 t^4, t]
````

-

Sorry about the subscripts, I copied the MathML.  @franklin please consider posting in Mathematica syntax when possible. – Szabolcs Feb 26 '12 at 20:32
@Szablocs,that is correct. I am looking for the values of $\ A_i$ for $\ i = {0..4}$ that satisfy the equation. For further calrification, this syntax `t*(t^4*Subscript[A,0]) ` is preferable to $\ t(t^4A_0)$ right? Thanks so much for the help. – franklin Feb 26 '12 at 20:42
@franklin Actually `A0` is preferably, for the simple reason that it is both readable and easy to paste into Mathematica.  If you write something merely to explain, but it'll never need to be pasted into Mathematica, then math notation is of course more readable. – Szabolcs Feb 26 '12 at 20:47

You can make a WolframAlpha query directly from Mathematica (shortcut `==`) :

````Solve y''(t)+3y'(t)=2t^4
````

Then just click the show steps link.

-

mathematica does beautiful work when it comes to showing the steps but this isn't exactly what i was looking for @Artes – franklin Feb 26 '12 at 20:46
@franklin Look at the last line in Show steps : "The general solution is: ..." which is what you were looking for, if you set `c1=c2=0`. As Szabolcs' solution works fine here you can still find my approach simpler and faster, so it can be pretty helpful for you. – Artes Feb 26 '12 at 20:57
lang-mma
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 12, "mathjax_display_tex": 2, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9114042520523071, "perplexity_flag": "middle"}