Sie sind auf Seite 1von 30

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* We Can Write Comments in mathematica by using H* Text*L command. Many of the Functions can
H* Shift + enter should be used to Obtain a Function, just hitting enter will just take you to
H* We can Assign Variables as a Function, For example typing n=2 will give n the value of 2, Also
H* You Can Also Use In@xD or Out@xD To bring or use old commands, just put the number in x, for
H* Pallettes Can Also be used instead of typing commands, you can use pallettes by clicking Pallettes
H* Pi can be Written as  pi  without spaces or Π*L
H* 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 - ä 2 >, :x ® 2 + ä 2 >>

In[21]:= SolveA5x2 -18x-5Š0,xE

::x ® J9 - 106 N>, :x ® J9 + 106 N>>


1 1
Out[21]=
5 5

In[22]:= SolveA-6+3x-2x2 +4x3 Š 5 SinHxL,xE

::x ®
1 32 - 60 Sin
Out[22]= - +
6 13
2 3
12 223 299 + 45 Sin + 3 3 3387 + 570 Sin + 875 Sin - 500 Sin

13
299 + 45 Sin + 3 3 3387 + 570 Sin + 875 Sin2 - 500 Sin3
>,
6 213

J1 + ä 3 N H32 - 60 SinL
:x ®
1
+ -
6 13
2 3
24 223 299 + 45 Sin + 3 3 3387 + 570 Sin + 875 Sin - 500 Sin

J1 - ä 3 N 299 + 45 Sin + 3
13
3 3387 + 570 Sin + 875 Sin2 - 500 Sin3
>,
12 213

J1 - ä 3 N H32 - 60 SinL
:x ®
1
+ -
6 13
2 3
24 223 299 + 45 Sin + 3 3 3387 + 570 Sin + 875 Sin - 500 Sin

J1 + ä 3 N 299 + 45 Sin + 3
13
3 3387 + 570 Sin + 875 Sin2 - 500 Sin3
>>
12 213
test mathematica.nb 3

In[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,xEN

0.0524967 H32. - 60. SinL


Out[23]= ::x ® 0.166667 - +
13
2 3
299. + 45. Sin + 5.19615 3387. + 570. Sin + 875. Sin - 500. Sin

>,
13
0.132283 299. + 45. Sin + 5.19615 3387. + 570. Sin + 875. Sin2 - 500. Sin3

H0.0262484 + 0.0454635 äL H32. - 60. SinL


:x ® 0.166667 + -
13
2 3
299. + 45. Sin + 5.19615 3387. + 570. Sin + 875. Sin - 500. Sin

H0.0661417 - 0.114561 äL 299. + 45. Sin + 5.19615 >,


13
3387. + 570. Sin + 875. Sin2 - 500. Sin3

H0.0262484 - 0.0454635 äL H32. - 60. SinL


:x ® 0.166667 + -
13
2 3
299. + 45. Sin + 5.19615 3387. + 570. Sin + 875. Sin - 500. Sin

H0.0661417 + 0.114561 äL 299. + 45. Sin + 5.19615 >>


13
3387. + 570. Sin + 875. Sin2 - 500. Sin3

In[24]:= H* we Can Also Add a . in the Function itself to Create decimalApproximate Values. Note the .
SolveA-6.+3x-2x2 +4x3 Š 5 SinHxL,xE

H0.0524967 - 0.090927 äL H32. - 60. SinL


Out[24]= ::x ® 0.166667 + -
13
2
2392. + 360. Sin + 929.516 2.92889 - 1. Sin 2.31282 + 1.17889 Sin + Sin

H0.0330709 + 0.0572804 äL

>,
13
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 + -
13
2
2392. + 360. Sin + 929.516 2.92889 - 1. Sin 2.31282 + 1.17889 Sin + Sin

H0.0330709 - 0.0572804 äL

>,
13
2392. + 360. Sin + 929.516 2.92889 - 1. Sin 2.31282 + 1.17889 Sin + Sin2

0.104993 H32. - 60. SinL


:x ® 0.166667 - +
13
2
2392. + 360. Sin + 929.516 2.92889 - 1. Sin 2.31282 + 1.17889 Sin + Sin

>>
13
0.0661417 2392. + 360. Sin + 929.516 2.92889 - 1. Sin 2.31282 + 1.17889 Sin + Sin2

In[34]:= Solve@87x-4yŠ-8,-1x+3yŠ18<D

::x ® >>
48 118
Out[34]= ,y®
17 17
4 test mathematica.nb

In[94]:= H*Multiple instructions can also be given for Solving a System*L


Clear@equD;
equ=89x+2yŠ-3,-2x+7yŠ11<;
Solve@equD
Solve@N@equDD
NSolve@equD

::x ® - >>
43 93
Out[96]= ,y®
67 67
Out[97]= 88x ® - 0.641791, y ® 1.38806<<

Out[98]= 88x ® - 0.641791, y ® 1.38806<<

In[102]:= Clear@equD;equ=82x-1y-3zŠ-4,-5x+2y-18zŠ2,4x+y+2zŠ-3<;Solve@equD
Solve@N@equDD
NSolve@equD

::x ® - >>
162 127 43
Out[102]= ,y® ,z®
145 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-7Š0,xE

Out[117]= ::x ® - 1 - 2 2 >, :x ® - 1 + 2 2 >>

In[118]:= N@Out@117DD

Out[118]= 88x ® - 3.82843<, 8x ® 1.82843<<

In[131]:= 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 5

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<D
5

-5
5

Out[134]=
0

-5
-5

5
6 test mathematica.nb

2 Roots

Finding Roots Using the FindRoot Command


In[25]:= H* mathematica is a Powerful tool which can be used for many operations, now lets see how we can
FindRootA4x3 -5x2 +3x-3Š0,8x,0<E

Out[25]= 8x ® 1.16058<

H* above is the Excat root, it does not include all the roots that are found by using the Solve *L

PlotA94x3 -5x2 +3x-3=,8x,-10,10<,AxesLabel ® 8x,y<,PlotRange®8-10,10<EH* below we can see the Root

In[27]:= H*Another Root*L


FindRootA4x3 +2x2 +x-5Š3Sin@xD,8x,2<E

Out[27]= 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
In[28]:=

y
10

Out[28]=
x
-10 -5 5 10

-5

-10

In[135]:= FindRootA2x5 -5x4 -2x3 -x2 +6x+1Š3Sin@xD-4Cos@xD,8x,3<E

Out[135]= 8x ® 2.81381<
test mathematica.nb 7

3 Graphing

Plotting A Basic Equation


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
In[3]:=

Out[3]=
x
-4 -2 2 4

-5

Graphing A Little More complex function


In[4]:= H* Lets Solve a Little More Complex Function*L
SolveA5x2 -18x-5Š0,xE

::x ® J9 - 106 N>, :x ® J9 + 106 N>>


1 1
Out[4]=
5 5
8 test mathematica.nb

::x ® J9 - 106 N>, :x ®


J9 + 106 N>>
1 1

H*Also Lets Plot This function and see how it looks like*L
5 5

PlotA5x2 -18x-5,8x,-3,3<,AxesLabel ® 8x,y<,PlotRange® 8-8,8<E

x
-3 -2 -1 1 2 3

-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
In[5]:=

H* The image Below can be Shrinked, or Expanded with the use of the Mouse cursors. Click on the
y
20

10

Out[5]=
x
-20 -10 10 20

-10

-20
test mathematica.nb 9

In[30]:= 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 x- ==1- x*L PlotB: x- ,1- x>,8x,-.5,1.5<,PlotRange® 8-.5,1.2<
2 1 3
6 2 1
3 3 2
3 3 2

1.0

0.5
Out[6]=

-0.5 0.5 1.0 1.5

-0.5

H5-6xL
>,8x,-2,4<F H* Original function 4-x=
H5-6xL
In[7]:= PlotB:4-x, *L
2
2

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-5zŠ1,6x+y+6zŠ-12<,8x,-10,10<,8y,-10,10<,8z,-10,10<D H* this

10-10
-5
5 0

5
0
10

-5 10

-10
5

Out[8]=

-5

-10
test mathematica.nb 11

H18x-2y+7L H-36+4y-1L H3+2x+yL


In[151]:= Plot3DB: , , >,8x,-5,3<,8y,-2,4<,PlotRange® 8-1,2<,PlotStyle® 8Red
4 1 -6

1 4
Out[151]=

0
2
-1

-4
0
-2

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

-1

-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 13

1.0

0.5
0.0
-0.5
-1.0
-2
2

-1
1

0
0

1
-1

2 -2
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+3yŠ11<,8x,-6,3<,8y,-2,4<,Axes® True,Frame® False,Mesh® AllD

Out[20]= 1

-6 -4 -2 2

-1

-2
test mathematica.nb 15

In[138]:= GraphPlot3D@Table@i -> Mod@i^2, 75D, 8i, 75<D, SelfLoopStyle -> None,
MultiedgeStyle -> None,
EdgeRenderingFunction -> H8Green, Cylinder@ð, 0.1D< &L,
VertexRenderingFunction -> H8Black, Sphere@ð, 0.2D< &LD

Out[138]=
16 test mathematica.nb

H5xL J N
1

p5 = ContourPlot By Š , 8x, -1, 15<, 8y, 0, 1.5<, FrameTicks ® TrueF


2

In[174]:=
2 + 2x2

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 17

4 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

::1, 0, 0, - >, :0, 1, 0, - >, :0, 0, 1, >>


41 4 10
Out[31]=
87 87 87

2 -5 -7 -4
In[32]:= RowReduceB -3 2 -15 1 FMatrixForm
2 1 6 -3
Out[32]//MatrixForm=
352
1 0 0 -
163
79
0 1 0 -
163
49
0 0 1
163

FFH* again the N gives Decimal Answers*L


4 3 2
NBRowReduceB
2 3 4

Out[33]= 881., 0., - 1.<, 80., 1., 2.<<

In[36]:= H* We can always Define a Variable in mathematica as a function, look below *L


4 3 2
n=
2 3 4

Out[36]= 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+7yŠ11< can be put

lets solve them and see if the answers match*L


Solve@equD

::x ® - >>
43 93
Out[61]= ,y®
67 67
18 test mathematica.nb

F
9 2 -3
In[62]:= RowReduceB
-2 7 11

::1, 0, - >, :0, 1, >>


43 93
Out[62]=
67 67

H* The Answers Match, as expected *L

In[105]:= Clear@equD

2 -5 -7
In[109]:= 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]= LinearSolveFunction@83, 3<, <>D

In[112]:= H* Transposing the Above matrix*L


Transpose@8f@uD,f@vD,f@wD<DMatrixForm

Out[112]//MatrixForm=

- 704
863
1148
863
- 434
863
353
863
- 100
863
122
863
533 1080
863
- 863 - 581
863
In[113]:= 8u,v,w<MatrixForm

Out[113]//MatrixForm=
-8 1 -2
12 4 4
3 5 -8

In[114]:= Join@m,8u,v,w<DMatrixForm

Out[114]//MatrixForm=
2 -5 -7
-1 8 -5
9 4 6
-8 1 -2
12 4 4
3 5 -8

In[115]:= n=Transpose@Append@Append@Append@Transpose@mD,uD,vD,wDDMatrixForm

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@115DDMatrixForm

Out[116]//MatrixForm=
704 1148 434
1 0 0 - -
863 863 863
353 100 122
0 1 0 -
863 863 863
533 1080 581
0 0 1 - -
863 863 863
test mathematica.nb 19

In[119]:= 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

::- , 0>, :- >, 82, 5, 3<, 8Log@2D, Log@5D, Log@3D<, 6>


1 1 1 1 1
Out[119]= ,- , ,
2 5 2 5 3

H* Dot Product Cross Product *L


8b c,b*c,b´c,b.c,Dot@b,cD,Cross@b,cD,b×c,b‰c,A.b,b.A,MatrixForm@bD<
In[121]:=

Out[121]= :8- 2, - 5, 0<, 8- 2, - 5, 0<, 8- 2, - 5, 0<, - 7, - 7, 83, 3, - 3<,


-2
8- 2, 5, 3< × 81, - 1, 0<, 83, 3, - 3<, 826, 12, 26<, 843, 26, 14<, 5 >
3

In[122]:= 94+A,3+A2,Transpose@AD,Transpose@A1D,AT ,A2 ,A12 =MatrixForm

8813, 11, 7<, 812, 9, 5<, 811, 9, 9<<


Out[122]//MatrixForm=

3 + A2
889, 8, 7<, 87, 5, 5<, 83, 1, 5<<

TransposeB 8 5 1 F
9 7 3

7 5 5
999T , 7T , 3T =, 98T , 5T , 1=, 97T , 5T , 5T ==
8881, 49, 9<, 864, 25, 1<, 849, 25, 25<<
2
9 7 3
8 5 1
7 5 5

In[123]:= Clear@BD;MatrixForm@B=88-3,5,19<,80,1,5<,86,-18,27<<D

Out[123]//MatrixForm=
- 3 5 19
0 1 5
6 - 18 27

In[124]:= H* Determinant*L
Det@Out@123DD

Out[124]= - 315

In[126]:= B+1MatrixForm
Out[126]//MatrixForm=
- 2 6 20
1 2 6
7 - 17 28

In[128]:= BT MatrixForm
Out[128]//MatrixForm=
H- 3LT 5T 19T
0T 1 5T
6T H- 18LT 27T
20 test mathematica.nb

In[130]:= Transpose@BDMatrixForm

Out[130]//MatrixForm=
-3 0 6
5 1 - 18
19 5 27

In[216]:= Inverse@BDMatrixForm

Out[216]//MatrixForm=
13 53 2
- -
35 35 105
2 13 1
- -
21 21 21
2 8 1
105 105 105

In[218]:= LinearSolve@BD

Out[218]= LinearSolveFunction@83, 3<, <>D

In[219]:= NullSpace@BD

Out[219]= 8<

In[222]:= Eigenvalues@N@BDDMatrixForm

Out[222]//MatrixForm=
27.5269
- 4.87447
2.34761

In[226]:= Eigenvectors@N@BDDSimplifyMatrixForm

Out[226]//MatrixForm=
0.54023 0.155871 0.826956
0.986349 0.10673 - 0.125397
- 0.877241 - 0.46351 - 0.124926
test mathematica.nb 21

Graphics3D@8
AstronomicalData@ð, "OrbitPath"D & ž AstronomicalData@"Planet"D,
In[147]:=

8Orange,
Opacity@.5D, HAstronomicalData@ð, "OrbitPath"D & ž
AstronomicalData@"ApolloAsteroid"DL<
<, PlotRange -> 88-6, 6<, 8-6, 6<, 8-4, 4<<, Boxed -> False,
ViewAngle -> А11D

Out[147]=
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]:= D@xn ,x,8x,3<D

Out[162]= H- 3 + nL H- 2 + nL H- 1 + nL n x-4+n

x3
In[163]:= DB ,xF
3Tan@xD
1
Out[163]= x2 Cot@xD - x3 Csc@xD2
3

Manipulate@D@2xn ,xD,8n,1,20,1<DH* This makes a nice Differential Calculator, which can Differentiate

n
Out[167]=

Integration
In[164]:= IntegrateAx2 ,xE

x3
Out[164]=
3

à x âx
2
In[165]:=

x3
Out[165]=
3
test mathematica.nb 23

Manipulate@Integrate@2xn ,xD,8n,1,20,1<D H* this makes a nice integral calculator, it will integrate

Out[166]=
2 x3
3

1
In[168]:= IntegrateB ,xF
1-x3

F
1+2 x
ArcTanB
LogA1 + x + x2 E
3 1 1
Out[168]= - Log@- 1 + xD +
3 3 6

1
In[170]:= ManipulateBIntegrateB ,xF,8n,1,20,1<FTiming
1-xn

Out[170]= :1.63758 ´ 10-15 ,

2 J5 + 5 N ArcTanB F+
1 1- 5 +4x
2

2 J5 + 5 N
20

>
F - 4 Log@- 1 + xD -
1+ 5 +4x
2 10 - 2 5 ArcTanB
10 - 2 5

J- 1 + 5 N LogB1 - J- 1 + 5 N x + x2 F + J1 + 5 N LogB1 + J1 + 5 N x + x2 F
1 1
2 2

à
1
In[171]:= âx
x3 -1

F
1+2 x
ArcTanB
LogA1 + x + x2 E
3 1 1
Out[171]= - + Log@- 1 + xD -
3 3 6
24 test mathematica.nb

In[172]:= Plot@%,8x,0,2<D

-1.2

-1.4
Out[172]=

-1.6

0.5 1.0 1.5 2.0


test mathematica.nb 25

6 vector
fields and
differential
equations

Plotting Vector field Graphs


H* Note Mathematica 7 uses VectorPlot command instead of VectorFieldPlot

In[183]:= VectorPlotA9ã-12x Sin@2yD, 2y Cos @5xD=, 8x,-Π, Π<, 8y, -Π, Π<, Axes ® True, AxesLabel® 8x,y<,

Out[183]=
x
-3 -2 -1 1 2 3

-1

-2

-3
26 test mathematica.nb

In[187]:= VectorPlot@8Sin@6yD, -y Cos @6xD<, 8x,-Π, Π<, 8y, -Π, Π<, Axes ® True, AxesLabel® 8x,y<, Frame D

Out[187]=
x
-3 -2 -1 1 2 3

-1

-2

-3

In[192]:= VectorPlot @8Sin@2xD,Cos@yD<,8x,-Π, Π<,8y,-Π,Π<,Axes® True,AxesLabel® 8x,y<, Frame® TrueD

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

::z ® FunctionB8x<, ã-x I1 + ã2 x M C@1D - ã-x I- 1 + ã2 x M C@2DF,


1 1
Out[190]=
2 2

ã-x I- 1 + ã2 x M C@1D + ã-x I1 + ã2 x M C@2DF>>


1 1
y ® FunctionB8x<, -
2 2
test mathematica.nb 27

In[191]:= DSolve@8y'@xDŠ a y@xD,y@0DŠ 1<,y@xD,xD

Out[191]= 88y@xD ® ãa x <<

In[193]:= DSolve@2y@tD+2y'@tD+y''@tD==2t,y@tD,tD@@1DD

Out[193]= 9y@tD ® - 1 + t + ã-t C@2D Cos@tD + ã-t C@1D Sin@tD=

In[194]:= y@tD. DSolve@2y@tD+2y'@tD+y''@tD==2t,y@tD,tD@@1DD

Out[194]= - 1 + t + ã-t C@2D Cos@tD + ã-t C@1D Sin@tD

In[199]:= Clear@fD

c1 Cos@5tD c2 Sin@5tD
In[203]:= f@t_D:=t+ + -9
ã-t ã-5t
f@tD.8c1® 1,c2® 1<

Out[204]= - 9 + t + ãt Cos@5 tD + ã5 t Sin@5 tD

In[205]:= Plot@Table@f@xD,8c2,-2,2<,8c1,-2,2<D,8x,-3,3<DTiming H* Timing Gives the Seconds it took the

Out[205]= :5.641,

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<DD,8x,-2,3<DTiming

200

100

Out[206]= :0.765, >


-2 -1 1 2 3

-100

-200

In[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

Out[227]= 88x ® InterpolatingFunction@880., 200.<<, <>D,


y ® InterpolatingFunction@880., 200.<<, <>D, z ® InterpolatingFunction@880., 200.<<, <>D<<
test mathematica.nb 29

In[228]:= ParametricPlot3D@Evaluate@8x@tD,y@tD,z@tD<.%D,8t,0,200<,PlotPoints® 100000DTiming

-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@@1DDSimplify

4 2
Out[208]= - + ã-t C@2D Cos@tD + + ã-t C@1D Sin@tD
5 5
30 test mathematica.nb

In[209]:= y@tD.DSolve@2y@tD+2y'@tD+y''@tD==2Sin@tD,y@tD,tD@@1DDN

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
Out[209]=

In[211]:= y@tD.DSolveAy''@tD-4y'@tD+3y@tDŠ ãH3tL -5Cos@3tD,y@tD,tE@@1DDSimplify

I3 ã3 t H- 1 + 2 tL + 2 Cos@3 tD + 4 Sin@3 tDM


1
Out[211]= ãt C@1D + ã3 t C@2D +
12

H*Initial Conditions*L
DSolveA9y''@xD-4y'@xD+3y@xDŠ ãH3xL -5Cos@3xD,y@0DŠ1,y'@0DŠ1 =,y@xD,xESimplify
In[212]:=

::y@xD ® I9 ãx - 4 ã3 x + 3 ã3 x x + Cos@3 xD + 2 Sin@3 xDM>>


1
Out[212]=
6

In[214]:= DSolveAx2 y''@xD+y@xDŠ 0,y@xD,xE

::y@xD ®
1 1
Out[214]= x C@1D CosB 3 Log@xDF + x C@2D SinB 3 Log@xDF>>
2 2

Das könnte Ihnen auch gefallen