The Method of Undetermined Coefficients for Linear Differential Equations with Constant Coefficients and Special Right-Hand Side
Author
Vojtěch (Vojtech) Bartík (Bartik)
Title
The Method of Undetermined Coefficients for Linear Differential Equations with Constant Coefficients and Special Right-Hand Side
Description
Tools for all steps in solving linear differential equations with constant coefficients and special right-hand side as usually explained in most courses of analysis.
Category
Working Material
Keywords
URL
http://www.notebookarchive.org/2021-10-cxsum6u/
DOI
https://notebookarchive.org/2021-10-cxsum6u
Date Added
2021-10-28
Date Last Modified
2021-10-28
File Size
213.54 kilobytes
Supplements
Rights
Redistribution rights reserved



The Method of Undetermined Coefficients
for Linear Differential Equations with
Constant Coefficients
The Method of Undetermined Coefficients
for Linear Differential Equations with
Constant Coefficients
for Linear Differential Equations with
Constant Coefficients
Vojtěch Bartík, May 2021
(*Name:LDEwCC*)(*Title:TheMethodofUndeterminedCoefficientsforLinearDifferentialEquationswithConstantCoefficients*)(*Author:VojtěchBartík*)(*Summary:*)(*Context:LDEwCC`*)(*PackageVersion:January2021*)(*MathematicaVersion:Mathematica12.3*)(*History:ThefirstversionforMathematica3.0seemstobecreatedin1997whentheauthorwasteachingdifferentialequationsatFacultyofElectricityofCzechTechnicalUniversityinPrague.In1998,2000,2002,2004and2008thetextwassuccesivelycorrected,extendedandaddaptedforMathematicaversions4.0and5.0.In2019-2021thisversionwasadoptedforMathematica11and12.*)
Demo
RootMultiplicity
RootMultiplicity
RootMultiplicity[expr,x,λ]
expr
x
λ
λ
expr
Indeterminate
Example
Example
eqn=12-5-+0
2
x
3
x
4
x
12-5-+0
2
x
3
x
4
x
roots=x/.Solve[eqn,x]
2,2,(-3-(-3+
1
2
3
),1
2
3
){RootMultiplicity[eqn,x,#]&/@roots,RootMultiplicity[eqn,x,#]&/@(roots+)}
-1000
10
{{2,2,1,1},{0,0,0,0}}
Example
Example
eqn=-243+621x-534+178-23+0
2
x
3
x
4
x
5
x
-243+621x-534+178-23+0
2
x
3
x
4
x
5
x
roots=x/.Solve[eqn,x]
{1,1,3,9,9}
{RootMultiplicity[eqn,x,#]&/@roots,RootMultiplicity[eqn,x,#]&/@(roots+)}
-1000
10
{{2,2,1,2,2},{0,0,0,0,0}}
Example
Example
eqn=14764-8524+1628-3456+1996+81-49+417-236+6-10-18+16-3-+0
3
+11196x-64643
x-28202
x
3
2
x
3
x
3
3
x
4
x
3
4
x
5
x
3
5
x
6
x
3
6
x
7
x
3
7
x
8
x
3
8
x
9
x
14764-8524+1628-3456+1996+81-49+417-236+6-10-18+16-3-+0
3
+11196x-64643
x-28202
x
3
2
x
3
x
3
3
x
4
x
3
4
x
5
x
3
5
x
6
x
3
6
x
7
x
3
7
x
8
x
3
8
x
9
x
roots=x/.Solve[eqn,x]//Union
2-
3
,-1+3
{RootMultiplicity[eqn,x,#]&/@roots,RootMultiplicity[eqn,x,#]&/@(roots+)}
-1000
10
{{4,5},{0,0}}
Example
Example
eqn=+2+1==0
3
x
2
x
1+2+0
2
x
3
x
{roots=x/.Solve[eqn,x,CubicsFalse]//Sort,roots//N}
,
,
,{-2.20557,0.102785-0.665457,0.102785+0.665457}
-2.21
…
0.103
-…
0.665
…
0.103
+…
0.665
…
{RootMultiplicity[eqn,x,#]&/@roots,RootMultiplicity[eqn,x,#]&/@(roots+)}
-1000
10
{{1,1,1},{0,0,0}}
Example
Example
eqn=+π+==0
3
x
2
x
+π+0
2
x
3
x
{roots=x/.Solve[eqn,x,CubicsFalse]//Sort,roots//N,x/.NSolve[eqn,x]}
,
,
,{-3.37959,0.118997-0.888911,0.118997+0.888911},{-3.37959,0.118997-0.888911,0.118997+0.888911}
-3.38
…
0.119
-…
0.889
…
0.119
+…
0.889
…
{RootMultiplicity[eqn,x,#]&/@roots,RootMultiplicity[eqn,x,#]&/@(roots+)}
-1000
10
{{1,1,1},{0,0,0}}
QuasiPolynomialQ, SimpleQuasiPolynomialQ, ToQuasiPolynomial
QuasiPolynomialQ, SimpleQuasiPolynomialQ, ToQuasiPolynomial
QuasiPolynomialQ[expr,x]
expr
expr
p
p*Exp[a*x+b]
q*Cos[c*x+d]
q*Sin[c*x+d]
p*Exp[a*x+b]*Cos[c*x+d]
p*Exp[a*x+b]*Sin[c*x+d]
p
x
q
x
a,b,c,d
c,d
a,c
b,d
SimpleQuasiPolynomialQ[expr,x]
QuasiPolynomialQ[expr,x]==True
expr
ToQuasiPolynomial[expr,x,f]
expr
expr
f
Example
Example
poly1=1++Cos[x]+xSin[3x+1];poly2=Cos[x]+Sin[3x+1]+xCosh[2x-1];poly3=Cos[x]+Sin[3x+1]Cos[2x-1];Column[{poly1,poly2,poly3},Center]
2
x
2
x
2x+1
2x+1
2
x
2x+1
1+ 2 x 1+2x 2 x |
1+2x 2 x |
1+2x |
QuasiPolynomialQ[#,x]&/@{poly1,poly2,poly3}
{True,False,False}
Example
Example
poly1=1++;poly2=Cos[3x+1]+Sin[3x+1];poly3=xCos[x]+Sin[x];poly4=1+Cos[x];Column[{poly1,poly2,poly3,poly4},Center]
2
x
3
x
2
x
x
2
x
x
1+ 2 x 3 x |
2 x |
x x 2 x |
1+Cos[x] |
SimpleQuasiPolynomialQ[#,x]&/@{poly1,poly2,poly3,poly4}
{True,True,True,False}
Example
Example
poly1=Sin[2-3x];poly2=Sin[2-3x];{poly1,poly2}
2
x
2
Cos[2x+1]
2
x
2
Cos[2x+1]
x
Sin[2-3x],Sin[2-3x]
2
x
2
Cos[1+2x]
x
2
x
2
Cos[1+2x]
QuasiPolynomialQ[#,x]&/@{poly1,poly2}
{False,False}
ToQuasiPolynomial[#,x]&/@{poly1,poly2}//Column[#,Center,Spacings1.5]&
1 2 2 x 1 4 2 x 1 4 2 x |
- 1 8 -6x 2 x 1 8 8x 2 x 1 4 -2x 2 x 1 4 4x 2 x 1 8 2 x 1 8 2x 2 x 1 4 -2x 2 x 1 4 4x 2 x 1 8 2 x 1 8 2x 2 x |
QuasiPolynomialQ[#,x]&/@%[[1]]
{True,True}
ToQuasiPolynomial[#,x,Complex]&/@{poly1,poly2}//Column[#,Center,Spacings1.5]&
1 8 -4-x 2 x 1 8 4+x 2 x 1 4 2-3x 2 x 1 4 -2+3x 2 x 1 8 -7x 2 x 1 8 7x 2 x |
1 8 -4 2 x 1 4 2-2x 2 x 1 8 4+2x 2 x 1 4 -2+4x 2 x 1 8 -6x 2 x 1 8 8x 2 x |
QuasiPolynomialQ[#,x]&/@%[[1]]
{True,True}
Example
Example
poly1=Sinh[2-3x];poly2=Sinh[2-3x];{poly1,poly2}
2
x
2
Cos[2x+1]
2
x
2
Cos[2x+1]
x
Sinh[2-3x],Sinh[2-3x]
2
x
2
Cos[1+2x]
x
2
x
2
Cos[1+2x]
QuasiPolynomialQ[#,x]&/@{poly1,poly2}
{False,False}
ToQuasiPolynomial[#,x]&/@{poly1,poly2}//Column[#,Center,Spacings1.5]&
1 4 2-3x 2 x 1 4 -2+3x 2 x 1 4 2-3x 2 x 1 4 -2+3x 2 x |
1 4 2-(3-)x 2 x 1 4 -2+(3+)x 2 x 1 8 2-(3+3)x 2 x 1 8 2-(3-5)x 2 x 1 8 -2+(3-3)x 2 x 1 8 -2+(3+5)x 2 x 1 8 2-(3+3)x 2 x 1 8 2-(3-5)x 2 x 1 8 -2+(3-3)x 2 x 1 8 -2+(3+5)x 2 x |
QuasiPolynomialQ[#,x]&/@%[[1]]
{True,True}
ToQuasiPolynomial[#,x,Complex]&/@{poly1,poly2}//Column[#,Center,Spacings1.5]&
1 4 2-3x 2 x 1 8 (2-2)-(3+4)x 2 x 1 8 (2+2)-(3-4)x 2 x 1 4 -2+3x 2 x 1 8 (-2-2)+(3-4)x 2 x 1 8 (-2+2)+(3+4)x 2 x |
1 4 2-(3-)x 2 x 1 8 (2-2)-(3+3)x 2 x 1 8 (2+2)-(3-5)x 2 x 1 4 -2+(3+)x 2 x 1 8 (-2-2)+(3-3)x 2 x 1 8 (-2+2)+(3+5)x 2 x |
QuasiPolynomialQ[#,x]&/@%[[1]]
{True,True}
DiffOrder, LinearDEQ, LinearDEwCCQ, StandardLDEFormQ, ToStandardLDEForm
DiffOrder, LinearDEQ, LinearDEwCCQ, StandardLDEFormQ, ToStandardLDEForm
DiffOrder[expr,y|y[x],x]
LinearDEQ[expr,y|y[x],x]
expr
y[x]
x
y
x
LinearDEwCCQ[expr,y|y[x],x]
expr
y[x]
x
y
x
StandardLDEFormQ[expr,y|y[x],x]
expr
y[x]
x
y[x]
y[x]
y
x
ToStandardLinearDEForm[expr,y|y[x],x]
expr
y[x]
x
y
y
y
x
Example
Example
eqn1=y''[x]+Sin[x]y'[x]+xy[x]0;eqn2=y''[x]+Sin[x]y'[x]+x;eqn3=y''[x]+Sin[x]y'[x]+xy[x]Exp[y[x]];eqn4=y'''[x]+Sin[x]y'[x]+xy[x]Plus[y[x],y'[x]];eqn5=y''[x]+5y'[x]y[x]==Cos[x];eqn6=y'''[x]+5y'[x]+πy[x]==y[Exp[x]];eqn7=y'''[x]+5y'[x]+πy[x]Exp[2x+2]Cos[3-x];
-1
y[x]
{DiffOrder[#,y,x]&/@{eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,eqn7},LinearDEQ[#,y,x]&/@{eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,eqn7},LinearDEwCCQ[#,y,x]&/@{eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,eqn7}}//Column[#,Center]&
{2,2,2,3,2,3,3} |
{True,False,False,True,True,False,True} |
{False,False,False,False,False,False,True} |
Example
Example
Clear[f];eqn1=y[x]+y'[x]+5y''[x]-Cos[x]Sin[3x]-xCos[x]==Exp[2x]+2xy'[x];eqn2=y'[x]+2y''[x]-(-1)y'''[x]-f[x]Cos[x]==xSin[x];{eqn1,eqn2}//Column[#,Center]&
2
x
-xCos[x]-Cos[x]Sin[3x]+y[x]+ ′ y ′′ y 2x ′ y |
-Cos[x]f[x]+ ′ y ′′ y 2 x (3) y |
{LinearDEQ[#,y,x]&/@{eqn1,eqn2},StandardLDEFormQ[#,y,x]&/@{eqn1,eqn2}}
{{True,True},{False,False}}
ToStandardLDEForm[#,y,x]&/@{eqn1,eqn2}//Column[#,Center]&
y[x]+(1-2x) ′ y ′′ y 2x |
′ y ′′ y 2 x (3) y |
CharacteristicEquation[expr,y|y[x],x,λ],EigenValues[expr,y|y[x],x,λ]
CharacteristicEquation[expr,y|y[x],x,λ]
EigenValues[expr,y|y[x],x,λ]
CharacteristicEquation[expr,y|y[x],x,λ]
expr
y[x]
expr
λ
y
x
Example
Example
Clear[f];eqn1=y'''[x]+5y'[x]+πy[x]Exp[2x+2]Cos[3-x];eqn2=y[x]+xy'[x]+y''[x]==Cos[x]Sin[3x]-xCos[x];eqn3=y[x]+5y''[x]-Cos[x]Sin[3x]f[x]+2y'[x];eqn4=y''''[x]-6y'''[x]+12y''[x]-10y'[x]+3y[x]0;LinearDEwCCQ[#,y,x]&/@{eqn1,eqn2,eqn3,eqn4}
{True,False,True,True}
CharacteristicEquation[#,y,x,λ]&/@{eqn1,eqn2,eqn3,eqn4}
{π+5λ+0,$Failed,1-2λ+50,3-10λ+12-6+0}
3
λ
2
λ
2
λ
3
λ
4
λ
EigenValues[#,y,x]&/@{eqn1,eqn2,eqn3,eqn4}
,
,
,$Failed,-,+,{1,1,1,3}
-0.588
…
0.294
-…
2.29
…
0.294
+…
2.29
…
1
5
2
5
1
5
2
5
ComplementarySolution, Fundamental System
ComplementarySolution, Fundamental System
ComplementarySolution[expr,y,x,f,opts]
expr
y[x]
x
Function[b]
- If the second argument y is replaced by y[x], the solution is given in the form
Function[b][x]
- If the characteristic equation cannot be solved, $Failed is returned.
- The fourth argument
f
Cos
Sin
- The list {opts} of named optional arguments should be a sublist of the list Options[Solve].
- The result may depend on the optional arguments of the command Simplify and its form may also depend on the options of Solve.
- The expressions y and x are supposed, in general, to be symbols not from the context System`.
FundamentalSystem[expr,y,x,f,opts]
expr
y[x]
expr
- If the second argument
y
y[x]
- If the characteristic equation cannot be solved, $Failed is returned.
- The fourth argument
f
- The list {opts} of named optional arguments should be a sublist of the list Options[Solve].
- The result may depend on the optional arguments of the command Simplify and its form may also depend on the options of Solve.
- The expressions
y
x
Example
Example
eqn1=y''[x]+3y'[x]+2y[x]0
2y[x]+3[x]+[x]0
′
y
′′
y
{ComplementarySolution[eqn1,y,x],ComplementarySolution[eqn1,y[x],x]}
{{y(+&)},{y[x]+}}
-2#1
1
-#1
2
-2x
1
-x
2
{FundamentalSystem[eqn1,y,x],FundamentalSystem[eqn1,y[x],x]}
{{&,&},{,}}
-2#1
-#1
-2x
-x
Example
Example
eqn2=y''''[x]-6y'''[x]+12y''[x]-10y'[x]+3y[x]0
3y[x]-10[x]+12[x]-6[x]+[x]0
′
y
′′
y
(3)
y
(4)
y
{ComplementarySolution[eqn2,y,x],ComplementarySolution[eqn2,y[x],x]}//Column[#,Center]&
y 3#1 4 #1 1 2 3 2 #1 |
y[x] x 1 2 2 x 3 3x 4 |
{FundamentalSystem[eqn2,y,x],FundamentalSystem[eqn2,y[x],x]}
{{&,&,#1&,&},{,,x,}}
#1
3#1
#1
#1
2
#1
x
3x
x
x
2
x
Example
Example
eqn2=y''[x]+2y'[x]+3y[x]1+x+
2
x
3y[x]+2[x]+[x]1+x+
′
y
′′
y
2
x
{ComplementarySolution[eqn2,y,x],ComplementarySolution[eqn2,y[x],x]}//Column[#,Center]&
y -#1 2 #1]C 0 2 #1]C 1 |
y[x] -x 2 x]C 0 2 x]C 1 |
{ComplementarySolution[eqn2,y,x,Complex],ComplementarySolution[eqn2,y[x],x,Complex]}
y+&,y[x]+
(-1-
2
)#1
1
(-1+
2
)#1
2
(-1-
2
)x
1
(-1+
2
)x
2
{FundamentalSystem[eqn2,y,x],FundamentalSystem[eqn2,y[x],x]}
Cos[Sin[Cos[Sin[
-#1
2
#1]&,-#1
2
#1]&,-x
2
x],-x
2
x]{FundamentalSystem[eqn2,y,x,Complex],FundamentalSystem[eqn2,y[x],x,Complex]}
&,&,,
(-1-
2
)#1
(-1+
2
)#1
(-1-
2
)x
(-1+
2
)x
TrialSolutionPart, TrialSolutionPartEquations, ParticularSolutionPart
TrialSolutionPart, TrialSolutionPartEquations, ParticularSolutionPart
TrialSolutionPart[expr,y,x]
y[x]
x
rhs
expr
{yFunction[b]}
the body of the pure function is a simple quasipolynomial with undetermined coefficients the values of which can be uniquely determined from a system of linear equations.
- If the second argument
y
y[x]
{y[x]->Function[b][x]}
- The result depends on ability of Mathematica to determine the multiplicity of certain (generally complex) number associated with the quasipolynomial
rhs
expr
- The expressions
y
x
TrialSolutionPartEquations[expr,y|y[x],x]
y[x]
x
rhs
TrialSolutionPart[expr,y|y[x],x,f]
- The result depends on ability of Mathematica to determine the multiplicity of certain (generally complex) number associated with the quasipolynomial
rhs
expr
- The expressions
y
x
ParticularSolutionPart[expr,y,x]
expr
y[x]
x
rhs
expr
expr
{yFunction[b]}
- If the second argument is replacef by y[x], the result has the form
{y[x]->Function[b][x]}
- The result depends on ability of Mathematica to determine the multiplicity of certain (generally complex) number associated with the quasipolynomial
rhs
expr
- The expressions y and x are supposed, in general, to be symbols not from the context System`.
Example
Example
eqn1=y''[x]+3y'[x]+2y[x]
2
x
2y[x]+3[x]+[x]
′
y
′′
y
2
x
{TrialSolutionPart[eqn1,y,x],TrialSolutionPart[eqn1,y[x],x]}
y+#1+&,y[x]+x+
0
1
2
2
#1
0
1
2
x
2
TrialSolutionPartEquations[eqn1,y,x]//Column[#,Center]&
2 0 1 2 2 x 2 1 2 2 x |
*** |
2 0 1 2 |
2 0 1 2 |
2 0 1 2 |
{ParticularSolutionPart[eqn1,y,x],ParticularSolutionPart[eqn1,y[x],x]}
y-+&,y[x]-+
7
4
3#1
2
2
#1
2
7
4
3x
2
2
x
2
eqn1/.ParticularSolutionPart[eqn1,y,x]//Simplify
True
Example
Example
eqn2=y''[x]+3y'[x]1+
2
x
3[x]+[x]1+
′
y
′′
y
2
x
{TrialSolutionPart[eqn2,y,x],TrialSolutionPart[eqn2,y[x],x]}
y#1++&,y[x]x++
0
1
2
#1
2
3
#1
0
2
x
1
3
x
2
TrialSolutionPartEquations[eqn2,y,x]//Column[#,Center]&
3 0 1 2 x 2 1 2 2 x |
*** |
3 0 1 |
3 0 1 2 |
3 0 1 2 |
{ParticularSolutionPart[eqn2,y,x],ParticularSolutionPart[eqn2,y[x],x]}
y-+&,y[x]-+
11#1
27
2
#1
9
3
#1
9
11x
27
2
x
9
3
x
9
eqn2/.ParticularSolutionPart[eqn2,y,x]//Simplify
True
Example
Example
eqn3=y''[x]+3y'[x]+2y[x]Cos[2x+1]
2y[x]+3[x]+[x]Cos[1+2x]
′
y
′′
y
{TrialSolutionPart[eqn3,y,x],TrialSolutionPart[eqn3,y[x],x]}//Column[#,Center]&
{y(Cos[1+2#1] C 0 C 1 |
{y[x]Cos[1+2x] C 0 C 1 |
TrialSolutionPartEquations[eqn3,y,x]//Column[#,Center]&
Sin[1+2x](-6 C 0 C 1 C 0 C 1 |
*** |
-2 C 0 C 1 |
-2(3 C 0 C 1 |
{ParticularSolutionPart[eqn3,y,x],ParticularSolutionPart[eqn3,y[x],x]}//Column[#,Center]&
y- 1 20 3 20 |
y[x]- 1 20 3 20 |
eqn3/.ParticularSolutionPart[eqn3,y,x]//Simplify
True
Example
Example
eqn4=y''[x]+3y'[x]+2y[x](1+)
-2x
2
x
2y[x]+3[x]+[x](1+)
′
y
′′
y
-2x
2
x
{TrialSolutionPart[eqn4,y,x],TrialSolutionPart[eqn4,y[x],x]}//Column[#,Center]&
y -2#1 0 1 2 #1 2 3 #1 |
y[x] -2x 0 2 x 1 3 x 2 |
TrialSolutionPartEquations[eqn4,y,x]//Column[#,Center]&
-2x 0 1 -2x 2 x 2 -2x 1 2 -2x -2x 2 x |
*** |
- 0 1 |
-2 1 2 |
-3 2 |
{ParticularSolutionPart[eqn4,y,x],ParticularSolutionPart[eqn4,y[x],x]}//Column[#,Center]&
y -2#1 2 #1 3 #1 3 |
y[x] -2x 2 x 3 x 3 |
eqn4/.ParticularSolutionPart[eqn4,y,x]//Simplify
True
Example
Example
eqn5=y''[x]+9y[x](1+x)Sin[3x]
9y[x]+[x](1+x)Sin[3x]
′′
y
{TrialSolutionPart[eqn5,y,x],TrialSolutionPart[eqn5,y[x],x]}//Column[#,Center]&
yCos[3#1]#1 C 0 2 #1 C 0 C 1 2 #1 C 1 |
y[x]Cos[3x]x C 0 2 x C 0 C 1 2 x C 1 |
TrialSolutionPartEquations[eqn5,y,x]//Column[#,Center]&
-12xSin[3x] C 0 C 0 C 1 C 1 C 0 C 1 |
*** |
2( C 0 C 1 |
12 C 1 |
-6 C 0 C 1 |
-12 C 0 |
{ParticularSolutionPart[eqn5,y,x],ParticularSolutionPart[eqn5,y[x],x]}//Column[#,Center]&
y 1 36 #1 6 2 #1 12 |
y[x]- x 6 2 x 12 1 36 |
eqn5/.ParticularSolutionPart[eqn5,y,x]//Simplify
True
Example
Example
eqn6=y''[x]+4y'[x]+13y[x]((1+x)Sin[3x]+Cos[3x])
2x
13y[x]+4[x]+[x](Cos[3x]+(1+x)Sin[3x])
′
y
′′
y
2x
{TrialSolutionPart[eqn6,y,x],TrialSolutionPart[eqn6,y[x],x]}//Column[#,Center]&
y 2#1 C 0 C 0 C 1 C 1 |
y[x] 2x C 0 C 0 C 1 C 1 |
TrialSolutionPartEquations[eqn6,y,x]//Column[#,Center]&
2x C 0 C 0 C 1 C 1 C 0 C 1 2x C 0 C 0 C 1 C 1 C 0 C 1 2x 2x 2x |
*** |
16 C 0 C 0 C 1 C 1 |
8(2 C 0 C 1 |
-24 C 0 C 0 C 1 C 1 |
-24 C 0 C 1 |
{ParticularSolutionPart[eqn6,y,x],ParticularSolutionPart[eqn6,y[x],x]}//Column[#,Center]&
y 2#1 11 5408 3#1 104 61 1352 #1 52 |
y[x] 2x 11 5408 3x 104 61 1352 x 52 |
eqn6/.ParticularSolutionPart[eqn6,y,x]//Simplify
True
ApplySuperposition, TrialSolutionParts, TrialSolutionPartsEquations, ParticularSolutionParts
ApplySuperposition, TrialSolutionParts, TrialSolutionPartsEquations, ParticularSolutionParts
ApplySuperposition[expr,y|y[x],x,f]
expr
y[x]
x
ToQuasiPolynomial[rhs,x,f]
- If expr is not a LDE for a function y[x] or the righthand side of its the standard form isn’t a generalized quasipolynomial, {$Failed} is returned.
- The last argument
f
f
Complex
Cos
Sin
- The expressions
y
x
TrialSolutionParts
TrialSolutionParts
TrialSolutionParts[expr,y|y[x],x,f]
expr
y[x]
x
expr
TrialSolutionPart
ApplySuperposition[expr,y|y[x],x,f]
- The expressions y and x are supposed, in general, to be symbols not from the context System`.
TrialSolutionPartsEquations
TrialSolutionPartsEquations
TrialSolutionPartsEquations[expr,y|y[x],x,f]
expr
y[x]
x
expr
TrialSolutionPartEquations
ApplySuperposition[expr,y|y[x],x,f]
- The expressions y and x are supposed, in general, to be symbols not from the context System`.
ParticularSolutionParts
ParticularSolutionParts
ParticularSolutionParts[expr,y|y[x],x,f]
expr
y[x]
x
expr
ParticularSolutionPart
ApplySuperposition[expr,y|y[x],x,f]
- The expressions y and x are supposed, in general, to be symbols not from the context System`.
Example
Example
eqn1=y''[x]+3y'[x]+2y[x](1+x)Cos[2x]+Sin[x+1]+
3x
2
x
2y[x]+3[x]+[x]+(1+x)Cos[2x]+Sin[1+x]
′
y
′′
y
2
x
3x
ApplySuperposition[eqn1,y,x]//Column[#,Center]&
2y[x]+3 ′ y ′′ y 2 x |
2y[x]+3 ′ y ′′ y 3x |
2y[x]+3 ′ y ′′ y |
TrialSolutionParts[eqn1,y,x]//Column[#,Center]&
y 0 1 2 2 #1 |
y 3#1 C 0 C 1 |
y(Cos[2#1]( C 0 C 0 C 1 C 1 |
TrialSolutionParts[eqn1,y[x],x]//Column[#,Center]&
y[x] 0 1 2 x 2 |
y[x] 3x C 0 C 1 |
y[x]Cos[2x]( C 0 C 0 C 1 C 1 |
Map[Column[#,Center]&,TrialSolutionPartsEquations[eqn1,y,x]]//Column[#,Center,Spacings1]&
| ||||||
| ||||||
|
ParticularSolutionParts[eqn1,y,x]//Column[#,Center]&
y 7 4 3#1 2 2 #1 2 |
y 3#1 9 442 19 442 |
yCos[2#1] 7 100 #1 20 23 200 3#1 20 |
ParticularSolutionParts[eqn1,y[x],x]//Column[#,Center]&
y[x] 7 4 3x 2 2 x 2 |
y[x] 3x 9 442 19 442 |
y[x] 7 100 x 20 23 200 3x 20 |
MapThread[#1/.#2&,{ApplySuperposition[eqn1,y,x],ParticularSolutionParts[eqn1,y,x]}]//Simplify
{True,True,True}
ParticularSolution, GeneralSolution, LDSolve
ParticularSolution, GeneralSolution, LDSolve
ParticularSolution
ParticularSolution
ParticularSolution[expr,y,x,f]
y[x]
x
expr
{y->Function[b]}
expr
b
ParticularSolutionParts[expr,y,x,f]
- If the second argument y is replaced by
y[x]
{y[x]->Function[b][x]
- The expressions
y
x
GeneralSolution
GeneralSolution
GeneralSolution[expr,y,x,f,opts]
expr
y[x]
x
expr
{y->Function[cb+pb]}
cb
ComplementarySolution[expr,y,x,f,opts]
pb
ParticularSolution[expr,y,x,f]
- If the second argument
y
y[x]
{y[x]->Function[cb+pb][x]}
- If the solution cannot be found, $Failed is returned.
- The fourth argument f is positional optional with the default value Real, in which case the solution has the usual real form. The second admissible value for f is Complex; in this case the result is free of functions Cos and Sin. The list {opts} of named optional arguments should be a sublist of Options[Solve].
- The result may depend on optional arguments of the command Simplify and its form may also depend on the options of Solve.
- The expressions y and x are supposed, in general, to be symbols not from the context System`.
LDSolve
LDSolve
LDSolve[expr,y,x,f,opts]
expr
eqn
y[x]
x
{eqn,ini1,ini2,...}
ini1,ini2,...
eqn
eqn
{y->Function[cb+pb]}
- If the argument
y
y[x]
{y[x]->Function[cb+pb][x]}
- If the solution cannot be found, $Failed is returned.
- The fourth argument f is positional optional with the default value Real, in which case the solution has the usual real form. The second admissible value for f is Complex; in this case the result is free of functions Cos and Sin. The list {opts} of named optional arguments should be a sublist of Options[Solve].
- The result may depend on optional arguments of the command Simplify and its form may also depend on the options of Solve.
- The expressions
y
x
Example
Example
eqn1=y''[x]+3y'[x]+2y[x](1+x)Cos[2x]+Sin[x+1]-Sin[x]
-3x
-x
2
x
2y[x]+3[x]+[x](1+x)Cos[2x]-Sin[x]+Sin[1+x]
′
y
′′
y
-x
2
x
-3x
ParticularSolution[eqn1,y,x]
yCos[1+#1]+Sin[1+#1]+Cos[2#1]-+Sin[2#1]++Sin[#1]--2#1++Cos[#1]-+#1+&
-3#1
3
10
1
10
7
100
#1
20
23
200
3#1
20
-#1
1
2
2
#1
2
5
2
2
#1
2
ParticularSolution[eqn1,y[x],x]
y[x]-Cos[2x]+-+x+Cos[x]+--2x+Sin[x]++Sin[2x]+Cos[1+x]+Sin[1+x]
7
100
x
20
-x
5
2
2
x
2
1
2
2
x
2
23
200
3x
20
-3x
3
10
1
10
GeneralSolution[eqn1,y,x]
y++Cos[1+#1]+Sin[1+#1]+Cos[2#1]-+Sin[2#1]++Sin[#1]--2#1++Cos[#1]-+#1+&
-2#1
1
-#1
2
-3#1
3
10
1
10
7
100
#1
20
23
200
3#1
20
-#1
1
2
2
#1
2
5
2
2
#1
2
GeneralSolution[eqn1,y[x],x]
y[x]++-Cos[2x]+-+x+Cos[x]+--2x+Sin[x]++Sin[2x]+Cos[1+x]+Sin[1+x]
-2x
1
-x
2
7
100
x
20
-x
5
2
2
x
2
1
2
2
x
2
23
200
3x
20
-3x
3
10
1
10
eqn1/.GeneralSolution[eqn1,y,x]//Simplify
True
LDSolve[eqn1,y,x]
y++Cos[1+#1]+Sin[1+#1]+Cos[2#1]-+Sin[2#1]++Sin[#1]--2#1++Cos[#1]-+#1+&
-2#1
1
-#1
2
-3#1
3
10
1
10
7
100
#1
20
23
200
3#1
20
-#1
1
2
2
#1
2
5
2
2
#1
2
LDSolve[eqn1,y[x],x]
y[x]++-Cos[2x]+-+x+Cos[x]+--2x+Sin[x]++Sin[2x]+Cos[1+x]+Sin[1+x]
-2x
1
-x
2
7
100
x
20
-x
5
2
2
x
2
1
2
2
x
2
23
200
3x
20
-3x
3
10
1
10
LDSolve[{eqn1,y[0]0,y'[0]-1},y,x]
y(7-2Cos[1]-2Sin[1])+(17+5Cos[1]+10Sin[1])+Cos[1+#1]+Sin[1+#1]+Cos[2#1]-+Sin[2#1]++Sin[#1]--2#1++Cos[#1]-+#1+&
1
4
-2#1
1
25
-#1
-3#1
3
10
1
10
7
100
#1
20
23
200
3#1
20
-#1
1
2
2
#1
2
5
2
2
#1
2
LDSolve[{eqn1,y[0]0,y'[0]-1},y[x],x]
y[x]-Cos[2x]+(7-2Cos[1]-2Sin[1])+(17+5Cos[1]+10Sin[1])+-+x+Cos[x]+--2x+Sin[x]++Sin[2x]+Cos[1+x]+Sin[1+x]
7
100
x
20
1
4
-2x
1
25
-x
-x
5
2
2
x
2
1
2
2
x
2
23
200
3x
20
-3x
3
10
1
10
u[x]=LDSolve[{eqn1,y[0]0,y'[0]-1},y[x],x][[1,2]]
7
100
x
20
1
4
-2x
1
25
-x
-x
5
2
2
x
2
1
2
2
x
2
23
200
3x
20
-3x
3
10
1
10
LDSolve[{eqn1,y[0]0,y[3]0},y[x],x]
y[x]-Cos[2x]-(-486+60Cos[1]-1000Cos[3]-60Cos[4]+16Cos[6]+20Sin[1]+400Sin[3]-20Sin[4]-113Sin[6])-(486-60Cos[1]+1000Cos[3]+60Cos[4]-16Cos[6]-20Sin[1]-400Sin[3]+20Sin[4]+113Sin[6])+-+x+Cos[x]+--2x+Sin[x]++Sin[2x]+Cos[1+x]+Sin[1+x]
7
100
x
20
1
200(-1+)
3
-3-2x
6
6
6
9
6
6
9
1
200(-1+)
3
-3-x
3
3
6
9
3
6
9
-x
5
2
2
x
2
1
2
2
x
2
23
200
3x
20
-3x
3
10
1
10
Plot[{LDSolve[{eqn1,y[0]0,y[3]0},y[x],x][[1,2]],LDSolve[{eqn1,y[0]0,y'[0]-1},y[x],x][[1,2]]}//Evaluate,{x,0,15},PlotRangeAll]
Definitions
BeginPackage
BeginPackage
EndPackage
EndPackage
Open Palette
Open Palette


Cite this as: Vojtěch (Vojtech) Bartík (Bartik), "The Method of Undetermined Coefficients for Linear Differential Equations with Constant Coefficients and Special Right-Hand Side" from the Notebook Archive (2021), https://notebookarchive.org/2021-10-cxsum6u

Download

