this tutorial is a brief slide-show introduction to

Post on 05-May-2022

11 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

« ≈ 1 of 23

This tutorial is a brief slide-show introduction to elementary mathematics by Mathemat-ica. It covers the following subjects:

Basic Operations; Solving Equations; Sequences & Series

Basic Plotting; Curves and Surfaces

May 26, 2010

Hsin-Yun Hu, Department of Mathematics, Tunghai University

東海大學數學系 胡馨云

Printed from the Mathematica Help Browser 1

©1988-2002 Wolfram Research, Inc. All rights reserved.

« ≈ 2 of 23

Basic OperationsDo arithmetic

In[1]:= 2.3 + 5.36 ∗ 2 − 8.9^2 + 4.5ê1.2

Out[1]= −62.44

Handle numbers of any size

2 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[2]:= 100!

N@Pi, 100D

Out[2]= 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000

Out[3]= 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068

Find the prime factors of an integer

In[4]:= FactorInteger@45DFactorInteger@242D

Out[4]= 883, 2<, 85, 1<<

Out[5]= 882, 1<, 811, 2<<

Find the greatest common divisor & least common multiple

In[6]:= GCD@12, 16DLCM@12, 16D

Out[6]= 4

Out[7]= 48

« ≈ 3 of 23

Basic OperationsFactor the polynomials

Printed from the Mathematica Help Browser 3

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[8]:= Factor@x2 − y2DFactor@x9 − y9D

Out[8]= Hx − yL Hx + yL

Out[9]= Hx − yL Hx2 + x y + y2L Hx6 + x3 y3 + y6L

Multiply out products and power

In[10]:= Expand@H1 + xL5DExpandAHx2 − y2 + 10L3E

Out[10]= 1 + 5 x + 10 x2 + 10 x3 + 5 x4 + x5

Out[11]= 1000 + 300 x2 + 30 x4 + x6 − 300 y2 − 60 x2 y2 − 3 x4 y2 + 30 y4 + 3 x2 y4 − y6

Simplify factors the polynomials

In[12]:= Simplify@x2 + 2 x + 1DSimplify@−108 + 108 x + 45 x2 − 40 x3 − 10 x4 + 4 x5 + x6D

Out[12]= H1 + xL2

Out[13]= H−2 + xL2 H−1 + xL H3 + xL3

« ≈ 4 of 23

Basic OperationsPut all terms over a common denominator

In[14]:= TogetherA 5

x − 3−

2

x + 1E

Out[14]=11 + 3 x

H−3 + xL H1 + xL

4 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

Separate into terms with simple denominators

In[15]:= ApartA x3 − 3 x + 2

Hx + 1L Hx − 3L3E

Out[15]=5

H−3 + xL3 +19

4 H−3 + xL2 +17

16 H−3 + xL −1

16 H1 + xL

Use some mathematical functions

In[16]:= a = 10.0;Sqrt@aDExp@aDLog@aDSin@aDClear@aDb = 1;4 ∗ ArcTan@bDClear@bD

Out[17]= 3.16228

Out[18]= 22026.5

Out[19]= 2.30259

Out[20]= −0.544021

Out[23]= π

« ≈ 5 of 23

Advance OperationsLimit

Printed from the Mathematica Help Browser 5

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[27]:= Clear@nDLimit@xn, x → 2D

Out[28]= 2n

Derivatives

In[29]:= Clear@nDD@xn, xD

Out[30]= n x−1+n

Anti-derivatives

In[31]:= Clear@nD

‡ xn x

Out[32]=x1+n

1 + n

« ≈ 6 of 23

Solving EquationsSolve a polynomial equation in one variable

In[33]:= Solve@a x2 + b x + c == 0, xD

Out[33]= 99x →−b −

è!!!!!!!!!!!!!!!!!!!!b2 − 4 a c2 a

=, 9x →−b +

è!!!!!!!!!!!!!!!!!!!!b2 − 4 a c2 a

==

In[34]:= Solve@x2 + 5 x + 3 == 0, xD

Out[34]= 99x →12I−5 −è!!!!!!13 M=, 9x →

12I−5 +è!!!!!!13 M==

6 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[35]:= Solve@x2 + x + 3 == 0, xD

Out[35]= 99x →12I−1 − è!!!!!!11 M=, 9x →

12I−1 + è!!!!!!11 M==

Solve a simple equation of higher degree

In[36]:= Solve@3 x3 + 2 x2 − 2 x − 1 0, xD

Out[36]= 98x → −1<, 9x →16I1 −è!!!!!!13 M=, 9x →

16I1 +è!!!!!!13 M==

In[37]:= Solve@x6 1, xD

Out[37]= 88x → −1<, 8x → 1<, 8x → −H−1L1ê3<, 8x → H−1L1ê3<, 8x → −H−1L2ê3<, 8x → H−1L2ê3<<

« ≈ 7 of 23

Solving EquationsSolve two simultaneous algebraic equations

In[38]:= sys1 = 8y 1 + 2 x, x 5 − y<;Solve@sys1, 8x, y<D

Out[39]= 99x →43

, y →113

==

In[40]:= sys2 = 9 1 + x

−1 + y== 0, 2 − 3 y + y2 == 0=;

Solve@sys2, 8x, y<D

Out[41]= 88x → −1, y → 2<<

Solve an equations involving exponentials, logarithms and trigonometric functions

Printed from the Mathematica Help Browser 7

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[44]:= eqn1 = x−2 8;Solve@eqn1, xD

Out[45]= 88x → 2 + Log@8D<<

In[46]:= eqn2 = Log@x + 2D 5;Solve@eqn2, xD

Out[47]= 88x → −2 + 5<<

In[48]:= eqn3 = Sin@xD 1ê2;Solve@eqn3, xD

Out[49]= 99x →π6==

« ≈ 8 of 23

Sequences & SeriesList the terms of a sequence

In[50]:= Table@i2, 8i, 10<DTable@j3, 8j, −10, 10<D

TableA 1

k, 8k, 10<E

TableA H−1Lk−1

k2, 8k, 10<E

Out[50]= 81, 4, 9, 16, 25, 36, 49, 64, 81, 100<

Out[51]= 8−1000, −729, −512, −343, −216, −125, −64, −27, −8, −1, 0, 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000<

Out[52]= 91,12

,13

,14

,15

,16

,17

,18

,19

,1

10=

Out[53]= 91, −14

, 19

, −1

16, 1

25, −

136

, 149

, −1

64, 1

81, −

1100

=

8 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

The telescoping sequence

In[54]:= TableA 1

n−

1

n + 1, 8n, 1, 10<E

SumA 1

n−

1

n + 1, 8n, 1, 10<E

Out[54]= 9 12

,16

,1

12,

120

,1

30,

142

,1

56,

172

,1

90,

1110

=

Out[55]=1011

« ≈ 9 of 23

Sequences & SeriesThe arithmetic sequence

In[56]:= a = 2; d = 2;Table@a + Hn − 1L ∗ d, 8n, 1, 10<DSum@a + Hn − 1L∗ d, 8n, 1, 10<D

Out[57]= 82, 4, 6, 8, 10, 12, 14, 16, 18, 20<

Out[58]= 110

by formula

In[59]:= n = 10; dsum =Ha + a + Hn − 1L∗ dL

2∗ n

Out[59]= 110

The geometric sequence

Printed from the Mathematica Help Browser 9

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[60]:= b = 1; r = 1 ê3;Table@b ∗ rn−1, 8n, 1, 10<DSum@b ∗ rn−1, 8n, 1, 10<D

Out[61]= 91, 13

, 19

, 127

, 181

, 1243

, 1729

, 12187

, 16561

, 119683

=

Out[62]=2952419683

by formula

In[63]:= n = 10; rsum =b ∗H1 − rnL

1 − r

Out[63]=2952419683

« ≈ 10 of 23

Basic PlottingThe two-dimensional functions plots

10 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[64]:= Plot@x2 − 2, 8x, −4, 4<, Frame → TrueD;

-4 -2 0 2 4

0

2.5

5

7.5

10

12.5

In[65]:= Plot@Exp@xD, 8x, −4, 4<, Frame → TrueD;

-4 -2 0 2 40

5

10

15

20

25

30

35

Printed from the Mathematica Help Browser 11

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[66]:= Plot@Log@xD, 8x, 0, 4<, Frame → TrueD;

0 1 2 3 4-10

-8

-6

-4

-2

0

« ≈ 11 of 23

Basic PlottingCombining several plots

12 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[67]:= Plot@82x, 3x, 5x<, 8x, −5, 5<, Frame → True, PlotStyle → 8RGBColor@1, 0, 0D, RGBColor@0, 1, 0D, RGBColor@0, 0, 1D<D;

-4 -2 0 2 40

20

40

60

80

100

120

In[68]:= g1 = Plot@Sin@xD, 8x, −2 π, 4 π<, PlotRange → 8−2, 2<, Frame → True, PlotStyle → RGBColor@1, 0, 1DD;g2 = Plot@Cos@xD, 8x, −2 π, 4 π<, PlotRange → 8−2, 2<, Frame → True, PlotStyle → RGBColor@0, 1, 1DD;Show@g1, g2D;

Printed from the Mathematica Help Browser 13

©1988-2002 Wolfram Research, Inc. All rights reserved.

-5 -2.5 0 2.5 5 7.5 10 12.5

-1.5

-1

-0.5

0

0.5

1

1.5

2

-5 -2.5 0 2.5 5 7.5 10 12.5

-1.5

-1

-0.5

0

0.5

1

1.5

2

14 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

-5 -2.5 0 2.5 5 7.5 10 12.5

-1.5

-1

-0.5

0

0.5

1

1.5

2

« ≈ 12 of 23

Basic PlottingThe three-dimensional surfaces plots

Printed from the Mathematica Help Browser 15

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[71]:= g1 = Plot3D@Sin@x yD, 8x, 0, 3<, 8y, 0, 3<D;

0

1

2

3 0

1

2

3

-1-0.5

00.5

1

0

1

2

16 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[72]:= g2 = Plot3D@Exp@−Hx2 + y2LD, 8x, −3, 3<, 8y, −3, 3<, PlotRange → AllD;

-2

0

2-2

0

2

00.250.5

0.751

-2

0

2

« ≈ 13 of 23

Basic PlottingConti.

Printed from the Mathematica Help Browser 17

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[73]:= Show@g1, Mesh → FalseD;

0

1

2

3 0

1

2

3

-1-0.5

00.5

1

0

1

2

18 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[74]:= Show@g2, Shading → FalseD;

-2

0

2-2

0

2

00.250.5

0.751

-2

0

2

« ≈ 14 of 23

Basic PlottingConti.

Printed from the Mathematica Help Browser 19

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[75]:= Show@ContourGraphics@g1DD;

0 0.5 1 1.5 2 2.5 30

0.5

1

1.5

2

2.5

3

In[76]:= Show@g2, ViewPoint → 8−1, −3, 1<D;

-20

2

-20

2

0

0.25

0.5

0.75

1

02

-20

20 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[77]:= Show@g2, Boxed → FalseD;

-2

0

2

-2

0

2

00.250.5

0.75

1

-2

0

2

« ≈ 15 of 23

Curves In PlaneTeardrop

Printed from the Mathematica Help Browser 21

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[78]:= a = 1.5; b = 3;ParametricPlot@8a ∗ Cos@tD − aê2 ∗ Sin@2 ∗ tD, b ∗ Sin@tD<, 8t, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-2 -1 1 2

-3

-2

-1

1

2

3

Ellipse

In[80]:= a = 4; b = 2;ParametricPlot@8a ∗ Cos@tD, b ∗ Sin@tD<, 8t, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-4 -2 2 4

-2

-1

1

2

22 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

Epicycloid

In[82]:= a = 32; b = 4;

ParametricPlotA9Ha + bL ∗ Cos@tD − b ∗ CosA a + b

b∗ tE, Ha + bL∗ Sin@tD − b ∗ SinA a + b

b∗ tE=, 8t, 0, 2 ∗ Pi<, AspectRatio → AutomaticE;

-30 -20 -10 10 20 30

-30

-20

-10

10

20

30

« ≈ 16 of 23

Involute of a circle

Printed from the Mathematica Help Browser 23

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[84]:= ParametricPlot@8Sin@θD − θ ∗ Cos@θD, Cos@θD + θ ∗ Sin@θD<, 8θ, 0, 6 ∗ Pi<, AspectRatio → AutomaticD;

-15 -10 -5 5 10 15

-15

-10

-5

5

10

Rose curve (odd petal)

24 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[85]:= r = 2 ∗ Cos@5 ∗ θD;ParametricPlot@8r ∗ Cos@θD, r ∗ Sin@θD<, 8θ, 0, Pi<, AspectRatio → AutomaticD;

-1.5 -1 -0.5 0.5 1 1.5 2

-2

-1

1

2

Rose curve (even petal)

Printed from the Mathematica Help Browser 25

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[87]:= r = 2 ∗ Cos@2 ∗ θD;ParametricPlot@8r ∗ Cos@θD, r ∗ Sin@θD<, 8θ, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-2 -1 1 2

-2

-1

1

2

« ≈ 17 of 23

Cardioid / Heart-shaped

26 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[89]:= r = 2 ∗H1 − Cos@θDL;ParametricPlot@8r ∗ Cos@θD, r ∗ Sin@θD<, 8θ, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-4 -3 -2 -1

-2

-1

1

2

Star-shaped

Printed from the Mathematica Help Browser 27

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[91]:= r = 50 ∗ H1 + 0.2 ∗ Cos@6 ∗ θDL;ParametricPlot@8r ∗ Cos@θD, r ∗ Sin@θD<, 8θ, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-60 -40 -20 20 40 60

-40

-20

20

40

« ≈ 18 of 23

Curves In SpaceHelix

28 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[93]:= ParametricPlot3D@83 ∗ Cos@3 tD, 3 ∗ Sin@3 tD, t<, 8t, 0, 4 ∗ Pi<, AspectRatio → AutomaticD;

-20

2

-20

2

0

5

10

-20

2

Perodic curve

Printed from the Mathematica Help Browser 29

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[94]:= ParametricPlot3D@82 ∗ t, Sin@5 ∗ tD + Sin@tD, t<, 8t, 0, 4 ∗ Pi<, AspectRatio → AutomaticD;

0

10

20

-2-10120

5

10

0

5

« ≈ 19 of 23

Surfaces In Space Cylindrical surface

30 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[95]:= ParametricPlot3D@8Cos@uD, Sin@uD, v<, 8u, 0, 2 ∗ Pi<, 8v, 0, 1<, AspectRatio → AutomaticD;

-1-0.5

00.5

1 -1

-0.5

0

0.5

1

00.250.5

0.751

-1-0.5

00.5

Riemann surface

Printed from the Mathematica Help Browser 31

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[96]:= ParametricPlot3D@8u ∗ Cos@vD, u ∗ Sin@vD, 2 ∗ v<, 8u, 0, 5<, 8v, 0, 4 ∗ Pi<, BoxRatios → 81.5, 1.5, 2<D;

-5 -2.5 0 2.55

-5-2.5

02.5

5

0

10

20

5-2.5

02.5

Sphere

32 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[97]:= ρ = 1;ParametricPlot3D@8ρ ∗ Sin@uD∗ Cos@vD, ρ ∗ Sin@uD∗ Sin@vD, ρ ∗ Cos@uD<, 8u, 0, Pi<, 8v, 0, 12 ∗ Piê6<, AspectRatio → AutomaticD;

-1-0.5

00.5

1

-1

-0.50

0.51

-1

-0.5

0

0.5

1

-1-0.5

00.5

1

-0.50

0.5

« ≈ 20 of 23

Ellipsoid

Printed from the Mathematica Help Browser 33

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[99]:= a = 1; b = 1; c = 1.5;ParametricPlot3D@8a ∗ Cos@vD∗ Cos@uD, b ∗ Cos@vD∗ Sin@uD, c ∗ Sin@vD<, 8u, 0, 2 ∗ Pi<,8v, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-1 -0.5 0 0.51

-1-0.5

00.5

1

-1

0

1

1-0.5

00.5

Paraboloid

34 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[101]:=

ParametricPlot3D@82 ∗ u ∗ Cos@vD, 2 ∗ u ∗ Sin@vD, u2<, 8u, 0, 4<, 8v, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-50

5

-5

0

5

0

5

10

15

-50

5

-5

0

5

« ≈ 21 of 23

Tours

Printed from the Mathematica Help Browser 35

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[102]:=

a = 2;ParametricPlot3D@8H4 + a ∗ Cos@vDL∗ Cos@uD, H4 + a ∗ Cos@vDL∗ Sin@uD, a ∗ Sin@vD<, 8u, 0, 2 ∗ Pi<, 8v, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-5

0

5-5

0

5

-2-1012

-5

0

5

Wrinkled sphere

36 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[104]:=

ρ = 1 + 0.2 ∗ Sin@uD∗ Sin@5 ∗ vD;ParametricPlot3D@8ρ ∗ Sin@uD∗ Cos@vD, ρ ∗ Sin@uD∗ Sin@vD, ρ ∗ Cos@uD<, 8u, 0, Pi<, 8v, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-1-0.5

00.5

1

-1-0.5

00.5

1

-1

-0.5

0

0.5

1

-1-0.5

00.5

1

-1-0.5

00.5

« ≈ 22 of 23

Bumpy sphere

Printed from the Mathematica Help Browser 37

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[106]:=

ρ = 1 + 0.2 ∗ Sin@8 ∗ uD ∗ Sin@8 ∗ vD;ParametricPlot3D@8ρ ∗ Sin@uD∗ Cos@vD, ρ ∗ Sin@uD∗ Sin@vD, ρ ∗ Cos@uD<, 8u, 0, Pi<, 8v, 0, 2 ∗ Pi<, AspectRatio → AutomaticD;

-1-0.5

00.5

1

-1-0.5

00.5

1

-1

-0.5

0

0.5

1

-1-0.5

00.5

1

-1-0.5

00.5

Mobius strip

38 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

In[108]:=

ParametricPlot3D@8H4 − v ∗ Sin@uDL∗ Cos@2 ∗ uD, H4 − v ∗ Sin@uDL∗ Sin@2 ∗ uD, v ∗ Cos@uD<,8u, 0, Pi<, 8v, −2, 2<, ViewPoint → 81.2, −2.5, 1.2<, AspectRatio → AutomaticD;

-5-2.5

02.5

-5-2.5

02.5

5

-2

-1

0

1

2

-5-2.5

02 5

-5-2.5

02.5

« ≈ 23 of 23

Use the Help Browser to learn more

You now know enough to start using Mathematica.

But the examples you have seen represent only a small part of its capabilities.

Here are some resources you can draw on to learn more about Mathematica.

Printed from the Mathematica Help Browser 39

©1988-2002 Wolfram Research, Inc. All rights reserved.

àBuilt-in Functions

Click a link to view a list of all built-in functions in that category.

Numerical Computation Algebraic Computation Mathematical Functions

Lists and Matrices Graphics and Sound Programming

Input and Output Notebooks System Interface

àHelp Browser

The Help Browser contains detailed information on all aspects of Mathematica.

Built-in Functions Add-ons & Links The Mathematica Book

Front End Getting Started Tour

Demos Master Index

40 Printed from the Mathematica Help Browser

©1988-2002 Wolfram Research, Inc. All rights reserved.

top related