atex graphics with pstricks · 3. pstricks to use pstricks you must include the following lines in...

35
L A T E X Graphics with PSTricks This presentation is also available online. Please visit my home page and follow the links. http://www.math.msu.edu/hensh 1. Resources (a) ImageMagick is a collection of (free) image manipulation tools. You can find out more by visiting http://www.imagemagick.com (b) The L A T E X Graphics Companion. - Paperback: 608 pages - Publisher: Addison-Wesley Pub Co; 1st edition (April 15, 1997) - ISBN: 0201854694 (c) The L A T E X Graphics Companion (2nd Edition). - Paperback: 976 pages - Publisher: Addison-Wesley Professional; 2 edition (August 12, 2007) - ISBN: 0321508920 (d) PSTricks: Graphics and PostScript for T E X and L A T E X. - Paperback: 912 pages - Publisher: UIT Cambridge Ltd. (September 1, 2011) - ISBN: 1906860130 (e) The PSTricks web site. https://www.tug.org/PSTricks (f) PostScript(R) Language Tutorial and Cookbook (also called the “The Blue Book”) - Paperback: 256 pages - Publisher: Addison-Wesley Professional (January 1, 1985) - ISBN: 0201101793 2. PSTricks 1

Upload: others

Post on 08-Oct-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

LATEX Graphics with PSTricks

This presentation is also available online. Please visit my home page and follow the links.

http://www.math.msu.edu/∼hensh

1. Resources

(a) ImageMagick is a collection of (free) image manipulation tools. You can find out more byvisiting

http://www.imagemagick.com

(b) The LATEX Graphics Companion.

- Paperback: 608 pages

- Publisher: Addison-Wesley Pub Co; 1st edition (April 15, 1997)

- ISBN: 0201854694

(c) The LATEX Graphics Companion (2nd Edition).

- Paperback: 976 pages

- Publisher: Addison-Wesley Professional; 2 edition (August 12, 2007)

- ISBN: 0321508920

(d) PSTricks: Graphics and PostScript for TEX and LATEX.

- Paperback: 912 pages

- Publisher: UIT Cambridge Ltd. (September 1, 2011)

- ISBN: 1906860130

(e) The PSTricks web site.

https://www.tug.org/PSTricks

(f) PostScript(R) Language Tutorial and Cookbook (also called the “The Blue Book”)

- Paperback: 256 pages

- Publisher: Addison-Wesley Professional (January 1, 1985)

- ISBN: 0201101793

2. PSTricks

1

Page 2: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

(a) We start with some examples.

−5 −4 −3 −2 −1 1 2 3 4 5

5

10

15

20

25

30

y = x2

Figure 1: Graphing simple functions.

1 2 3 4 5 6

−1

1

2

3

r = 1 + 2 sin θ

r-θ Coordinate System

Figure 2: Graphing with some fancy effects.

2

Page 3: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

−2 −1 1 2

1

2

3

r = 1 + 2 sin θx-y Coordinate System

Figure 3: Polar Graphs

b

1

P (2, 6)

Figure 4: Area between two curves.

3

Page 4: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

~u

~v

Figure 5: A pair of vectors

~u

~v

~v

~u + ~v

Figure 6: Vector addition with a grid.

4

Page 5: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

π

12

1

bb

b

(a)(b)

(c)

Figure 7: Polar Grid

xy

z

Figure 8: Sketching a cylinder.

5

Page 6: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

x

y

z

b

b

Figure 9: Position Vectors

Figure 10: Level Curves

6

Page 7: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

θ = α

θ = β

r = g1(θ)

r = g2(θ)

r = a

Figure 11: Polar Area

xy

z

b

Figure 12: A Tangent Line

7

Page 8: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

−1 1

−1

1

c = 0.01

c = 0.025

c = 0.05

c = 0.075

c = 0.1

c = 0.11

c = 0.125

b

xy = c

P0

Figure 13: Lagrange Multipliers

8

Page 9: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

x

y

z

Figure 14: Exposed Solid

9

Page 10: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

x

y

z

Figure 15: Surface Integrals

x

y

z

Figure 16: Distorted Surface

10

Page 11: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Figure 17: Fractals

11

Page 12: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Isn’tPSTricks

lots of fun

2013 !

Isn’tPSTricks

lots of fun

2013

Isn’tPSTricks

lots of fun

2013 !Figure 18: Lens Effects

−1 1 2 3

−1

1

2

C

Increasing Vector Magnitude

Figure 19: Vector Field

12

Page 13: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

3. PSTricks

To use PSTricks you must include the following lines in the preamble of your document.

1 \usepackage{pst-eucl}

2 \usepackage{calc}

3 \usepackage{pst-3dplot}%

4 \usepackage{pst-grad}

5 \usepackage{pst-plot,pst-math,pstricks-add}%

6 \usepackage{pst-all}

7 %\RequirePackage{pst-xkey}

We should mention that there have been some incompatibilities between the pstcol package(used by PSTricks) and the graphics packages mentioned above.

Using colors with PSTricks is similar to what has already been discussed. The real power ofthe PSTricks package is the ability to create graphics using LATEX-like syntax.

13

Page 14: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

(a) Preliminaries

PSTricks provides users with the capability to draw using the familiar syntax of LATEX.

1 \psline[linecolor=blue,linewidth=1.25pt](-3,1)(2,2)

The previous example might be easier to understand if we include more detail in thesketch. Thus

1 \showgrid

2 \psline[linecolor=blue,linewidth=1.25pt,arrowscale=2]{->}(-3,1)(2,2)

1 \newpsobject{showgrid}{psgrid}{%

2 gridlabels=0pt%

3 ,griddots=0%

4 ,gridwidth=0.5pt%

5 ,gridcolor=gray%

6 ,subgriddiv=0%

7 ,subgridwidth=0.25pt%

8 ,subgridcolor=red}

14

Page 15: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

(b) Basic Graphics Objects

Here’s a curve. Notice that the points used can be turned on (as shown) or off.

1 %\begin{pspicture}(\xmin,\ymin)(\xmax,\ymax)

2 \showgrid

3 \pscurve[linecolor=red,linewidth=1.5pt,showpoints=true]%

4 (\xmin,1)(0,2)(3,1)(\xmax,\ymax)

5 %\end{pspicture}

bb

b

b

where the values \xmin, \ymin, etc. have been defined previously as

1 \def\xmin{-6}\def\xmax{6}

2 \def\ymin{-6}\def\ymax{6}

15

Page 16: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

We begin by setting the default unit(s) in PSTricks using the command\psset{unit=1cm} . This is actually the default value.

1 %\begin{pspicture}(\xmin,\ymin)(\xmax,\ymax)

2 \showgrid

3 \pscurve[linecolor=red,linewidth=1.5pt,showpoints=true]

4 (\xmin,1)(0,2)(3,1)(\xmax,\ymax)

5 \psbezier[style=myCurveStyle,linecolor=green]{-}%

6 (-4,1)(-2,3)(1,-4)(5,5)

7 %\end{pspicture}

bb

b

b

There are built-in shapes

1 %\begin{pspicture}(\xmin,\ymin)(\xmax,\ymax)

2 \showgrid

3 \psellipse[linecolor=blue,linewidth=1.5pt]

4 (1,0)(1,1.5)

5 \psdots[linecolor=red,linewidth=1.25pt](0,0)

6 \SpecialCoor

7 \uput{6pt}[180](0,0){$(0,0)$}

8 \NormalCoor

9 %\end{pspicture}

b(0, 0)

16

Page 17: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Here is a circle centered at (−2, −1) of radius 2.

1 %\begin{pspicture}(\xmin,\ymin)(\xmax,\ymax)

2 \showgrid

3 \pscircle[linecolor=red,linewidth=1.5pt]

4 (-2,-1){2}

5 %\end{pspicture}

Here is the same object filled-in and clipped.

1 %\begin{pspicture}(\xmin,\ymin)(\xmax,\ymax)

2 \showgrid

3 \psclip{\myframe(\xmin,\ymin)(\xmax,\ymax)}

4 \pscircle*[linecolor=red,linewidth=1.5pt]

5 (-2,-1){2}

6 \endpsclip

7 \pswedge*[linecolor=white](-2,-1){1}{15}{105}

8 %\end{pspicture}

17

Page 18: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Finally, we plot some functions. To do this we’ll use some custom macros that give theuser better control over the coordinate system.

1 \begin{pspicture}(\xmin,\ymin)(\xmax,\ymax)

2 \showgrid

3 \pstVerb{%

4 /f@ {dup mul} def % x^2

5 }

6 %%%%%%%%%%%%%%%%%%%%

7 %% Axes and Ticks %%

8 %%%%%%%%%%%%%%%%%%%%

9 \myaxes{<->}(0,0)(\xmin,\ymin)(\xmax,\ymax)

10 \xTickMarks{\xmin}{\xmax}{1}

11 \yTickMarks{\ymin}{\ymax}{5}

12 %%%%%%%%%%%%%%%%%%%%%%%

13 %% Graphical Objects %%

14 %%%%%%%%%%%%%%%%%%%%%%%

15 \psclip{\myframe(\xmin,\ymin)(\xmax,\ymax)}

16 \psplot[style=myPlotStyle]

17 {\xmin}{\xmax}{x f@}

18 \endpsclip

19 %%%%%%%%%%%%

20 %% Labels %%

21 %%%%%%%%%%%%

22 \SpecialCoor

23 \uput{6pt}[0](!3 dup f@){$y=x^2$}

24 \NormalCoor

25 \end{pspicture}

18

Page 19: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

−6 −5 −4 −3 −2 −1 0 1 2 3 4 5 6−5

0

5

10

15

20

25

30

35

40

y = x2

And again, using better grid controls.

−6 −5 −4 −3 −2 −1 0 1 2 3 4 5 6−5

0

5

10

15

20

25

30

35

40y = x2

19

Page 20: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Here’s something useful for integration theory. Use the sketch to estimate the integralbelow.

5

2

1

xdx

y =1

x

1 2 3 4 5 6

1

20

Page 21: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Here is the code

1 \def\xmin{0}\def\xmax{6}

2 \def\ymin{0}\def\ymax{1}

3 \def\dommin{\xmin}\def\dommax{\xmax}

4 \VR{3in}{2.5in}

5

6 \newpsobject{newgrid}{psgrid}{%

7 gridlabels=0pt%

8 ,griddots=0%

9 ,gridwidth=0.5pt%

10 ,gridcolor=gray%

11 ,subgriddiv=4%

12 ,subgridwidth=0.25pt%

13 ,subgridcolor=red}

14 \begin{pspicture}(\xmin,\ymin)(\xmax,\ymax)

15 \newgrid

16 %%%%%%%%%%%%%%%%%%%%

17 %% Axes and Ticks %%

18 %%%%%%%%%%%%%%%%%%%%

19 \SpecialCoor

20 %% Labels go here

21 \rput[lr](!\xmax\space\xmax\space\xmin\space sub 15 div sub

22 \ymax\space\ymax\space\ymin\space sub 25 div sub){$y=\dfrac{1}{x}$}

23 \NormalCoor

24 \myaxes{<->}(0,0)(\xmin,\ymin)(\xmax,\ymax)

25 %% Change these as needed. #1 - start, #2 - end, #3 - increment

26 \xTickMarks{\xmin}{\xmax}{1}

27 \yTickMarks{\ymin}{\ymax}{1}

28 \psclip{\psframe(\xmin,\ymin)(\xmax,\ymax)}

29 %% Graphing directives go here, e.g.,

30 \psplot[style=myPlotStyle]

31 {0.1}{\xmax}{1 x div}

32 \endpsclip

33 \SpecialCoor

34 \psline[fillstyle=crosshatch]{-}(3,0)(3.5,0)(!3.5 1 3

35 div)(!3 1 3 div)(3,0)

36 \psline[fillstyle=crosshatch]{-}(3.5,0)(4,0)(!4 1 3.5

37 div)(!3.5 1 3.5 div)(3.5,0)

38 \psline[fillstyle=crosshatch]{-}(4,0)(4.5,0)(!4.5 1 4

39 div)(!4 1 4 div)(4,0)

40 \psline[fillstyle=crosshatch]{-}(4.5,0)(5,0)(!5 1 4.5

41 div)(!4.5 1 4.5 div)(4.5,0)

42 \NormalCoor

43 \end{pspicture}

21

Page 22: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

(c) Plotting Data from a File

Suppose that you wish to plot the following data.

0, 00.0628, 0.062790.1256, 0.12533

... ...

The following code does the trick.

1 %\begin{pspicture}(\xmin,\ymin)(\xmax,\ymax)

2 \showgrid

3 %% Axes and Ticks %%

4 \myaxes{<->}(0,0)(\xmin,\ymin)(\xmax,\ymax)

5 %% Graphical Objects %%

6 \psclip{\myframe(\xmin,\ymin)(\xmax,\ymax)}

7 \fileplot{plotData.txt}

8 \endpsclip

9 \SpecialCoor

10 \rput[lt](!\xmax\space\xmin\space sub 15 div

11 \ymax\space\ymax\space\ymin\space sub 25 div sub){$y=\sin x$}

12 \NormalCoor

13 %\end{pspicture}

y = sin x

22

Page 23: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

4. Several examples from geometry.

D

C

A B

E

80◦

30◦

A80◦

B

C

77◦

40◦

DE

53◦50◦60◦

A

B

C

P

T V

R

E

23

Page 24: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

5. A few exotic tricks.

(a) A vector field.

−2 −1 1 2

−2

−1

1

2

24

Page 25: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

(b) An ice-cream cone.

x

y

z

x

y

z

x y

z

25

Page 26: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

(c) A level surface.

R

S

f(x, y, z) = c

b

b

∆σk

∆Pk

∆Ak

p

p∇f (xk, yk, zk)

ukvk

26

Page 27: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Figure 20: Fractals - Sierpinski Triangle

x

y

z

Figure 21: Sphere

The equation of a sphere with radius r centered at the origin is

x2 + y2 + z2 = r2

27

Page 28: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

0

80

160

−80

−160

20 · 103 40 · 103 60 · 103 80 · 103 100 · 103

x

y

Figure 22: Brownian Motion

1

2

3

4

−1

−2

1 2 3 4−1−2−3−4−5

Figure 23: Not Sure What to Call This

28

Page 29: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Figure 24: Tessellations?

Page 30: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

3

.141

59 26535

897

9323846264

3383279502884

19716

9399

375105820974944592

3078164062862089986

2803

482534

2117

0679821480865132823066

470

9384460955058223172535940

8128

4811

174

502

841

0270

193852110555964462294895493

038

1964

428

81097566593344612847564823378

6783

1652

7120190

9145

6485

66

92346034861045432664821339360726024

9141

2737

24587006606315588174881520920962829

25

4091

7153

643

678

9259

03600

1133

0530

54882046652138414695194151160943305727

03657

59591

953092186117381932611793105118548074462379

96274

9567

3518

8575

2724891

227

938

1830

1194

9129

83367336244065664308602139494639522473719070

217986

09437

02770539217176293176752384674818467669405132000

56812

7145

2635

60827

785

771

342

757

789

609

1736

3717

87214

6844090122495343014654958537105079227968925892354201

995611212

90219608640344181598136297747713099605187072113499999983

7297

8049

9510

59731

732

8160963

185

9502

445

9455

3469

0830

2642

522308253344685035261931188171010003137838752886587533208

38142061717

76691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959

Figure 25: π Spiral

30

Page 31: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Transparency Effects

The sketch below shows the infinite plane x = 0.

xy

z

xy

z

x = 0

In a similar manner one can sketch the graphs of the equations y = 0 and z = 0.

x

y

z

x

y

z

x = 0y =0

z =0

Notice that these three planes break up three-space into eight octants. The first octant coincides withpositive x, y and z-coordinates and is three-dimensional analogue of quadrant I in the plane.

31

Page 32: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

A Saddle Point

x

y

z

x

y

z

32

Page 33: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Example 1. A Familiar Curve

Find the areas of the shaded regions.

r1 = 2 cos θ − sin θ

r2 = cos θ

1 2

−1

1

Pb

We first need to find the polar coordinates of pointof intersection, P . Setting r1 = r2 and solving we seethat θ = π/4. It follows that the area of green portionof the shaded region is given by

AG =1

2

∫ π/4

0

(

r21 − r2

2

)

It follows that

AG =1

2

∫ π/4

0

sin2 θ + 3 cos2 θ − 4 sin θ cos θ dθ

=1

2

∫ π/4

0

1 + 2 cos2 θ − 2 sin 2θ dθ

=1

2

∫ π/4

0

2 + cos 2θ − 2 sin 2θ dθ

=1

4(4θ + sin 2θ + 2 cos 2θ)

π/4

0

=1

4{(π + 1 + 0) − (0 + 0 + 2)} =

π − 1

4

Notice that

AG + AB =1

2

arctan 2

0

r21 dθ

(Compare this last equation to the gas tank problem.)

Finally, can you find AY?

33

Page 34: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Definition. The Gamma Function

Γ(x) =

0

tx−1e−t dt (1)

Here the (improper) integral converges absolutely for all x ∈ R except for the non-positive integers. Infact, the Gamma function can be extended throughout the complex plane (again, except for thenon-positive integers).

y = Γ(x)

b b b

b

b

b

−4 −3 −2 −1 1 2 3 4 5

2

6

24

Observe that

Γ(1) =

0

t0e−t dt

=−1

et

0

= 0 − (−1) = 1

and for positive integers n, integration by parts yields the recursive relation

Γ(n + 1) =

0

tne−t dt

= −tne−t

0

+ n

0

tn−1e−t dt

= 0 + nΓ(n)

and Euler had found his extension. That is, for each nonnegative integer n, he could now define thefactorial by

n! = Γ(n + 1) (2)

34

Page 35: ATEX Graphics with PSTricks · 3. PSTricks To use PSTricks you must include the following lines in the preamble of your document. 1 \usepackage{pst-eucl} 2 \usepackage{calc} 3 \usepackage{pst-3dplot}%

Sketch the curve given by the equation below in polar coordinates.

r1 = f(θ) = 2 cos θ − sin θ, 0 ≤ θ ≤ π (3)

−2 −1 1 2

−1

1

m = tan(arctan 2) = 2

r1 = 2 cos θ − sin θ, 0 ≤ θ ≤ π

b

rθ-Coordinate System

1 2 3 4 5 6

−2

−1

1

2 r = f(θ)

This busy sketch requires some explanation. Recall that the given (polar) equationdefines a circle of radius

√5/2 centered at (1, −1/2). The blue part of circle identifies

that portion of polar equation r1 = 2 cos θ−sin θ, 0 ≤ θ ≤ arctan 2, i.e., when r1 ≥ 0.The red part identifies the part of the curve for arctan 2 ≤ θ ≤ π, i.e., when r1 < 0.

The yellow portion is actually the sketch of the curve

r2 = |f(θ)|, arctan 2 ≤ θ ≤ π (4)

The vectors (arrows) trace out the curve r2 for 0 ≤ θ ≤ 2π. Notice that the equationin (4) yields two circles which are symmetric about the line y = 2x (shown in green).

35