Mathematica student guide Haris Javed
The Purpose of this Guide is to inform the fellow students how to use mathematica for a Linear Algebra and Differential Equation Coarse: H* H* H* H* H* H* H*
We Can Write Comments in mathematica by using H* Text*L command. Many of the Functions can Shift + enter should be used to Obtain a Function, just hitting enter will just take you to We can Assign Variables as a Function, For example typing n=2 will give n the value of 2, Also You Can Also Use In@xD or Out@xD To bring or use old commands, just put the number in x, for Pallettes Can Also be used instead of typing commands, you can use pallettes by clicking Pallettes Pi can be Written as pi without spaces or Π*L infinity can be Written as inf or ¥ *L
2
test mathematica.nb
1 Solving Solving an Equation With Mathematica
In[2]:=
SolveA4x-x2 6,xE H*note that x2 Requires Ctrl+6, and there are two equal signs between the
Out[2]=
::x ® 2 - ä
In[21]:=
SolveA5x2 -18x-50,xE
Out[21]=
In[22]:=
Out[22]=
::x ®
1 5
2 >, :x ® 2 + ä
J9 -
106 N>, :x ®
2 >>
1 5
J9 +
106 N>>
SolveA-6+3x-2x2 +4x3 5 SinHxL,xE ::x ®
32 - 60 Sin
1 -
+ 13
6
12 223 299 + 45 Sin + 3
2
3
3387 + 570 Sin + 875 Sin - 500 Sin
3
13
299 + 45 Sin + 3
3
3387 + 570 Sin + 875 Sin2 - 500 Sin3
>,
6 213 :x ®
J1 + ä
1
3 N H32 - 60 SinL
+
13
6 24
J1 - ä
223
299 + 45 Sin + 3
3 N 299 + 45 Sin + 3
3
2
3
3387 + 570 Sin + 875 Sin - 500 Sin
13
3
3387 + 570 Sin + 875 Sin2 - 500 Sin3
>,
12 213 :x ®
J1 - ä
1
3 N H32 - 60 SinL
+ 6
13
24 223 299 + 45 Sin + 3
J1 + ä
3 N 299 + 45 Sin + 3
3
2
3
3387 + 570 Sin + 875 Sin - 500 Sin
13
3
3387 + 570 Sin + 875 Sin2 - 500 Sin3 12 213
>>
test mathematica.nb
In[23]:=
Out[23]=
H*by Adding A N to the Function in input@26D We can change all the exact Value to Approximate SolveA-6+3x-2x2 +4x3 5 SinHxL,xEN 0.0524967 H32. - 60. SinL
::x ® 0.166667 -
+ 13
299. + 45. Sin + 5.19615
2
3
3387. + 570. Sin + 875. Sin - 500. Sin
13
0.132283 299. + 45. Sin + 5.19615
3387. + 570. Sin + 875. Sin2 - 500. Sin3
13
299. + 45. Sin + 5.19615
2
3
3387. + 570. Sin + 875. Sin - 500. Sin
H0.0661417 - 0.114561 äL 299. + 45. Sin + 5.19615
13
>,
13
>>
3387. + 570. Sin + 875. Sin2 - 500. Sin3
H0.0262484 - 0.0454635 äL H32. - 60. SinL
:x ® 0.166667 +
13
299. + 45. Sin + 5.19615
2
3
3387. + 570. Sin + 875. Sin - 500. Sin
H0.0661417 + 0.114561 äL 299. + 45. Sin + 5.19615
Out[24]=
>,
H0.0262484 + 0.0454635 äL H32. - 60. SinL
:x ® 0.166667 +
In[24]:=
3387. + 570. Sin + 875. Sin2 - 500. Sin3
H* we Can Also Add a . in the Function itself to Create decimalApproximate Values. Note the . SolveA-6.+3x-2x2 +4x3 5 SinHxL,xE H0.0524967 - 0.090927 äL H32. - 60. SinL
::x ® 0.166667 +
13
2392. + 360. Sin + 929.516
2.92889 - 1. Sin
2
2.31282 + 1.17889 Sin + Sin
H0.0330709 + 0.0572804 äL 13
2392. + 360. Sin + 929.516
2.92889 - 1. Sin
2.31282 + 1.17889 Sin + Sin2
>,
H0.0524967 + 0.090927 äL H32. - 60. SinL
:x ® 0.166667 +
13
2392. + 360. Sin + 929.516
2.92889 - 1. Sin
2
2.31282 + 1.17889 Sin + Sin
H0.0330709 - 0.0572804 äL 13
2392. + 360. Sin + 929.516
2.92889 - 1. Sin
2.31282 + 1.17889 Sin + Sin2
>,
0.104993 H32. - 60. SinL
:x ® 0.166667 -
+ 13
2392. + 360. Sin + 929.516
2.92889 - 1. Sin
2
2.31282 + 1.17889 Sin + Sin
13
0.0661417 2392. + 360. Sin + 929.516 In[34]:=
Out[34]=
3
Solve@87x-4y-8,-1x+3y18
48
118 ,y®
17
17
>>
2.92889 - 1. Sin
2.31282 + 1.17889 Sin + Sin2
>>
4
test mathematica.nb
In[94]:=
Out[96]=
H*Multiple instructions can also be given for Solving a System*L Clear@equD; equ=89x+2y-3,-2x+7y11<; Solve@equD Solve@N@equDD NSolve@equD ::x ® -
43
93 ,y®
67
67
>>
Out[97]=
88x ® - 0.641791, y ® 1.38806<<
Out[98]=
88x ® - 0.641791, y ® 1.38806<<
In[102]:=
Out[102]=
Clear@equD;equ=82x-1y-3z-4,-5x+2y-18z2,4x+y+2z-3<;Solve@equD Solve@N@equDD NSolve@equD ::x ® -
162
127 ,y®
145
43 ,z®
145
145
>>
Out[103]=
88x ® - 1.11724, y ® 0.875862, z ® 0.296552<<
Out[104]=
88x ® - 1.11724, y ® 0.875862, z ® 0.296552<<
In[117]:=
SolveAx2 +2x-70,xE
Out[117]=
::x ® - 1 - 2
In[118]:=
N@Out@117DD
Out[118]= In[131]:=
2 >, :x ® - 1 + 2
2 >>
88x ® - 3.82843<, 8x ® 1.82843<< Clear@equD;equ=83 x-2 y-7 z==-4,-3 x+2 y-8 z==1,2 x+11 y+6 z==-3<;Solve@equD Solve@N@equDD NSolve@equD
test mathematica.nb
In[134]:=
ContourPlot3D@83 x-2 y-7 z==-4,-3 x+2 y-8 z==1,2 x+11 y+6 z==-3<,8x,-5,5<,8y,-5,5<,8z,-5,5
0
-5 5
Out[134]=
0
-5 -5
0
5
5
6
test mathematica.nb
2
Roots
Finding Roots Using the FindRoot Command In[25]:=
Out[25]=
H* mathematica is a Powerful tool which can be used for many operations, now lets see how we can FindRootA4x3 -5x2 +3x-30,8x,0<E 8x ® 1.16058<
H* above is the Excat root, it does not include all the roots that are found by using the Solve PlotA94x3 -5x2 +3x-3=,8x,-10,10<,AxesLabel ® 8x,y<,PlotRange®8-10,10<EH* below we can see the Root In[27]:=
Out[27]= In[28]:=
H*Another Root*L FindRootA4x3 +2x2 +x-53Sin@xD,8x,2<E 8x ® 1.03301<
H*Visual Roots of Above Equation*L PlotA94x3 +2x2 +x-5,3Sin@xD=,8x,-10,10<,AxesLabel ® 8x,y<,PlotRange®8-10,10<E y 10
5
Out[28]=
-10
-5
5
10
x
-5
-10 In[135]:= Out[135]=
FindRootA2x5 -5x4 -2x3 -x2 +6x+13Sin@xD-4Cos@xD,8x,3<E 8x ® 2.81381<
*L
test mathematica.nb
3
7
Graphing
Plotting A Basic Equation In[3]:=
H*We will Graph the above equation Eq1 here*L H*The above equation will be Defined as 2 functions @y=6D and Ay= 4x-x2 E put together as follows y
5
Out[3]=
-4
-2
2
4
-5
Graphing A Little More complex function In[4]:=
Out[4]=
H* Lets Solve a Little More Complex Function*L SolveA5x2 -18x-50,xE ::x ®
1 5
J9 -
106 N>, :x ®
1 5
J9 +
106 N>>
x
8
test mathematica.nb
::x ®
J9 + 106 N>> 5 5 H*Also Lets Plot This function and see how it looks like*L PlotA5x2 -18x-5,8x,-3,3<,AxesLabel ® 8x,y<,PlotRange® 8-8,8<E 1
J9 -
106 N>, :x ®
1
y
5
-3
-2
-1
1
2
3
x
-5
In[5]:=
H* We will Plot another function just to get the hang of the method*L PlotA92x4 +x3 -7x2 +3x-8=,8x,-20,20<, AxesLabel® 8x,y<,PlotRange ® 8-20,20<E
H* The image Below can be Shrinked, or Expanded with the use of the Mouse cursors. Click on the y 20
10
Out[5]=
-20
-10
10
-10
-20
20
x
test mathematica.nb
In[30]:=
9
PlotASin@xD2 ,8x,0,2Pi<,PlotLabel® Sin@xD2 E
sin2 HxL
1.0
0.8
0.6 Out[30]=
0.4
0.2
1
2
3
4
5
6
Plotting With Different Style H* the Original Function Was
2 3
6 2 1 1 3 x- ==1- x*L PlotB: x- ,1- x>,8x,-.5,1.5<,PlotRange® 8-.5,1.2< 3 2 3 3 2
1.0
0.5 Out[6]=
-0.5
0.5
1.0
1.5
-0.5
In[7]:=
PlotB:4-x,
H5-6xL 2
>,8x,-2,4
H5-6xL 2
*L
5
Out[7]=
-2
-1
1
2
3
4
-5
Plotting a three Dimensional function , Graphing a system of Equations with x,y,z or x1, x2, x3
10
test mathematica.nb
Plotting a three Dimensional function , Graphing a system of Equations with x,y,z or x1, x2, x3
In[8]:=
ContourPlot3D@84x-8y-z-4,-6x+3y-5z1,6x+y+6z-12<,8x,-10,10<,8y,-10,10<,8z,-10,10
0 5
0 10 10
-5
-10 5
0 Out[8]=
-5
-10
test mathematica.nb
In[151]:=
Plot3DB:
H18x-2y+7L H-36+4y-1L H3+2x+yL , , >,8x,-5,3<,8y,-2,4<,PlotRange® 8-1,2<,PlotStyle® 8Red 4 1 -6
2
Out[151]=
11
1
4
0 2 -1 -4 0
-2 0 2
-2
12
test mathematica.nb
3-D Plotting H*Mathematica will plot 3d Graphs With ease look at the Following Example*L Plot3D@Sin@x+y^2D,8x,-3,3<,8y,-2,2<,Mesh® AllDH*This Plot can be moved Scaled by clicking on
1.0 0.5 Out[18]=
0.0
2
-0.5 -1.0
1 -2 0 0 -1
2 -2
In[19]:=
Plot3D@Sin@x+y^2D,8x,-2,2<,8y,-2,2<,PlotStyle®Directive@Orange,Specularity@White,20DDD H*with
*
test mathematica.nb
1.0 0.5 0.0 -0.5 -1.0 -2 2
-1 1
0 0
1
-1
2
-2
13
14
test mathematica.nb
In[20]:=
H*Note that contour plot will plot a 3d function if we have more than 2 variables, if we only ContourPlot@88x+2y-3,-8x+3y11<,8x,-6,3<,8y,-2,4<,Axes® True,Frame® False,Mesh® AllD 4
3
2
Out[20]=
1
-6
-4
-2
2
-1
-2
test mathematica.nb
In[138]:=
Out[138]=
GraphPlot3D@Table@i -> Mod@i^2, 75D, 8i, 75
None, MultiedgeStyle -> None, EdgeRenderingFunction -> H8Green, Cylinder@ð, 0.1D< &L, VertexRenderingFunction -> H8Black, Sphere@ð, 0.2D< &LD
15
16
test mathematica.nb
In[174]:=
p5 = ContourPlot By
H5xL 2 +
2x2
J N 1 2
, 8x, -1, 15<, 8y, 0, 1.5<, FrameTicks ® TrueF
1.4
1.2
1.0
0.8 Out[174]=
0.6
0.4
0.2
0.0 0
5
10
15
test mathematica.nb
4
17
Matrix
RowReduction, Determinant, Transpose, Inverse In[31]:=
H* For row reduction we will just use the Command Row Reduce*L 8 -5 -4 -4 RowReduceB -5 2 -11 1 F 7 1 3 -3
Out[31]=
In[32]:=
::1, 0, 0, -
41 87
>, :0, 1, 0, -
4 87
>, :0, 0, 1,
10 87
>>
2 -5 -7 -4 RowReduceB -3 2 -15 1 FMatrixForm 2 1 6 -3
Out[32]//MatrixForm=
1 0 0 0 1 0 0 0 1
352 163 79 163 49
163
NBRowReduceB Out[33]= In[36]:=
Out[36]=
4 3 2 FFH* again the N gives Decimal Answers*L 2 3 4
881., 0., - 1.<, 80., 1., 2.<<
H* We can always Define a Variable in mathematica as a function, look below *L 4 3 2 n= 2 3 4 884, 3, 2<, 82, 3, 4<<
H* We have defined n As the Matrix above, be careful about lower and uppercase. A lot of Commands H* We can Clear the above n by using the Clear@nD command*L Clear@nD
In[61]:=
H* A Equation can Also be put as a linear system and be solved, 89x+2y-3,-2x+7y11< can be put lets solve them and see if the answers match*L Solve@equD
Out[61]=
::x ® -
43
93 ,y®
67
67
>>
18
test mathematica.nb
In[62]:=
Out[62]=
RowReduceB
9 2 -3 F -2 7 11
::1, 0, -
>, :0, 1,
43 67
93 67
>>
H* The Answers Match, as expected *L In[105]:=
Clear@equD
In[109]:=
2 -5 -7 Clear@m,u,v,wD;m= -1 8 -5 ; 9 4 6 u=8-8,1,-2<;v=812,4,4<; w=83,5,-8<;f=LinearSolve@mD
Out[111]= In[112]:=
LinearSolveFunction@83, 3<, <>D H* Transposing the Above matrix*L Transpose@8f@uD,f@vD,f@wD
Out[112]//MatrixForm=
- 704 863
1148 863 - 100 863 1080 - 863
353 863 533 863
In[113]:=
- 434 863 122 863 - 581 863
8u,v,w<MatrixForm
Out[113]//MatrixForm=
-8 1 -2 12 4 4 3 5 -8 In[114]:=
Join@m,8u,v,w
Out[114]//MatrixForm=
2 -5 -1 8 9 4 -8 1 12 4 3 5 In[115]:=
-7 -5 6 -2 4 -8
n=Transpose@Append@Append@Append@Transpose@mD,uD,vD,wDDMatrixForm
Out[115]//MatrixForm=
2 - 5 - 7 - 8 12 3 -1 8 -5 1 4 5 9 4 6 -2 4 -8 In[116]:=
RowReduce@Out@115DDMatrixForm
Out[116]//MatrixForm= 704
1148
863 353
863 100
1 0 0 0 1 0 0 0 1
863 533 863
-
863 1080 863
-
434
863 122 863 581
-
863
test mathematica.nb
In[119]:=
Out[119]=
In[121]:=
Out[121]=
Clear@A,A1,b,cD;A=889,7,3<,88,5,1<,87,5,5<<;b=8-2,5,3<;c=81,-1,0<;A1=MatrixForm@889,7,3<,88,5 ::-
1
1 ,-
2
5
, 0>, :-
1
1 ,
2
1 ,
5
3
>, 82, 5, 3<, 8Log@2D, Log@5D, Log@3D<, 6>
H* Dot Product Cross Product *L 8b c,b*c,b´c,b.c,Dot@b,cD,Cross@b,cD,b×c,bc,A.b,b.A,MatrixForm@bD< :8- 2, - 5, 0<, 8- 2, - 5, 0<, 8- 2, - 5, 0<, - 7, - 7, 83, 3, - 3<, 8- 2, 5, 3< × 81, - 1, 0<, 83, 3, - 3<, 826, 12, 26<, 843, 26, 14<,
In[122]:=
94+A,3+A2,Transpose@AD,Transpose@A1D,AT ,A2 ,A12 =MatrixForm 8813, 11, 7<, 812, 9, 5<, 811, 9, 9<< 3 + A2 889, 8, 7<, 87, 5, 5<, 83, 1, 5<< 9 7 3 TransposeB 8 5 1 F 7 5 5
Out[122]//MatrixForm=
999T , 7T , 3T =, 98T , 5T , 1=, 97T , 5T , 5T ==
8881, 49, 9<, 864, 25, 1<, 849, 25, 25<< 9 7 3 8 5 1 7 5 5 In[123]:=
- 3 5 19 0 1 5 6 - 18 27
Out[124]= In[126]:=
H* Determinant*L Det@Out@123DD - 315 B+1MatrixForm
Out[126]//MatrixForm=
- 2 6 20 1 2 6 7 - 17 28 In[128]:=
2
Clear@BD;MatrixForm@B=88-3,5,19<,80,1,5<,86,-18,27<
Out[123]//MatrixForm=
In[124]:=
19
BT MatrixForm
Out[128]//MatrixForm=
H- 3LT 0T 6T
5T 1
19T 5T
H- 18LT 27T
-2 5 > 3
20
test mathematica.nb
In[130]:=
Transpose@BDMatrixForm
Out[130]//MatrixForm=
-3 0 6 5 1 - 18 19 5 27 In[216]:=
Inverse@BDMatrixForm
Out[216]//MatrixForm=
-
13
53
35 2
35 13
21 2
21 8
105
In[218]:= Out[218]= In[219]:= Out[219]= In[222]:=
105
-
2 105 1 21 1
105
LinearSolve@BD LinearSolveFunction@83, 3<, <>D NullSpace@BD 8< Eigenvalues@N@BDDMatrixForm
Out[222]//MatrixForm=
27.5269 - 4.87447 2.34761 In[226]:=
Eigenvectors@N@BDDSimplifyMatrixForm
Out[226]//MatrixForm=
0.54023 0.155871 0.826956 0.986349 0.10673 - 0.125397 - 0.877241 - 0.46351 - 0.124926
test mathematica.nb
In[147]:=
Out[147]=
Graphics3D@8 AstronomicalData@ð, "OrbitPath"D & AstronomicalData@"Planet"D, 8Orange, [email protected], HAstronomicalData@ð, "OrbitPath"D & AstronomicalData@"ApolloAsteroid"DL< <, PlotRange -> 88-6, 6<, 8-6, 6<, 8-4, 4<<, Boxed -> False, ViewAngle -> Π11D
21
22
test mathematica.nb
5 derivatives and integrals Differentiation H*Remember to Always clear your Variables*L Clear@xD;Clear@nD In[161]:=
D@xn ,xD
Out[161]=
n x-1+n
In[162]:= Out[162]=
D@xn ,x,8x,3
In[163]:=
DB
,xF 3Tan@xD
Out[163]=
x2 Cot@xD -
1
x3 Csc@xD2
3 Manipulate@D@2xn ,xD,8n,1,20,1
n Out[167]=
2
Integration In[164]:=
IntegrateAx2 ,xE x3
Out[164]=
3 In[165]:=
2 à x âx
x3 Out[165]=
3
test mathematica.nb
23
Manipulate@Integrate@2xn ,xD,8n,1,20,1
n Out[166]=
2 x3 3
1 In[168]:=
IntegrateB
,xF 1-x3
ArcTanB
F
1+2 x 3
1 Log@- 1 + xD + 3
3
LogA1 + x + x2 E
1
-
Out[168]=
6 1
In[170]:=
Out[170]=
ManipulateBIntegrateB
,xF,8n,1,20,1
:1.63758 ´ 10-15 ,
n
2 J5 +
1 2 20
5 N ArcTanB
1-
2 J5 +
1+ 2
10 - 2
5
5 +4x
ArcTanB 10 - 2
J- 1 +
In[171]:=
à
5 N LogB1 -
1 2
J- 1 +
5 N
F+
F - 4 Log@- 1 + xD -
5 N x + x2 F + J1 +
âx x3 -1 1+2 x 3
3
F
1 +
1 Log@- 1 + xD -
3
6
>
5
1
ArcTanB Out[171]=
5 +4x
LogA1 + x + x2 E
5 N LogB1 +
1 2
J1 +
5 N x + x2 F
24
test mathematica.nb
In[172]:=
Plot@%,8x,0,2
-1.2
-1.4 Out[172]=
-1.6
0.5
1.0
1.5
2.0
test mathematica.nb
6
25
vector
fields and differential equations Plotting Vector field Graphs H* Note Mathematica 7 uses VectorPlot command instead of VectorFieldPlot In[183]:=
VectorPlotA9ã-12x Sin@2yD, 2y Cos @5xD=, 8x,-Π, Π<, 8y, -Π, Π<, Axes ® True, AxesLabel® 8x,y<, y
3
2
1
Out[183]=
-3
-2
-1
1
-1
-2
-3
2
3
x
26
test mathematica.nb
In[187]:=
VectorPlot@8Sin@6yD, -y Cos @6xD<, 8x,-Π, Π<, 8y, -Π, Π<, Axes ® True, AxesLabel® 8x,y<, Frame y
3
2
1
Out[187]=
-3
-2
-1
1
2
3
x
-1
-2
-3
In[192]:=
VectorPlot @8Sin@2xD,Cos@yD<,8x,-Π, Π<,8y,-Π,Π<,Axes® True,AxesLabel® 8x,y<, Frame® TrueD y
3
2
1
Out[192]=
0
x
-1
-2
-3
-3
-2
-1
0
1
2
3
H* Lets Solve some differential Equations now we will use DSolve Command which Solves 2 Simultaneous DSolve@8y@xD -z'@xD,z@xD -y'@xD<,8y,z<,xDH* This equation involves no boundary conditions*L Out[190]=
::z ® FunctionB8x<,
1 2
ã-x I1 + ã2 x M C@1D 1
y ® FunctionB8x<, 2
1 2
ã-x I- 1 + ã2 x M C@2DF,
ã-x I- 1 + ã2 x M C@1D +
1 2
ã-x I1 + ã2 x M C@2DF>>
D
test mathematica.nb
In[191]:= Out[191]= In[193]:= Out[193]= In[194]:= Out[194]=
DSolve@8y'@xD a y@xD,y@0D 1<,y@xD,xD 88y@xD ® ãa x << DSolve@2y@tD+2y'@tD+y''@tD==2t,y@tD,tD@@1DD 9y@tD ® - 1 + t + ã-t C@2D Cos@tD + ã-t C@1D Sin@tD= y@tD. DSolve@2y@tD+2y'@tD+y''@tD==2t,y@tD,tD@@1DD - 1 + t + ã-t C@2D Cos@tD + ã-t C@1D Sin@tD
In[199]:=
Clear@fD
In[203]:=
f@t_D:=t+
Out[204]= In[205]:= Out[205]=
27
c1 Cos@5tD c2 Sin@5tD + -9 ã-t ã-5t f@tD.8c1® 1,c2® 1<
- 9 + t + ãt Cos@5 tD + ã5 t Sin@5 tD Plot@Table@f@xD,8c2,-2,2<,8c1,-2,2
20
10
-3
-2
-1
1
2
3
> -10
-20
-30
-40
28
test mathematica.nb
In[206]:=
Plot@Evaluate@Table@f@xD,8c2,-2,2<,8c1,-2,2
100
Out[206]=
:0.765,
-2
-1
1
2
3
>
-100
-200
In[227]:= Out[227]=
NDSolve@8x'@tD -3Hx@tD-y@tDL,y'@tD -x@tDz@tD+26.5x@tD-y@tD,z'@tD x@tDy@tD-z@tD,x@0D z@0D 88x ® InterpolatingFunction@880., 200.<<, <>D, y ® InterpolatingFunction@880., 200.<<, <>D, z ® InterpolatingFunction@880., 200.<<, <>D<<
test mathematica.nb
In[228]:=
29
ParametricPlot3D@Evaluate@8x@tD,y@tD,z@tD<.%D,8t,0,200<,PlotPoints® 100000DTiming -10
-5
0
5
10
40
Out[228]=
:2.75,
>
30
20
10 10
0
0
-10
In[207]:=
y@tD.DSolve@2y@tD+2y'@tD+y''@tD==2Sin@tD,y@tD,tD@@1DDSimplify 4
Out[208]=
5
+ ã-t C@2D Cos@tD +
2 5
+ ã-t C@1D Sin@tD
30
test mathematica.nb
In[209]:= Out[209]=
In[211]:=
Out[211]=
y@tD.DSolve@2y@tD+2y'@tD+y''@tD==2Sin@tD,y@tD,tD@@1DDN 2.71828-1. t C@2D Cos@tD + 2.71828-1. t C@1D Sin@tD + 0.2 H- 5. Cos@tD + Cos@tD Cos@2. tD - 2. Cos@2. tD Sin@tD + 2. Cos@tD Sin@2. tD + Sin@tD Sin@2. tDL y@tD.DSolveAy''@tD-4y'@tD+3y@tD ãH3tL -5Cos@3tD,y@tD,tE@@1DDSimplify ãt C@1D + ã3 t C@2D +
1 12
In[212]:=
Out[212]=
In[214]:=
Out[214]=
I3 ã3 t H- 1 + 2 tL + 2 Cos@3 tD + 4 Sin@3 tDM
H*Initial Conditions*L DSolveA9y''@xD-4y'@xD+3y@xD ãH3xL -5Cos@3xD,y@0D1,y'@0D1 =,y@xD,xESimplify ::y@xD ®
1 6
I9 ãx - 4 ã3 x + 3 ã3 x x + Cos@3 xD + 2 Sin@3 xDM>>
DSolveAx2 y''@xD+y@xD 0,y@xD,xE ::y@xD ®
1
1 3 Log@xDF +
x C@1D CosB 2
x C@2D SinB
3 Log@xDF>> 2