Mathematica for Physicists and Engineers - K. B. Vijaya Kumar - E-Book

Mathematica for Physicists and Engineers E-Book

K.B. Vijaya Kumar

0,0
75,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Mathematica for Physicists and Engineers

Hands-on textbook for learning how to use Mathematica to solve real-life problems in physics and engineering

Mathematica for Physicists and Engineers provides the basic concepts of Mathematica for scientists and engineers, highlights Mathematica’s several built-in functions, demonstrates mathematical concepts that can be employed to solve problems in physics and engineering, and addresses problems in basic arithmetic to more advanced topics such as quantum mechanics.

The text views mathematics and physics through the eye of computer programming, fulfilling the needs of students at master’s levels and researchers from a physics and engineering background and bridging the gap between the elementary books written on Mathematica and the reference books written for advanced users.

Mathematica for Physicists and Engineers contains information on:

  • Basics to Mathematica, its nomenclature and programming language, and possibilities for graphic output
  • Vector calculus, solving real, complex and matrix equations and systems of equations, and solving quantum mechanical problems in infinite-dimensional linear vector spaces
  • Differential and integral calculus in one and more dimensions and the powerful but elusive Dirac Delta function
  • Fourier and Laplace transform, two integral transformations that are instrumental in many fields of physics and engineering for the solution of ordinary and partial differential equations

Serving as a complete first course in Mathematica to solve problems in science and engineering, Mathematica for Physicists and Engineers is an essential learning resource for students in physics and engineering, master’s students in material sciences, geology, biological sciences theoretical chemists. Also lecturers in these and related subjects will benefit from the book.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 476

Veröffentlichungsjahr: 2023

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Cover

Title Page

Copyright

Preface

Note

Foreword

About the Authors

1 Preliminary Notions

1.1 Introduction

1.2 Versions of Mathematica

1.3 Getting Started

1.4 Simple Calculations

1.5 Built-in Functions

1.6 Additional Features

Notes

2 Basic Mathematical Operations

2.1 Introduction

2.2 Basic Algebraic Operations

2.3 Basic Trigonometric Operations

2.4 Basic Operations with Complex Numbers

3 Lists and Tables

3.1 Introduction

3.2 Lists

3.3 Arrays

3.4 Tables

3.5 Extracting the Elements from the Arrays/Tables

4 Two-Dimensional Graphics

4.1 Introduction

4.2 Plotting Functions of a Single Variable

4.3 Additional Commands

4.4 Plot Styles

4.5 Probability Distribution

4.6 Some More Useful Commands

Notes

5 Parametric, Polar, Contour, Density, and List Plots

5.1 Introduction

5.2 Parametric Plotting

5.3 Polar Plots

5.4 Implicit Plot

5.5 Contour Plots

5.6 Density Plot

5.7 ListPlot and ListLinePlot

5.8 LogPlot, LogLogPlot, ErrorListPlot

5.9 Least Square Fit

5.10 Plotting of Complex Numbers

6 Three-Dimensional Graphics

6.1 Introduction

6.2 Plotting Function of Two Variables

6.3 Parametric Plots

6.4 3D Plots in Cylindrical and Spherical Coordinates

6.5 ContourPlot3D

6.6 ListContourPlot3D

6.7 ListSurfacePlot3D

6.8 Surface of Revolution

6.9 Conicoids

Notes

7 Matrices

7.1 Introduction

7.2 Properties of Matrices

7.3 Types of Matrices

7.4 The Rank of the Matrix

7.5 Special Matrices

7.6 Creation of a Matrix and Matrix Operations

7.7 Properties of the Special Matrices

7.8 Direct Sum of Matrices

7.9 Direct Product of Matrices

7.10 Examples from Group Theory

8 Solving Algebraic and Transcendental Equations

8.1 Introduction

8.2 Solving System of Linear Equations

8.3 Nonlinear Algebraic Equations

8.4 Solving Complex Equations

8.5 Solving Transcendental Equations

9 Eigenvalues and Eigenvectors of a Matrix

9.1 Introduction

9.2 Eigenvalues and Eigenvectors

9.3 Cayley–Hamilton Theorem

9.4 Diagonalization of a Matrix

9.5 Some More Properties of the Special Matrices

9.6 Power of a Matrix

9.7 Power of a Matrix by Diagonalization

9.8 Bilinear, Quadratic, and Hermitian Forms

9.9 Principal Axes Transformation

10 Differential Calculus

10.1 Introduction

10.2 Limits

10.3 Differentiation

10.4 Derivatives of Functions in Parametric Forms

10.5 Rolle's Theorem

10.6 Mean Value Theorem

10.7 Series

10.8 Maxima and Minima

10.9 Differential Equations

Notes

11 Integral Calculus

11.1 Introduction

11.2 Evaluation of Indefinite Integrals

11.3 Evaluation of Definite Integrals

11.4 Two and Three-Dimensional Integrals

11.5 Evaluation of the Integral in Polar Coordinates

11.6 Evaluation of Special Integrals

11.7 Orthogonal Polynomials

11.8 Area Between Curves

11.9 Application of Green's Theorem in a Plane

11.10 Area of Surfaces of Revolution

Notes

12 Dirac Delta Function

12.1 Introduction

12.2 The Limiting Form of the Dirac Delta Function

12.3 Integral Representation of the Dirac Delta Function

12.4 Some Important Properties of the Dirac Delta Function

12.5 The Three-Dimensional Dirac Delta Function

13 Fourier Transforms

13.1 Introduction

13.2 Fourier Transforms

13.3 Scaling Property

13.4 Shifting Property

13.5 Fourier Sine and Cosine Transforms

13.6 Fourier Transform of the Derivative

13.7 Inverse Fourier Transform

13.8 Convolution

13.9 Convolution Theorem for Fourier Transforms

13.10 Parseval's Theorem

14 Laplace Transforms

14.1 Introduction

14.2 Some Simple Examples

14.3 Properties of the Laplace Transforms

14.4 Laplace Transform of the Derivative

14.5 Laplace Transform of Certain Special Functions

14.6 The Laplace Transform of Error and Complementary Error Functions

14.7 The Evaluation of a Certain Class of Definite Integrals Using Laplace Transforms

14.8 The Inverse Laplace Transform

14.9 Solving the Differential Equation by Laplace Transform

14.10 Convolution Theorem

14.11 Graphical Treatment of the Convolution

Notes

15 Vectors

15.1 Introduction

15.2 Properties

15.3 Vector Differentiation

15.4 Directional Derivative

15.5 Unit Vector Normal to the Surface

15.6 Gradient, Divergence, and Curl in the Cartesian Coordinate System

15.7 Expressing the Gradient, Divergence, and Curl in Other Coordinate Systems

15.8 Vector Plots

Notes

16 Linear Vector Spaces and Quantum Mechanics

16.1 Introduction

16.2 Linear Independence, Basis, and Dimension

16.3 Dimension of the Vector Space

16.4 Basis of the Vector Space

16.5 Completeness

16.6 Scalar Product in a Linear Vector Space

16.7 Norm of the Vector

16.8 Orthonormal Basis

16.9 Linear Independence of Functions

16.10 Hilbert Space

16.11 Completeness in Functional Space

16.12 The Dirac Ket and Bra Notation

16.13 The Hermitian and Skew-Hermitian Operators in Dirac Ket and Bra Notation

16.14 Expectation Values

16.15 Matrix Representation of the Linear Operator

Notes

17 Application of Mathematica to Quantum Mechanics

17.1 Introduction

17.2 A Particle in a One-Dimensional Box

17.3 A Particle in a Two-Dimensional Box

17.4 The Hydrogen Atom Problem

17.5 The One-Dimensional Linear Harmonic Oscillator Atom Problem

17.6 Three-Dimensional Harmonic Oscillator

17.7 Miscellaneous Problems

Note

References

Index

End User License Agreement

List of Tables

Chapter 1

Table 1.1 Standard symbols are used in Mathematica to do arithmetic operatio...

Table 1.2 Ways to refer to previous results.

Table 1.3 List of a few elementary built-in functions.

Table 1.4 Evaluation in degrees or radians.

Table 1.5 Illustrations of built-in functions.

Chapter 2

Table 2.1 List of commands to perform some elementary calculations.

Table 2.2 List of built-in functions for transforming complex numbers.

Chapter 3

Table 3.1 List of commands useful for creating tables.

Table 3.2 List of Mathematica commands and Mathematica output.

Chapter 5

Table 5.1 Table of the cardioid and r2 = 4 cos θ...

Chapter 10

Table 10.1 List of the relative maximum and minimum of x + sin 2x...

Table 10.2 List of the relative maximum and minimum of f(x) = cos2(x) + sin ...

Chapter 15

Table 15.1 List of the basic commands for the operation of vectors.

List of Illustrations

Chapter 4

Figure 4.1 Plot of coth

x

.

Figure 4.2 Plot of sinh

x

and cosh

x

.

Figure 4.3 Plot of (

P

0

(

x

) = 1).

Figure 4.4 Plot of (

P

1

(

x

) = 

x

).

Figure 4.5 Plot of .

Figure 4.6 Plot of

P

0

(

x

),

P

1

(

x

), and

P

2

(

x

).

Figure 4.7a Plot of

J

0

(

x

) and

Y

0

(

x

).

Figure 4.7b Plot of

J

0

(

x

),

Y

0

(

x

), and

Y

1

(

x

)

Figure 4.8 Plot of spherical Bessel functions

j

0

(

x

).

Figure 4.9 Plot of spherical Bessel functions

η

0

(

x

).

Figure 4.10 Plot of spherical Bessel functions

j

0

(

x

) and

η

0

(

x

).

Figure 4.11 Plot of spherical Bessel functions

j

0

(

x

) and

η

0

(

x

) together...

Figure 4.12 Plot of , (

x

, − 30, 30) with default option....

Figure 4.13 Plot of , (

x

, − 30, 30) with the option PlotR...

Figure 4.14 Plot of

x

4

sinhx in the range (0, 10).

Figure 4.15 Plot of

x

4

 sinh 

x

with the option PlotRange→All...

Figure 4.16 Plot of 

x

3

 in the range (−2, 2).

Figure 4.17 Plot of 

x

3

 in the range (−2, 2)...

Figure 4.18 Plot of .

Figure 4.19 Plot of , with the option AspectRatio 

 3.

Figure 4.20 Plot of Gaussian pulse for

σ

 = 1 with the Pl...

Figure 4.21 Plot of the modified Bessel function

I

0

(

x

) with PlotStyle → Dash...

Figure 4.22 Plot of the modified Bessel function

I

0

(

x

)...

Figure 4.23 Plot of the Bessel functions and with three different thickne...

Figure 4.24 Plot of Bessel function

Y

n

(

x

) for

n

 = 0, 1, and 3 with different...

Figure 4.25 Plot of sin

x

with PlotStyle 

 GrayLevel[1]. Gr...

Figure 4.26 Plot of Airy function Ai(

x

)(red) and Bi(

x

)(green). Since the fig...

Figure 4.27 Plot of Hermite polynomial H

2

(

x

)(−2 + 4

x

2

)...

Figure 4.28 Plot of Hermite polynomial H

2

(

x

) with the option...

Figure 4.29 Plot of Gaussian function

G

σ

(

x

) with the option Frame→True...

Figure 4.30 Plot of in the range (−π, π), with grid lines....

Figure 4.31 Plot of

f

(

x

) defined above with the option Axes → True...

Figure 4.32 Plot of

f

(

x

) defined above with the option Axes → False...

Figure 4.33 Plot of

R

(

x

) defined above using the command Show, which shows t...

Figure 4.34 Plot of sin

, for

n

 = 1, 2, 3.

Figure 4.35 Plot of Laguerre polynomials

L

n

(

x

) for

n

ranging from 0 to 4 usi...

Figure 4.36 Plot of the spherical Bessel functions (

j

l

(

x

)) for

l

ranging fro...

Figure 4.37 Individual plots of the Poisson distribution for

r

 = 10, 30, and...

Figure 4.38 Plot of the Poisson distribution.

Figure 4.39 Plot of the Gaussian distribution.

Figure 4.40 Plot

x

2

x

3

, and 

x

4

Figure 4.41 Plot of

j

i

(

x

), for

i

 = 0, 1, and 2 using the optio...

Figure 4.42 Plot of the Gaussian , using Animate command with parameters

a

...

Figure 4.43 Plot of the Gaussian, , using the command Manipulate.

Figure 4.44 Ellipse with

a

 = 6 and

b

 = 3.

Chapter 5

Figure 5.1 Parametric plot of sin

t

and cos

t

.

Figure 5.2 Parametric plot of sin

t

and cos

t

with aspect ratio 0.5.

Figure 5.3 Parametric plot of Epicycloid and Hypocycloid.

Figure 5.4 Parametric plot of astroid, cycloid, parabola, and ellipse.

Figure 5.5 Parametric plot of astroid, cycloid, parabola, and ellipse all di...

Figure 5.6 Parametric plot of astroid, cycloid, parabola, and ellipse all di...

Figure 5.7 Parametric plot of deltoid, hypotrochoid, and the curves

s

and

r

....

Figure 5.8 Polar plots of the circles through the origin centered on the

x

a...

Figure 5.9 Polar plots of ellipse and hyperbola.

Figure 5.10 Polar plot of cardioid.

Figure 5.11 Polar plots of . The plots show the intersection of the curves....

Figure 5.12 Polar plot, which gives the orbit of Pluto around the sun.

Figure 5.13 Polar plot of the associated Legendre functions (cos...

Figure 5.14 Polar plot of the associated Legendre functions (cos

θ

) an...

Figure 5.15 Polar plot of the associated Legendre functions (cos

θ

) an...

Figure 5.16 Contour plot of

x

2

 + 

y

2

 = 9 for –3...

Figure 5.17 Contour plot of x2 + (y − 3)2 = 9...

Figure 5.18 Polar plot of 6 Sin

θ

, which is same as implicit plot....

Figure 5.19 Contour plot of

x

2

 + 

y

2

 for

x

 and

y

in the range...

Figure 5.20 Contour plot of

x

2

 + 

y

2

with false shading.

Figure 5.21 Contour plot of

x

2

 + 

y

2

 for false shading for

h

...

Figure 5.22 Level curves of f(x, y) = 16x2 + 9y2 + 32x − 36y − 92...

Figure 5.23 Density plot of the function f(x) = x + y, (x, − 2, 2),...

Figure 5.24 Plot of error function erf(

z

) with point size 0.02.

Figure 5.25 Plot of complementary error function erf

c

(

z

).

Figure 5.26 Plot of erf(

z

) and erf

c

(

z

).

Figure 5.27 Log plot of exp(

x

) + 4 exp(2

x

) in th...

Figure 5.28 Error list plot for the cross sections of Fermium, Mendelevium, ...

Figure 5.29 Quadratic fit for the fusion probability (Pcn).

Figure 5.30 Least square fit for the data points and the fitted curve on a c...

Figure 5.31 Plot of parabola, ellipse, and hyperbola.

Figure 5.32 Plot of −1−3

i

in Cartesian form. In the ListLinePlot, {0,0} is t...

Figure 5.33 Plot of 3 + 4

i

in Cartesian form.

Figure 5.34 Plot of −1 − 3

i

and 3 + 4i...

Figure 5.35 Plot of the sum of

x

1 and

x

2.

Figure 5.36 Polar representation of 1 + 3

i

.

Chapter 6

Figure 6.1 3D plot of (

x

 + 

y

) for −2 ≤ x ≤ 2...

Figure 6.2 3D plot of exp(−(

x

2

 + 

y

2

)) for −2 ≤ x ≤ 2...

Figure 6.3 Contour plot of exp(−(

x

2

 + 

y

2

)).

Figure 6.4 Density plot of exp(−(

x

2

 + 

y

2

)).

Figure 6.5 3D, Contour and Density plot of exp(−(x2 + y2))...

Figure 6.6 Parametric plot of the space curve of 2 sin θ, 2 sin 2θ...

Figure 6.7 Plot of the surface of the sphere of radius 3 in the spherical po...

Figure 6.8 3D plot of the spherical harmonics

Y

1, − 1

,

Y

10

Figure 6.9 3D plot of the surface of the cylinder, with height

ρ

2

.

Figure 6.10 Contour 3D plot of f = 4x2 + 4y2 + 4z2 − 16...

Figure 6.11 Contour 3D plot of f = 4x2 + 4y2 + 4z2 − 16...

Figure 6.12 Level surface of the contours of z − x4 − y4...

Figure 6.13 Level surface of the contours 0 and 6 of z − x4 − y4...

Figure 6.14 Level surface of the cone x2 + y2 − z2...

Figure 6.15 Level surface corresponding to −.3 and .3 of the cone x2 + y2 − ...

Figure 6.16 Three-dimensional polygonal mesh from the vertices {sinθ cos φ, ...

Figure 6.17 Three-dimensional polygonal mesh from the vertices {ρ cos φ, sin...

Figure 6.18 Surface of revolution by rotating the curve defined parametrical...

Figure 6.19 Surface of revolution by rotating the curve 2 + cos z...

Figure 6.20 Contour 3D plot of the ellipsoid .

Figure 6.21 Contour 3D plot of the hyperboloid of one sheet .

Figure 6.22 Contour 3D plot of the hyperboloid of two sheets .

Figure 6.23 Contour 3D plot of (i) ellipsoid (ii) hyperboloid of one sheet (...

Figure 6.24 Contour 3D plot of the elliptic cone .

Figure 6.25 Contour 3D plot of the elliptic paraboloid

Figure 6.26 Contour 3D plot of the hyperbolic paraboloid

Figure 6.27 Contour 3D plot of (i) elliptic cone (ii) elliptic paraboloid (i...

Figure 6.28 Contour 3D plot of (i) ellipsoid (ii) elliptic paraboloid (iii) ...

Chapter 8

Figure 8.1 Plot of 7x6 − 5x5 + 4x = 5...

Figure 8.2 yields two solutions.

Figure 8.3 Roots of .

Figure 8.4 Roots of with unit circle.

Figure 8.5 Roots of All are on a circle of radius and are equally spaced...

Figure 8.6 Plot of the roots of .

Figure 8.7 Plot of sin

x

 − (

x

/10) in the range (−10,10).

Figure 8.8 Plot of sin

x

,

x

/10 in the range (−10,10).

Figure 8.9 Plot of

e

x

 − 

x

4

in the range (−3,3).

Figure 8.10 Plot of

e

x

and

x

4

 in the range (−3,3).

Figure 8.11 Plot of (tan

x

 − 

x

 − 1) in th...

Figure 8.12 Plot of tan 

x

and

x

 + 1 in the range...

Figure 8.13 Contour plot of 6xy − 6x = 0 and 3x2 + 3y2 − 6y = 0....

Figure 8.14 Contour plot of 3x2 − 3y = 0 and 3y2 − 3x = 0....

Chapter 10

Figure 10.1 Plot of

f

(

x

) and

f

(−1) where f(x) = x2 + 2x − 8...

Figure 10.2 Plot of f′(x) − m, (where f(x) = x3 − 5 x2 − 3x)...

Figure 10.3 Plot of

Figure 10.4 Plot of the polynomials of degrees 5, 9, and 15 and of the coshx...

Figure 10.5 Plot of the sequence

c

[

n

] using the command DiscretePlot. It is ...

Figure 10.6 Plot of the sequence

c

[

n

] using command ListPlot.

Figure 10.7 Plot of the sequence

d

[

n

]. It is clear that sequence is convergi...

Figure 10.8 Plot of the sequence x[m]. It is clear that sequence is convergi...

Figure 10.9 Plot of

c

[

n

], the geometric series converges to 1 an n → ∞...

Figure 10.10 Plot of

f

[

n

], convergence is clearly seen.

Figure 10.11 Plot of

g

[

n

], divergence is clearly seen.

Figure 10.12 Plot of

p

[

n

], appears to be convergent but it is a slowly diver...

Figure 10.13 Plot of f(x) = x3 − 3 x + 3...

Figure 10.14 Plot of

f

′(

x

), where f(x) = 2 x3 − 6 x2 + 6 x + 5...

Figure 10.15 Plot of g(x) = 3 x4 + 4 x3 − 12 x2 + 12...

Figure 10.16 Plot of f(x) = 2 x3 − 15 x2 + 36 x + 1...

Figure 10.17 Plot of f(x) = sin x + cos x, x ε [0, π]...

Figure 10.18 Plot of x + sin 2x, x ε [0, 2π]...

Figure 10.19 Plot of cos2(x) + sin x, x ε [0, π]...

Figure 10.20 3D plot of g(x, y) = 2 + 2x + 2y − x2 − y2...

Figure 10.21 3D plot h(x, y) = y2 + 4 x y + 3 x2 + x3...

Figure 10.22 3D plot h(x, y) = y2 + 4 x y + 3 x2 + x3....

Figure 10.23 3D plot of f(x, y) = x3 + y3 − 3x − 12y + 20...

Figure 10.24 Contour plot of f(x, y) = x3 + y3 − 3x − 12y + 20...

Figure 10.25 Plot of the

y

(

x

) = 

e

x

 

x

.

Figure 10.26 Plot of the undamped simple harmonic oscillator.

Figure 10.27 Plot of discharge of a condenser through the circuit for the ca...

Figure 10.28 Plot for the case of discharge is damped oscillatory.

Figure 10.29 Plot of the solution of the Legendre's differential equation wi...

Figure 10.30 Plot of the solution ,

x

(0) = 1, x′(0) = 1...

Figure 10.31 Plot of the solution for (i) C[1] = 1, C[2] = 2, and C[3] = 3...

Figure 10.32 Plot of the solution

x

(

t

) and

y

(

t

) for C[1] = 1, C[2] = 2...

Figure 10.33 Plot of the solution for C[1] = 0, C[2] = 2...

Chapter 11

Figure 11.1 Plot of

Γ

(

z

) vs

z

for real values of

z

.

Figure 11.2 Plot of erf(

z

) and erf

c

(

z

) in the range 0–3.

Figure 11.3 Plot of Fresnel integrals

C

(

z

) and

S

(

z

).

Figure 11.4 Polar plot of

Y

l

,

m

(

θ

,

φ

) for

l

 = 0, m =...

Figure 11.5 3D Plot of

Y

l

,

m

(

θ

,

φ

) for

l

 = 2 and m = ...

Figure 11.6 Plot of f(x) = x3 − x2 − 2x, − 1 ≤ x ≤ 2...

Figure 11.7 Plot of

y

 = 

x

2

and the line

y

 = 

x

.

Figure 11.8 Plot of

x

3

and .

Figure 11.9 Polar plot of 2 cos

θ

and 4 cos

θ

.

Figure 11.10 Plot of

x

and 

x

2

.

Figure 11.11 Surface of revolution of .

Figure 11.12 RevolutionAxis → {1, 0, 0}, rotates the curve...

Figure 11.13 Surface of revolution of exp(

x

) by rotating the curve z = exp(x...

Figure 11.14 Surface of revolution of exp(

x

) by rotating the curve z = exp(x...

Figure 11.15 Surface of revolution of by rotating the curve 3 , 1 ≤ x ≤ 3...

Figure 11.16 Plot of and its surface of revolution about

x

-axis.

Chapter 12

Figure 12.1 Plot of

G

σ

(

x

) for

σ

in the range 1–3.

Figure 12.2 Plot of

G

σ

(

x

) for

σ

 = 0.4.

Figure 12.3 Plot of for

b

 = 0 and

g

ranging from 10 to 30.

Chapter 13

Figure 13.1 The Fourier transform of A exp(−β|t| ); β > 0...

Figure 13.2 Plot of Gaussian function

f

(

τ

) for

σ

 = 1 and the equiv...

Figure 13.3 Plot of the frequency spectrum

f

(

ν

) and the rectangular fre...

Figure 13.4 Plot of Signum function.

Figure 13.5 Plot of Unit step function.

Figure 13.6 The plot of

f

(

t

) = 

t

and g(τ − t)...

Figure 13.7 Plot of g(y) = exp(−y), h(y − x) = exp(−(y − x))...

Figure 13.8 Plot of

g

(

y

) = exp(−

y

) and f(x − y) = exp( −...

Figure 13.9 Plot of

f

(

τ

) and

h

(

τ

).

Figure 13.10 Plots of

f

(

τ

) and

h

(

t

 − 

τ

) for

t

 = ...

Figure 13.11 Plot of

f

(

τ

) and

h

(

t

 − 

τ

) for −2 ≤ ...

Figure 13.12 Plot of

f

(

τ

) and

h

(

t

 − 

τ

) for 0 ≤ t...

Figure 13.13 Plot of

f

(

τ

) and

h

(

t

 − 

τ

)for 2 ≤ t ...

Figure 13.14 Plot of

f

(

τ

) and

h

(

t

 − 

τ

) for

t

 = 5...

Chapter 14

Figure 14.1 Plot of 2U(t) − 3U(t − 2) + U(t − 3)...

Figure 14.2 Plot of

G

(

t

) and

F

(

t

).

Figure 14.3 Plot of

F

(

t

) and

G

(

t

) for

T

 = 1.

Figure 14.4 Plot of

F

(

τ

) and

G

(

t

 − 

τ

)for 0 ≤ t ≤...

Figure 14.5 Plot of

F

(

τ

) and

G

(

t

 − 

τ

) for 0 ≤ t ...

Figure 14.6 Plot of

F

(

τ

) and

G

(

t

 − 

τ

) for 0 ≤ t ...

Figure 14.7 Plot of

F

(

τ

) and

G

(

t

 − 

τ

) for T ≤ t ...

Figure 14.8 Plot of

F

(

τ

) and

G

(

t

 − 

τ

) for T ≤ t ...

Figure 14.9 Plot of

F

(

τ

) and

G

(

t

 − 

τ

) for 2T ≤ t...

Figure 14.10 Plot of

F

(

τ

) and

G

(

t

 − 

τ

) for 2T ≤ ...

Figure 14.11 Plot of

F

(

τ

) and

G

(

t

 − 

τ

) for t > 3...

Chapter 15

Figure 15.1 Constant

r

surface for

r

 = 2.

Figure 15.2 Constant 

θ

surface for .

Figure 15.3 Constant 

φ

surface for .

Figure 15.4 Constant

r

,

θ

, and

φ

 surface for

r

 = 2, , and ....

Figure 15.5 Constant 

z

surface.

Figure 15.6 Constant 

ρ

surface.

Figure 15.7 Constant 

φ

surface.

Figure 15.8 Constant 

ρ

,

φ

, and 

z

surfaces for

ρ

 = 1,, ...

Figure 15.9 Plot of the vector field .

Figure 15.10 Plot of the gradient of

φ

.

Figure 15.11 Plot of the gradient of h(x, y) = (4xy − 6x2 − 8y2 − 18x + 28y ...

Figure 15.12 Plot of the vector field of the differential equation in the ...

Chapter 17

Figure 17.1 Wave function

ψ

n

(

x

) for

n

 = 1, 2, and 3 confi...

Figure 17.2 Wave function

ψ

n

for

n

 = 1, 2, and 3 with PlotStyle → RGBCo...

Figure 17.3 Plot of the probability densities |

ψ

n

|

2

for

n

 = 1, 2, and 3...

Figure 17.4 3D plot of

ψ

(

x

,

y

) for nx = 1, ny = 1...

Figure 17.5 3D plot of |

ψ

(

x

,

y

)|

2

for nx = 1, ny = 1...

Figure 17.6 3D plot of

ψ

(

x

,

y

) for

n

x

,

n

y

going from 1 to 4.

Figure 17.7 3D plot of

ψ

(

x

,

y

) and |

ψ

(

x

,

y

)|

2

for nx = 1, ny = 1...

Figure 17.8 3D plot of |

ψ

(

x

,

y

)|

2

for

n

x

,

n

y

going from 1 to 4.

Figure 17.9 Plot of the radial wave functions for

n

 = 1, 2, an...

Figure 17.10 Plot of radial probability density for

n

 = 1, 2, ...

Figure 17.11 Plot of radial probability density for

n

 = 1, 2, ...

Figure 17.12 Plot of the one-dimensional harmonic oscillator wave functions ...

Figure 17.13 Plot of the probability density for one dimension harmonic osci...

Figure 17.14 Plot of |

ψ

n

(

x

)|

2

in arbitrary units for

n

 = 10.

Figure 17.15 Plot of |

ψ

n

(

x

)|

2

in arbitrary units for n = 20...

Figure 17.16 Plot of |

ψ

n

(

x

)|

2

in arbitrary units for

n

 = 30.

Figure 17.17 Plot of the three-dimensional harmonic oscillator for

n

 = 0,1, ...

Guide

Cover

Table of Contents

Title Page

Copyright

Preface

Foreword

About the Authors

Begin Reading

References

Index

End User License Agreement

Pages

iii

iv

xiii

xiv

xv

xvi

xvii

xix

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

385

386

387

388

389

390

391

392

Mathematica for Physicists and Engineers

 

K.B. Vijaya Kumar and Antony P. Monteiro

 

 

 

 

 

 

 

 

 

Authors

Prof. K.B. Vijaya KumarN.M.A.M. Institute of Technology, NitteKarkala TalukKarnatakaUdupi574110 India

Dr. Antony P. MonteiroSt. Philomena College, PutturDakshina KannadaKarnataka574202 India

Cover Image: © Pobytov/Getty Images

All books published by WILEY-VCH are carefully produced. Nevertheless, authors, editors, and publisher do not warrant the information contained in these books, including this book, to be free of errors. Readers are advised to keep in mind that statements, data, illustrations, procedural details or other items may inadvertently be inaccurate.

Library of Congress Card No.: applied for

British Library Cataloguing-in-Publication DataA catalogue record for this book is available from the British Library.

Bibliographic information published by the Deutsche NationalbibliothekThe Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie; detailed bibliographic data are available on the Internet at <http://dnb.d-nb.de>.

© 2023 WILEY-VCH GmbH, Boschstraße 12, 69469 Weinheim, Germany

All rights reserved (including those of translation into other languages). No part of this book may be reproduced in any form – by photoprinting, microfilm, or any other means – nor transmitted or translated into a machine language without written permission from the publishers. Registered names, trademarks, etc. used in this book, even when not specifically marked as such, are not to be considered unprotected by law.

Print ISBN: 978-3-527-41424-6ePDF ISBN: 978-3-527-84323-7ePub ISBN: 978-3-527-84322-0

Preface

It was a giant leap for academia when Stephen Wolfram, a theoretical physicist, thought of creating software that links computational science with mathematics. From time immemorial, philosophers have tried to explicate the relationship between mathematics and physics. From them, we have understood well that if mathematics is an essential tool for physics, then physics is a rich source of inspiration and insight for mathematics. Throughout our career in research and teaching, we have realized this truth. Mathematica is the most befitting proof of this fact. Today, it has over three million users around the globe, and hundreds of books have already been written on it. There are also several periodicals that are devoted exclusively to Mathematica. The Wolfram Research Foundation, which owns the Mathematica website,1 contains thousands of pages of material and is being constantly updated. Mathematica can be used by everyone, from a high school student to a researcher in mathematics. Mathematica is a symbolic mathematical computation program, sometimes called a computer algebra program, used extensively by scientists and engineers in academic and research institutes. The visualizations and graphical capabilities of Mathematica make it very useful for plotting all kinds of data and functions. Mathematica has a very good system for documentation with all its built-in functions. Mathematica is good at handling numerical work, and it is a perfect programming system where symbolic manipulation is easy.

When we started writing this book, what we had in our minds was to equip the students at master's level and researchers from a science and engineering backgrounds with the necessary mathematical techniques. We have remained faithful to our original intention. While doing so we have taken note of the needs of the beginners too. The book has been developed from our lecture notes and research work, which has been continuously modified and improved over the years while interacting with the students and having discussions with researchers. It bridges the gap between the elementary books written on Mathematica and the reference books written for advanced users. The book makes an attempt to present a wide variety of topics in mathematics with an emphasis on application in divergent areas. Throughout the book, the examples follow the introduction of the new commands. More than 400 problems have been worked out in the book, which helps the student understand the crux of the topic under consideration. A large number of problems on matrices, the Laplace and Fourier transformations, the Dirac Delta function, and quantum mechanics worked out here are tested and appreciated by students in the classroom. Most of these are exercises in standard textbooks on physics, mathematics, and engineering that demonstrate standard theorems and are absolutely essential for understanding the subjects. These have been illustrated with suitable figures too. The book has a variety of illustrated examples chosen meticulously from different fields. It gives an introduction to matrices, a detailed account of special matrices, linear equations, the eigenvalue problem, and bilinear and quadratic forms. The approach of this book is pedagogical where both teaching and learning dimensions have been taken care of. The best way to use the book is to replicate the examples worked out in the book, try to make modifications, and investigate the results. We would like to mention here that a user of any version of Mathematica would be comfortable utilizing this work.

The book is spread out into 17 chapters. Chapter 1 gives a general account and information about Mathematica, and Chapter 2 gives several commands to perform algebraic and trigonometric manipulations. Chapter 3 gives a good account of constructing and extracting the elements of the table. Chapters 4–6 are devoted to graphics. Chapter 7 gives the method to construct matrices and works out examples to illustrate the elementary properties of the matrices. Chapter 8 is devoted to solving algebraic and transcendental equations. Chapter 9 introduces the eigenvalue and vectors of a matrix and elaborates the matrix diagonalization. Chapter 10 gives the applications of Mathematica in differential calculus, whereas Chapter 11 deals with integral calculus. Chapter 12 is on the Dirac delta function where the properties and the limiting forms of the delta function have been plotted and discussed. Chapter 13 discusses the various properties of the Fourier transforms and their applications. Chapter 14 deals with Laplace transforms and the techniques to solve the differential equations using the Laplace transforms. Chapters 15 and 16 deal with vectors and linear vector spaces, respectively, which are vital for a proper understanding of quantum mechanics. Chapter 17 gives a brief account of the applications of Mathematica in quantum mechanics.

It is our bounden duty to remember here many to whom we are indebted for this work. We are thankful to Prof. Fionn Murtagh (professor of data science and director at the Centre for Mathematics and Data Science, University of Huddersfield), Prof. K. S. Mallesh (professor of physics, Regional Institute of Education, Mysore), and Prof. M. V. Satyanarayana (professor of physics, IIT Chennai) for going through the entire manuscript and giving useful suggestions that increased the readability of the book. We thank Prof. B. A. Kagali (retired professor, Bangalore University), Prof. J. S. Bhat (director, IIIT Surat), Prof. P. Paulose (professor of physics, IIT Guwahati), Prof. Kamal Kanti Nandi (director, Zeldovich International Centre for Astrophysics, Moscow), Prof. Shashank Bhatnagar (Department of Physics, University Institute of Science, Chandigarh University), Prof. Jayanta Kumar Sarma (professor of physics, Tezpur University, Assam), Dr. J. N. Pandya (assistant professor of applied physics, Maharaja Sayajirao University of Baroda), Prof. Anindya Sarkar (Department of Geology and Geophysics, Indian Institute of Technology, Kharagpur), Prof. Jithesh R. Bhatt, Prof. Janardhan Padmanabhan, Prof. A. S. Joshipura (Physical Research Laboratory, Ahmedabad) for their support to this work. We also thank all the authors and their publishers for allowing us to use many diagrams from their published books. We remember particularly here Prof. Ajoy Ghatak (retired professor, IIT, Delhi) for encouraging us.

KBV expresses his gratitude to Dr. Stephane Pepin (Federal Agency for Nuclear Control, Health and Environment Department, Brussels, Belgium) for the help he rendered in his research. KBV acknowledges Prof. Michael Birse and Dr. Judith McGovern (Department of Physics and Astronomy, University of Manchester) for introducing Mathematica to solve certain problems in high-energy physics, when he was a Commonwealth fellow at the University of Manchester from 1998 to 1999. KBV wishes to express his deep gratitude to Shri Vinaya Hegde, President, Nitte Education Trust & Chancellor, Nitte (Deemed to be University), the president of the Nitte Education Trust, Shri Vishal Hegde, Pro-Chancellor, Nitte, deemed-to-be university, and Dr. Satheesh Bhandary, Vice-Chancellor, Nitte, deemed-to-be university, for having provided an opportunity to work in NMAMIT, Nitte. KBV is grateful to Prof. Niranjan N. Chiplunkar (principal, NMAMIT, Nitte, Karkala) for his interest in the Mathematica book and for his constant encouragement, which accelerated the progress of the book. KBV is thankful to Mr. A. Yogeesh Hegde, Director (CM&D), Nitte Campus, Nitte, deemed-to-be university, for providing logistical support, the management and faculty members of NMAMIT for providing an excellent environment for completing the book, and to Mangalore University for providing a conducive environment for writing the manuscript. Most of the book was written while KBV was working at Mangalore University. KBV is grateful to his family members for their constant moral support, and he is particularly thankful to his wife, Dr. Veena Devi V. Shastrimath, and his son, Mr. K. V. Adithya for their constant encouragement and support in preparing the manuscript. KBV expresses his gratitude to all his PhD students for their collaboration in research.

APM is deeply indebted to the Most Rev. P. P. Saldanha (bishop, Diocese of Mangalore), Rev. Ronald Dsouza (manager, Codialbail Press), Rev. Lawrence Mascarenhas (correspondent, St. Philomena College, Puttur), Leo Noronha (former principal, St. Philomena College), Dr. A. P. Radhakrishna (Head, Department of Physics, St. Philomena College, Puttur), Dr. Praveen P. D Souza (assistant professor of physics, St. Philomena College, Puttur), Mr. Vinay D. R., and Mr. Sujith S. for their inspiration, support, and insights in preparing the manuscript. We are thankful to Mr. Vipin Naik N. S. (assistant professor of physics, St. Philomena College, Puttur) for going through the manuscript critically.

We are also greatly thankful to Vision Group on Science and Technology (VGST), Department of IT, BT, and S&T, Government of Karnataka for funding our research projects and through which we availed Mathematica software.

We gratefully acknowledge Wiley-VCH GmbH for accepting to publish our book. We would like to express our gratitude to Dr. Martin Preuss, Associate Publisher, for his support and encouragement throughout the process. We are thankful to Ms. Farhath Fathima, content refinement specialist, Wiley-VCH, for doing the significant job of proofreading very efficiently.

It is our hope that this book exposes the power of Mathematica by exploring the wonders of physics and mathematics. One cannot deny the fact that in such a voluminous book, errors would occur unintentionally. In such cases, we will be grateful to the readers if they communicate to us. We are eagerly waiting for constructive feedback which would enhance the standard of the book.

18 February 2023

K.B. Vijaya Kumar

Antony P. Monteiro

Note

1

   

https://www.wolfram.com/

Foreword

Mathematicafor Physicists and Engineers provides the basic concepts of Mathematica for scientists and engineers. Mathematica is a symbolic, numerical and graphic package. The book demonstrates mathematical concepts that can be employed to solve problems in physics and engineering. The authors address problems in basic arithmetic to more advanced topics such as quantum mechanics. It sees mathematics and physics through the eye of computer programming. It envisions fulfilling the needs of students at master's level and researchers from a physics and engineering background and bridges the gap between the elementary books written on Mathematica and the reference books written for advanced users. The authors have given importance to minute aspects of Mathematica programming and have solved more than 400 problems from different branches of physics and engineering. The approach of this book is pedagogical where both teaching and learning dimensions have been taken care of by solving the problems. After going through the book, the reader will be well versed in the use of Mathematica to tackle problems in their respective fields. It is our sincere wish that readers, after going through the book, will be convinced of the utility and power of Mathematica.

About the Authors

K. B. Vijaya Kumar is a professor of physics at the Department of Physics, the N.M.A.M. Institute of Technology, Nitte. He was a visiting professor at the Manipal Center of Natural Sciences, MAHE, Manipal, Karnataka. He was a professor of physics at Mangalore University, Mangalore, until 31 October 2019, and retired after 26 years of service. He obtained his MSc from Bangalore University and his PhD from the Physical Research Laboratory (PRL), Ahmedabad, in 1991 and also did postdoctoral research from 1991 to 1993 at PRL. He has published more than 60 research papers in the field of nuclear/particle physics. His current research is on theoretical nuclear/particle physics. Prof. K. B. Vijaya Kumar is the recipient of the Commonwealth Academic Staff Fellowship (1998–1999) TWAS UNESCO fellowship at ITP, Beijing (2003–2006), and was a visiting scientist at the Institute für Kern Physik, Juelich, Germany (2005), and at the Institute for Theoretical Physics, University of Tuebingen, Germany (2006–2009).

Dr. Antony Prakash Monteiro is currently working at the Department of Physics, St Philomena College, Puttur, India. He has 13 years of teaching experience at undergraduate and postgraduate levels and has authored several books in various fields. He obtained his MSc in physics and PhD in particle physics (phenomenology) from Mangalore University. He has published 18 research publications in national and international journals and has presented more than 70 research papers at various national and international conferences. He is the recipient of the VGST Award for Research Publications 2017–2018 from the Vision Group on Science and Technology, Govt of Karnataka, India, for his high-impact research publications. At present, his research interest is aimed at computational physics, and theoretical nuclear and particle physics.

1Preliminary Notions

1.1 Introduction

Mathematica1 is the brainchild of Stephen Wolfram, born in London in 1959 and educated at Eton, Oxford, and Caltech. He has a PhD in Theoretical Physics from Caltech. He was the youngest recipient of the MacArthur Prize Fellowship. His early works were on particle physics and cosmology. His significant contribution is in the field of cellular automata. He was a professor of physics, mathematics, and computer science at the University of Illinois, where he launched Wolfram Research Inc. and started developing Mathematica. He has been the president and CEO of Wolfram Research since its inception. Wolfram Research is one of the world's renowned computer, web, and cloud software companies – as well as a powerhouse of scientific and technical innovation. As a pioneer in computation and computational knowledge, the Wolfram Foundation has pursued a long-term vision to develop the science, technology, and tools to make computation an ever-more-potent force in today's world.

Mathematica is a very powerful tool for performing high-level mathematical computing. The way to acquaint yourself with Mathematica is to play with various operators until their proper usage is understood. Mathematica does both symbolic and numerical computing, which is the basis of its real power. It has over three million users around the globe and hundreds of books have already been written on it. There are also several periodicals which are devoted exclusively to Mathematica. The Wolfram Research Foundation's Mathematica website contains thousands of pages of material, which is constantly updated. The Wolfram Language is the programming language used in Mathematica.

1.2 Versions of Mathematica

The first version of Mathematica was realized on 23 June 1988. Since then, several versions of Mathematica have been developed. The version 12.2 was released in December 2020 and expands Mathematica's functionality in biomolecular sequence operations, partial differential equations (PDE) modeling, spatial statistics, and remote batch job evaluation with new notebook interface features and more, by adding 228 new functions. The newer versions2 of Mathematica fully support the earlier versions. Information on this can be obtained from the website www.wolfram.com.

1.3 Getting Started

Mathematica can be run both on WINDOWS or UNIX platforms. It virtually supports almost every computer platform. When you double click on the Mathematica icon after installation on your computer, you will briefly see the Mathematica logo and then a Mathematica desktop window will appear. Mathematica starts with a blank notebook. Type the required operation and then press Shift + Enter (hold down the Shift key and press Enter) to tell the Wolfram Language to evaluate your input. One can also execute the operation by clicking Evaluate Notebook in the Evaluation menu. After performing the required operations, save and exit which are shown in the File menu.

1.4 Simple Calculations

1.4.1 Arithmetic Operations

Once you have opened a blank notebook, you can do some simple calculations as you would do on a pocket calculator. It is important to note that, if your input is an integer, the output of Mathematica is also an integer. On the other hand, if the input has an explicit decimal point, then the output will always have a decimal point. Let us look at a few examples.

Example 1.1

Find the sum of 355 and 422.

In the blank notebook type:

In[1] :=355 + 422

Out[1] = 777

The output of Mathematica is the solution.

The following standard symbols are used in Mathematica to do arithmetic operations (Table 1.1).

It is possible in Mathematica to insert comments in the notebook. We are introducing this feature at an early stage as we will be generating all the Mathematica outputs with comments in the notebook itself. You can add text at any point in your code simply by enclosing it in parenthesis (*text*).

Table 1.1 Standard symbols are used in Mathematica to do arithmetic operations.

Standard symbol

Operation

+

Addition

-

Subtraction

*

or Space

Multiplication

/

Division

^

Exponentiation

Example 1.2

In[2] := 14.5/12.4 (* Division *)

Out[2] = 1.16935

Note that whatever is inserted with the (*text*) is for our reference only and it will not be executed.

1.4.2 Approximate Numerical Results

It is possible to obtain the numerical result by ending your input with //N, where N stands for numerical. The expression //N gives an approximate numerical value of the output. We illustrate this with an example.

Example 1.3

Find the numerical value of

Solution

In[3] :=1/3 + 2/7 + 9/12//N

Out[3] = 1.36905

1.4.3 Algebraic Calculations

It is possible to do both symbolic (symbolic means that computation is done in terms of symbols or variables rather than numbers) and numerical calculations. Here is an example. We will discuss these more as we proceed.

Example 1.4

Simplify 9x6 − 18x5 + 12x5 − 5x4 + 2x4 − 2x + x + 9 − 2.

Solution

In[4] := 9 x^6- 18 x^5+ 12 x^5- 5 x^4+2 x^4-2 x + x + 9-2

Mathematica simplifies and returns the expression.

Out[4] = 7 - x - 3 x^4 - 6 x^5 + 9 x^6

1.4.4 Defining Variables

One can use the equal sign to assign values to a variable.

Example 1.5

Given z = 12.34, find z2 + 34.32

Solution

In[5] := z=12.34

Out[5] = 12.34

In[6] := z^2+34.32

Out[6] = 186.596

Unless the output is suppressed explicitly by using a command, Mathematica displays all the executed results. In the above example, 12.34 is the z value. The 186.596 corresponds to the needed output value. It is very important to realize that the values you assign to variables are permanent. Once you have assigned a value to a particular variable, the value will be kept until you explicitly remove it. The value will, of course, disappear if you start a whole new Mathematica session. Forgetting earlier definitions that you made is the most common cause of mistake while using Mathematica. When we have set z = 12.34, Mathematica assumes that we always want z to have the value 12.34, until we explicitly tell it otherwise. To avoid mistakes, you should remove values you have defined as soon as you have finished using them. To clear the value of the variable z, type Clear[z]. Here is an example.

Example 1.6

In[7] :=z = 7.2

Out[7] = 7.2

In[8] :=x = z ^ 2

Out[8] = 51.84

In[9] :=Clear[z]

Clears all the previously assigned values of z.

Now if we define

In[10] :=r = 4z3 − 3z2 + 2

and execute the file, the Mathematica output is

Out[10] = 2 - 3 z2 + 4 z3

Mathematica returns the input and the previously assigned z value has been cleared. If we had not cleared the value of z, Mathematica would have substituted z = 7.2 in evaluating r.

Below is another example:

Example 1.7

In[11] :=k = 2.0;

In[12] :=m = 5.2;

In[13] :=z1 = k ^ 2 − m ^ 2

Out[13] = −23.04

If we do not clear the values of

k

and

m

, subsequent expressions wherever

k

and

m

appear are replaced by 2 and 5.2, respectively.

We can clear the assigned values for k and m by using

In[14] :=Clear[k, m] or k = .; and m = .;

Now, if we type

In[15] :=z2 = k ^ 2 + m ^ 2

Mathematica returns the input as the previously assigned values of k and m have been cleared.

Out[15] = k2 + m2

It is important to note the following while doing symbolic calculations.

x y z

(

x

blank

y

blank

z

) means

x

times

y

times

z

, whereas

xyz

is a new variable.

If an algebraic quantity is multiplied by a number, even without space, it is taken as multiplication. For example, 76

z

is the same as 76

z

.

1.4.5 Using the Previous Results

In Mathematica, it is possible to use already-generated output. Hence, there is no need to retype the output obtained. To use the previous results, you can work with the following list of operations (Table 1.2).

Table 1.2 Ways to refer to previous results.

Command

Meaning

%

The last result generated

% %

The next-to-last result

%% …%

(k times)

The

k

th previous result

% n

The result on output line Out[n]

1.4.6 Suppressing the Output

If you end your input with a semicolon, Mathematica performs the operations you specify but displays no output. expr; does an operation but displays no output. You can use % to get the corresponding output or type explicitly the variable. Below is an example.

Example 1.8

Evaluate e|x − y|, when x = 2 and y = 3.

Solution

In[16] :=x = 2.0;y = 3.0;

In[17] :=z = Exp[Abs[x − y]];

When the file is executed, the outputs x, y, and z will not be displayed because of the semicolon at the end of the input. Now to get the value of say, z, just type z.

In[18]:= z

Out[18]= 2.71828

1.4.7 Sequences of Operations

Sequences of operations can be done by simply separating the pieces of inputs with semicolons. The sequences of operations like expr1; expr2; expr3 do several operations and give the result on the last line. On the other hand, expr1; expr2; expr3; do the operations, but give no output. Below is an example.

Example 1.9

Compute the wavelength of an electron. Given where m is the rest mass of the electron, h is the Planck's constant, and v is the velocity of the electron. Given h = 6.6 × 10−34 J s; v = 106 m/s; m = 9.1 × 10−31 kg

Solution

p = mv is the momentum of the electron.

In[19] := h = 6.6*10^-34;

In[20] := v = 10^6;

In[21] := m = 9.1*10^-31;

In[22] := p = % * %%

Out[22] = 9.1 × 10−25

% %% multiples the two previous inputs m and v. Hence, the momentum is 9.1 × 10−25 m/s. The wavelength λ is given by,

In[23] :=λ = (% %  % %)/%

Out[23] = 7.25275 × 10−10

Hence, the wavelength of the electron is 7.25 275 × 10−10 m. There should not be any gap between % and the number, i.e. %n is a single word. If there is a gap, then Mathematica will multiply the previous result and give the output.

1.5 Built-in Functions

Mathematica has several built-in functions. By clicking on the built-in functions in the help browser, one gets the complete list of the built-in functions. In Mathematica, it is important to note that all built-in functions begin with capital letters and the arguments of the functions are enclosed in square brackets. Below we list a few elementary built-in functions (Table 1.3).

Notice that the arguments of the trigonometric functions are always in radians. To get the value in degrees, it has to be specified in the input. For this, one can use the built -in constant, Degree, whose value is π/180, i.e. 30Degree represents 30°. Here is an example.

Example 1.10

Evaluate Cos[60 Degree].

Solution

You can evaluate it in degrees or radians (Table 1.4).

Example 1.11

Find the value of (i) sin(300°) (ii) cos(−600°) (iii) sec(405°)

Table 1.3 List of a few elementary built-in functions.

Mathematical notation

Built-in Mathematica functions

π

π

 can be directly copied from the Palette

Square root

x

(√

x

)

Sqrt[x]

Natural logarithm (ln 

x

)

Log[x]

Logarithm to base

b

(log

b

 

x

)

Log[b,x]

Trigonometric functions (with arguments in radians)

Sin[x], Csc[x], Cos[x], Sec[x]

Tan[x], Cot[x]

Inverse trigonometric functions

ArcSin[x], ArcCsc[x], ArcCos[x], ArcSec[x]

ArcTan[x], ArcCot[x]

The hyperbolic functions

Sinh[x], Csch[x], Cosh[x], Sech[x]

Tanh[x], Coth[x]

Inverse hyperbolic functions

ArcSinh[x], ArcCsch[x], ArcCosh[x]

ArcSech[x], ArcTanh[x], ArcCoth[x]

Factorial (product of integers 1,2,…,

n

)

n!

Absolute value

Abs[x]

Close integer to

x

Round[x]

Maximum, Minimum of

x

,

y

,…

Max[x,y,…], Min[x,y,…]

Table 1.4 Evaluation in degrees or radians.

From palettes

Evaluation in radians

Evaluation in degrees

Go to the file menu and click on Basic Math Input

                               

Press the radio button π in the palettes menu Or type

Press the radio button ° in the palettes menu.

Cos[60°]

Or type

Cos [60 Degree

]

Solution

(i) In[24] :=Sin[300°]

      Out[24] =

(ii) In[25] :=Cos[−600°]

      Out[25] =

(iii) In[26] :=Sec[405°]

      Out[26] = √2

Example 1.12

Evaluate sinh(120).

We will evaluate it directly and also using the formula for sinh.

Solution

In[27] := Sinh[120]

Out[27] = 6.5209 × 1051

Using the formula, ,

In[28]:= (Exp[120] - Exp[-120])/2.

Out[28] = 6.5209 × 1051

As expected, both forms give the same result.

Example 1.13

Find tan(315°) cot(−405°) + cot(495°) tan(−585°).

Solution

In[29] := Tan[315o] Cot[-405o] + Cot[495o] Tan[-585o]

Out[29] = 2

Table 1.5 Illustrations of built-in functions.

Command

Mathematica input and output

Log and factorial

Stirling's approximation is valid for large values of

n

log

n

! = 

n

log

n

 − 

n

, Evaluate expression when

n

 = 10^5

Log

[

10

5

!]//

N

or Log[Factorial[

10

5

]]//N

10.513 × 10

6

(

10

5

Log

[

10

5

] 

− 10

5

)//

N

10.5129 × 10

6

Inverse hyperbolic functions

Built-in Functions: ArcSinh, ArcCosh, etc. Find the value of sinh

−1

(−√3/2) and sin

−1

(√3/12)

−0.7834 −0.144843

Absolute value

Built-in Function:

Abs

Find absolute value of (

a

 + 

b

) given

a

 = 3 and

b

 = −5

a=3; b=-5;

Abs[a

b]

2

Mod value

Built-in Function:

Mod[n,m]

(remainder on the division of

n

by

m

) Find the reminder when 2^23 is divided by 47

Mod

[

2

 ^ 

23

,

47

]

1

Example 1.14

Find (i) log32256 (ii) ln0.

Solution

(i) In[30] := Log[32, 256]

      Out[30] =

(ii) In[31] := Log[0]

      Out[31] = −∞

Illustrations of built-in functions are given below (Table 1.5).

1.6 Additional Features

1.6.1 Arbitrary-Precision Calculations

When we have a numerical result with a large number of digits, rounding it off to a required number of digits is necessary. Rounding off a number to n significant digits can be achieved by using N[expr,n]. Below is an example.

Example 1.15

Find the value of to 20 decimal places.

Solution

N[expr,20], gives the numerical result up to 20 decimal points.

In[32] :=N[Sqrt[Sinh[134]8! π], 20]

Out[32] = 3.1517407561599210602 × 1031

1.6.2 Value for Symbols

It is possible to replace a symbol such as z with a definite “value.” The value might be a number or any other expression. To replace z with the value 9, you should create the transformation rule z  −> 9. You must type −> between the pair of characters, with no space in between. You can think of z  −> 9 as being a rule in which “z goes to 9.” The transformation rule is to type expr/. rule. The replacement operator “/.” is typed as a pair of characters with no space in between, i.e. expr/.z  −>