Mathematica and Variation of Parameters

Click For Summary

Discussion Overview

The discussion revolves around the solution of a second-order ordinary differential equation (ODE) using the method of variation of parameters. Participants explore the discrepancies between a manually derived solution and the output from Mathematica's DSolve function.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant presents a second-order ODE and their solution using variation of parameters, expressing concern over discrepancies with Mathematica's output.
  • Another participant confirms the Mathematica output and suggests that it is likely correct, indicating a high confidence level in Mathematica's reliability.
  • A different participant challenges the original solution, asserting that certain terms (like x^5cos(x) and x^4sin(x)) should not appear based on their own calculations using variation of parameters.
  • One participant verifies the Mathematica solution by substituting it back into the original differential equation, confirming that it satisfies the equation.
  • A later reply indicates that the original poster has resolved their misunderstanding and now agrees with Mathematica's solution.

Areas of Agreement / Disagreement

The discussion includes multiple competing views regarding the correctness of the manual solution versus Mathematica's output. Initially, there is disagreement, but one participant later acknowledges their error, leading to a resolution of their own confusion.

Contextual Notes

Participants express uncertainty about the correctness of their manual calculations and the potential for errors in applying the variation of parameters method. The discussion highlights the complexity of integrating certain terms and the reliance on computational tools for verification.

Who May Find This Useful

This discussion may be useful for individuals interested in solving second-order ODEs, particularly those exploring the method of variation of parameters and the use of computational tools like Mathematica for verification of solutions.

jaseh86
Messages
37
Reaction score
0
Hi, I was solving the following second order ODE:

[PLAIN]http://www.texify.com/img/%5CLARGE%5C%21x%5E2%20y%5E%27%27-5xy%5E%27%2B5y%3Dx%5E6%20sinx.gif

I used variation of parameters and found this solution:

[PLAIN]http://www.texify.com/img/%5CLARGE%5C%21y%3DC_1%20x%20%2B%20C_2%20x%5E5%20-%20180%20x%20Cosx%20%2B%2090%20x%5E3%20Cosx%20-%20%20%207%20x%5E5%20Cosx%20-%20180%20x%5E2%20Sinx%20%2B%2030%20x%5E4%20Sinx%20-%20x%5E6%20Sinx.gif

However if I try DSolve in mathematica, the answer I get is instead:

[PLAIN]http://www.texify.com/img/%5CLARGE%5C%21y%5Bx%5D%20-%3E%20x%20C%5B1%5D%20%2B%20x%5E5%20C%5B2%5D%20%2B%206%20x%20Cos%5Bx%5D%20-%203%20x%5E3%20Cos%5Bx%5D%20%2B%206%20x%5E2%20Sin%5Bx%5D%20-%20%20%20x%5E4%20Sin%5Bx%5D.gif

Can anyone verify my answer? (Warning: quite long to integrate) Either I'm typing something wrong in mathematica, I miscalculated the solution or mathematica uses the wrong algorithm.

Thanks.
 
Last edited by a moderator:
Physics news on Phys.org
Woops I just realized that none of the equations showed up. Sorry! Let me try again with latex this time.

The equation was:

x^2 y'' - 5xy' + 5y = x^6 sinx



I used variation of parameters by hand and found this solution:

y = C_1 x + C_2 x^5 -180 x cosx + 90 x^3 cosx - 7 x^5 cosx - 180 x^2 sinx + <br /> 30 x^4 sinx - x^6 sinx<br />


However if I try DSolve in mathematica, the answer I get is instead:

y = C_1 x + C_2 x^5 +6 x cosx - 3 x^3 cosx + 6 x^2 sinx - x^4 sinx<br />

Can anyone verify my answer? (Warning: quite long to integrate) Either I'm typing something wrong in mathematica, I miscalculated the solution or mathematica uses the wrong algorithm.

Thanks.
 
This is what I get:

<br /> \begin{aligned}<br /> &amp;\text{DSolve}[x{}^{\wedge}2 y\text{&#039;&#039;}[x]-5 x y&#039;[x]+5 y[x]==x{}^{\wedge}6 \text{Sin}[x],y,x]<br /> \\<br /> &amp;\left\{\left\{y\to \text{Function}\left[\{x\},x C[1]+x^5 C[2]+6 x \text{Cos}[x]-3 x^3 \text{Cos}[x]+6 x^2 \text{Sin}[x]-x^4 \text{Sin}[x]\right]\right\}\right\}<br /> \end{aligned}<br />

And I think it's good you're using Mathematica to confirm or at least get a handle on, your problem. So that's what I got and Mathematica is pretty good at this, probably 99% or better so good chance that's the right answer. So either you can express your answer in terms of this one, or I'd say there is at least a 99% chance your manual calculations are wrong. And there again, Mathematica can help you: do a step manually, then do it in Mathematica. If agree, then continue, if not, probably you made a mistake and need to correct it before going to the next comparison.
 
You will certainly NOT get terms like x^5cos(x) and x^4sin(x).

When I use "variation of parameters" with y(x)= xu(x)+ x^5v(x), I wind up with the equations v&#039;= (1/4) sin(x), which is easy to integrate, and u&#039;= -(1/4)x^4sin(x) which requires a long integration by parts and gives powers of x times sine and cosine but not any powers of x greater than 4.
 
HallsofIvy said:
You will certainly NOT get terms like x^5cos(x) and x^4sin(x)..

I don't understand this comment. When I back-substitute the Mathematica solution into the DE, I obtain equality:

Code:
In[6]:=
myf[x_] := x*C[1] + x^5*C[2] + 
    6*x*Cos[x] - 3*x^3*Cos[x] + 
    6*x^2*Sin[x] - x^4*Sin[x]; 
FullSimplify[x^2*D[myf[x], {x, 2}] - 
   5*x*D[myf[x], x] + 5*myf[x]]

Out[7]=
x^6*Sin[x]
 
Ah. I figured out where I went wrong. Wow what a silly error.

My answer now agrees with mathematica *phew*.

Thanks for the replies everyone!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K