FUNDAMENTAL MATH AND PHYSICSFOR SCIENTISTS AND ENGINEERS
FUNDAMENTAL MATHAND PHYSICS FORSCIENTISTS ANDENGINEERS
DAVID YEVICK
HANNAH YEVICK
Copyright copy 2015 by John Wiley amp Sons Inc All rights reserved
Published by John Wiley amp Sons Inc Hoboken New JerseyPublished simultaneously in Canada
No part of this publication may be reproduced stored in a retrieval system or transmitted in any formor by any means electronic mechanical photocopying recording scanning or otherwise exceptas permitted under Section 107 or 108 of the 1976 United States Copyright Act without either theprior written permission of the Publisher or authorization through payment of the appropriate per-copyfee to the Copyright Clearance Center Inc 222 Rosewood Drive Danvers MA 01923 (978) 750-8400fax (978) 750-4470 or on the web at wwwcopyrightcom Requests to the Publisher for permissionshould be addressed to the Permissions Department John Wiley amp Sons Inc 111 River Street HobokenNJ 07030 (201) 748-6011 fax (201) 748-6008 or online at httpwwwwileycomgopermissions
Limit of LiabilityDisclaimer of Warranty While the publisher and author have used their best effortsin preparing this book they make no representations or warranties with respect to the accuracy orcompleteness of the contents of this book and specifically disclaim any implied warranties ofmerchantability or fitness for a particular purpose No warranty may be created or extended by salesrepresentatives or written sales materials The advice and strategies contained herein may not besuitable for your situation You should consult with a professional where appropriate Neither thepublisher nor author shall be liable for any loss of profit or any other commercial damages includingbut not limited to special incidental consequential or other damages
For general information on our other products and services or for technical support please contactour Customer Care Department within the United States at (800) 762-2974 outside the United Statesat (317) 572-3993 or fax (317) 572-4002
Wiley also publishes its books in a variety of electronic formats Some content that appears in printmay not be available in electronic formats For more information about Wiley products visit our web siteat wwwwileycom
Library of Congress Cataloging-in-Publication Data
Yevick David authorFundamental math and physics for scientists and engineers David Yevick Hannah Yevick
1 online resourceldquoPublished simultaneously in CanadardquondashTitle page versoIncludes indexDescription based on print version record and CIP data provided by publisher resource not viewedISBN 978-0-470-40784-4 (pbk) ndash ISBN 978-1-118-98559-5 (Adobe PDF) ndash ISBN 978-0-470-40784-4(pbk)1 Mathematics 2 Physics I Yevick Hannah author II TitleQA393510ndashdc23
2014040697
Cover Image iStockphotocopynadla
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
To George
CONTENTS
1 Introduction 1
2 Problem Solving 321 Analysis 322 Test-Taking Techniques 4
221 Dimensional Analysis 5
3 Scientific Programming 631 Language Fundamentals 6
311 Octave Programming 7
4 Elementary Mathematics 1241 Algebra 12
411 Equation Manipulation 12412 Linear Equation Systems 13413 Factoring 14414 Inequalities 15415 Sum Formulas 16416 Binomial Theorem 17
42 Geometry 17421 Angles 18422 Triangles 18423 Right Triangles 19424 Polygons 20425 Circles 20
vii
43 Exponential Logarithmic Functions and Trigonometry 21431 Exponential Functions 21432 Inverse Functions and Logarithms 21433 Hyperbolic Functions 22434 Complex Numbers and Harmonic Functions 23435 Inverse Harmonic and Hyperbolic Functions 25436 Trigonometric Identities 26
44 Analytic Geometry 28441 Lines and Planes 28442 Conic Sections 29443 Areas Volumes and Solid Angles 31
5 Vectors and Matrices 3251 Matrices and Matrix Products 3252 Equation Systems 3453 Traces and Determinants 3554 Vectors and Inner Products 3855 Cross and Outer Products 4056 Vector Identities 4157 Rotations and Orthogonal Matrices 4258 Groups and Matrix Generators 4359 Eigenvalues and Eigenvectors 45510 Similarity Transformations 48
6 Calculus of a Single Variable 5061 Derivatives 5062 Integrals 5463 Series 60
7 Calculus of Several Variables 6271 Partial Derivatives 6272 Multidimensional Taylor Series and
Extrema 6673 Multiple Integration 6774 Volumes and Surfaces of Revolution 6975 Change of Variables and Jacobians 70
8 Calculus of Vector Functions 7281 Generalized Coordinates 7282 Vector Differential Operators 7783 Vector Differential Identities 8184 Gaussrsquos and Stokesrsquo Laws and
Greenrsquos Identities 8285 Lagrange Multipliers 83
viii CONTENTS
9 Probability Theory and Statistics 8591 Random Variables Probability Density
and Distributions 8592 Mean Variance and Standard Deviation 8693 Variable Transformations 8694 Moments and Moment-Generating Function 8695 Multivariate Probability Distributions
Covariance and Correlation 8796 Gaussian Binomial and Poisson Distributions 8797 Least Squares Regression 9198 Error Propagation 9299 Numerical Models 93
10 Complex Analysis 94101 Functions of a Complex Variable 94102 Derivatives Analyticity and
the CauchyndashRiemann Relations 95103 Conformal Mapping 96104 Cauchyrsquos Theorem and Taylor and Laurent Series 97105 Residue Theorem 101106 Dispersion Relations 105107 Method of Steepest Decent 106
11 Differential Equations 108111 Linearity Superposition and Initial
and Boundary Values 108112 Numerical Solutions 109113 First-Order Differential Equations 112114 Wronskian 114115 Factorization 115116 Method of Undetermined Coefficients 115117 Variation of Parameters 116118 Reduction of Order 118119 Series Solution and Method of Frobenius 1181110 Systems of Equations Eigenvalues
and Eigenvectors 119
12 Transform Theory 122121 Eigenfunctions and Eigenvectors 122122 SturmndashLiouville Theory 123123 Fourier Series 125124 Fourier Transforms 127125 Delta Functions 128126 Greenrsquos Functions 131
ixCONTENTS
127 Laplace Transforms 135128 z-Transforms 137
13 Partial Differential Equations and Special Functions 138131 Separation of Variables and
Rectangular Coordinates 138132 Legendre Polynomials 145133 Spherical Harmonics 150134 Bessel Functions 156135 Spherical Bessel Functions 162
14 Integral Equations and the Calculus of Variations 166141 Volterra and Fredholm Equations 166142 Calculus of Variations the
Euler-Lagrange Equation 168
15 Particle Mechanics 170151 Newtonrsquos Laws 170152 Forces 171153 Numerical Methods 173154 Work and Energy 174155 Lagrange Equations 176156 Three-Dimensional Particle Motion 180157 Impulse 181158 Oscillatory Motion 181159 Rotational Motion About a Fixed Axis 1851510 Torque and Angular Momentum 1871511 Motion in Accelerating Reference Systems 1881512 Gravitational Forces and Fields 1891513 Celestial Mechanics 1911514 Dynamics of Systems of Particles 1931515 Two-Particle Collisions and Scattering 1971516 Mechanics of Rigid Bodies 1991517 Hamiltonrsquos Equation and Kinematics 206
16 Fluid Mechanics 210161 Continuity Equation 210162 Eulerrsquos Equation 212163 Bernoullirsquos Equation 213
17 Special Relativity 215171 Four-Vectors and Lorentz Transformation 215172 Length Contraction Time Dilation and Simultaneity 217
x CONTENTS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
FUNDAMENTAL MATH AND PHYSICSFOR SCIENTISTS AND ENGINEERS
FUNDAMENTAL MATHAND PHYSICS FORSCIENTISTS ANDENGINEERS
DAVID YEVICK
HANNAH YEVICK
Copyright copy 2015 by John Wiley amp Sons Inc All rights reserved
Published by John Wiley amp Sons Inc Hoboken New JerseyPublished simultaneously in Canada
No part of this publication may be reproduced stored in a retrieval system or transmitted in any formor by any means electronic mechanical photocopying recording scanning or otherwise exceptas permitted under Section 107 or 108 of the 1976 United States Copyright Act without either theprior written permission of the Publisher or authorization through payment of the appropriate per-copyfee to the Copyright Clearance Center Inc 222 Rosewood Drive Danvers MA 01923 (978) 750-8400fax (978) 750-4470 or on the web at wwwcopyrightcom Requests to the Publisher for permissionshould be addressed to the Permissions Department John Wiley amp Sons Inc 111 River Street HobokenNJ 07030 (201) 748-6011 fax (201) 748-6008 or online at httpwwwwileycomgopermissions
Limit of LiabilityDisclaimer of Warranty While the publisher and author have used their best effortsin preparing this book they make no representations or warranties with respect to the accuracy orcompleteness of the contents of this book and specifically disclaim any implied warranties ofmerchantability or fitness for a particular purpose No warranty may be created or extended by salesrepresentatives or written sales materials The advice and strategies contained herein may not besuitable for your situation You should consult with a professional where appropriate Neither thepublisher nor author shall be liable for any loss of profit or any other commercial damages includingbut not limited to special incidental consequential or other damages
For general information on our other products and services or for technical support please contactour Customer Care Department within the United States at (800) 762-2974 outside the United Statesat (317) 572-3993 or fax (317) 572-4002
Wiley also publishes its books in a variety of electronic formats Some content that appears in printmay not be available in electronic formats For more information about Wiley products visit our web siteat wwwwileycom
Library of Congress Cataloging-in-Publication Data
Yevick David authorFundamental math and physics for scientists and engineers David Yevick Hannah Yevick
1 online resourceldquoPublished simultaneously in CanadardquondashTitle page versoIncludes indexDescription based on print version record and CIP data provided by publisher resource not viewedISBN 978-0-470-40784-4 (pbk) ndash ISBN 978-1-118-98559-5 (Adobe PDF) ndash ISBN 978-0-470-40784-4(pbk)1 Mathematics 2 Physics I Yevick Hannah author II TitleQA393510ndashdc23
2014040697
Cover Image iStockphotocopynadla
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
To George
CONTENTS
1 Introduction 1
2 Problem Solving 321 Analysis 322 Test-Taking Techniques 4
221 Dimensional Analysis 5
3 Scientific Programming 631 Language Fundamentals 6
311 Octave Programming 7
4 Elementary Mathematics 1241 Algebra 12
411 Equation Manipulation 12412 Linear Equation Systems 13413 Factoring 14414 Inequalities 15415 Sum Formulas 16416 Binomial Theorem 17
42 Geometry 17421 Angles 18422 Triangles 18423 Right Triangles 19424 Polygons 20425 Circles 20
vii
43 Exponential Logarithmic Functions and Trigonometry 21431 Exponential Functions 21432 Inverse Functions and Logarithms 21433 Hyperbolic Functions 22434 Complex Numbers and Harmonic Functions 23435 Inverse Harmonic and Hyperbolic Functions 25436 Trigonometric Identities 26
44 Analytic Geometry 28441 Lines and Planes 28442 Conic Sections 29443 Areas Volumes and Solid Angles 31
5 Vectors and Matrices 3251 Matrices and Matrix Products 3252 Equation Systems 3453 Traces and Determinants 3554 Vectors and Inner Products 3855 Cross and Outer Products 4056 Vector Identities 4157 Rotations and Orthogonal Matrices 4258 Groups and Matrix Generators 4359 Eigenvalues and Eigenvectors 45510 Similarity Transformations 48
6 Calculus of a Single Variable 5061 Derivatives 5062 Integrals 5463 Series 60
7 Calculus of Several Variables 6271 Partial Derivatives 6272 Multidimensional Taylor Series and
Extrema 6673 Multiple Integration 6774 Volumes and Surfaces of Revolution 6975 Change of Variables and Jacobians 70
8 Calculus of Vector Functions 7281 Generalized Coordinates 7282 Vector Differential Operators 7783 Vector Differential Identities 8184 Gaussrsquos and Stokesrsquo Laws and
Greenrsquos Identities 8285 Lagrange Multipliers 83
viii CONTENTS
9 Probability Theory and Statistics 8591 Random Variables Probability Density
and Distributions 8592 Mean Variance and Standard Deviation 8693 Variable Transformations 8694 Moments and Moment-Generating Function 8695 Multivariate Probability Distributions
Covariance and Correlation 8796 Gaussian Binomial and Poisson Distributions 8797 Least Squares Regression 9198 Error Propagation 9299 Numerical Models 93
10 Complex Analysis 94101 Functions of a Complex Variable 94102 Derivatives Analyticity and
the CauchyndashRiemann Relations 95103 Conformal Mapping 96104 Cauchyrsquos Theorem and Taylor and Laurent Series 97105 Residue Theorem 101106 Dispersion Relations 105107 Method of Steepest Decent 106
11 Differential Equations 108111 Linearity Superposition and Initial
and Boundary Values 108112 Numerical Solutions 109113 First-Order Differential Equations 112114 Wronskian 114115 Factorization 115116 Method of Undetermined Coefficients 115117 Variation of Parameters 116118 Reduction of Order 118119 Series Solution and Method of Frobenius 1181110 Systems of Equations Eigenvalues
and Eigenvectors 119
12 Transform Theory 122121 Eigenfunctions and Eigenvectors 122122 SturmndashLiouville Theory 123123 Fourier Series 125124 Fourier Transforms 127125 Delta Functions 128126 Greenrsquos Functions 131
ixCONTENTS
127 Laplace Transforms 135128 z-Transforms 137
13 Partial Differential Equations and Special Functions 138131 Separation of Variables and
Rectangular Coordinates 138132 Legendre Polynomials 145133 Spherical Harmonics 150134 Bessel Functions 156135 Spherical Bessel Functions 162
14 Integral Equations and the Calculus of Variations 166141 Volterra and Fredholm Equations 166142 Calculus of Variations the
Euler-Lagrange Equation 168
15 Particle Mechanics 170151 Newtonrsquos Laws 170152 Forces 171153 Numerical Methods 173154 Work and Energy 174155 Lagrange Equations 176156 Three-Dimensional Particle Motion 180157 Impulse 181158 Oscillatory Motion 181159 Rotational Motion About a Fixed Axis 1851510 Torque and Angular Momentum 1871511 Motion in Accelerating Reference Systems 1881512 Gravitational Forces and Fields 1891513 Celestial Mechanics 1911514 Dynamics of Systems of Particles 1931515 Two-Particle Collisions and Scattering 1971516 Mechanics of Rigid Bodies 1991517 Hamiltonrsquos Equation and Kinematics 206
16 Fluid Mechanics 210161 Continuity Equation 210162 Eulerrsquos Equation 212163 Bernoullirsquos Equation 213
17 Special Relativity 215171 Four-Vectors and Lorentz Transformation 215172 Length Contraction Time Dilation and Simultaneity 217
x CONTENTS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
FUNDAMENTAL MATHAND PHYSICS FORSCIENTISTS ANDENGINEERS
DAVID YEVICK
HANNAH YEVICK
Copyright copy 2015 by John Wiley amp Sons Inc All rights reserved
Published by John Wiley amp Sons Inc Hoboken New JerseyPublished simultaneously in Canada
No part of this publication may be reproduced stored in a retrieval system or transmitted in any formor by any means electronic mechanical photocopying recording scanning or otherwise exceptas permitted under Section 107 or 108 of the 1976 United States Copyright Act without either theprior written permission of the Publisher or authorization through payment of the appropriate per-copyfee to the Copyright Clearance Center Inc 222 Rosewood Drive Danvers MA 01923 (978) 750-8400fax (978) 750-4470 or on the web at wwwcopyrightcom Requests to the Publisher for permissionshould be addressed to the Permissions Department John Wiley amp Sons Inc 111 River Street HobokenNJ 07030 (201) 748-6011 fax (201) 748-6008 or online at httpwwwwileycomgopermissions
Limit of LiabilityDisclaimer of Warranty While the publisher and author have used their best effortsin preparing this book they make no representations or warranties with respect to the accuracy orcompleteness of the contents of this book and specifically disclaim any implied warranties ofmerchantability or fitness for a particular purpose No warranty may be created or extended by salesrepresentatives or written sales materials The advice and strategies contained herein may not besuitable for your situation You should consult with a professional where appropriate Neither thepublisher nor author shall be liable for any loss of profit or any other commercial damages includingbut not limited to special incidental consequential or other damages
For general information on our other products and services or for technical support please contactour Customer Care Department within the United States at (800) 762-2974 outside the United Statesat (317) 572-3993 or fax (317) 572-4002
Wiley also publishes its books in a variety of electronic formats Some content that appears in printmay not be available in electronic formats For more information about Wiley products visit our web siteat wwwwileycom
Library of Congress Cataloging-in-Publication Data
Yevick David authorFundamental math and physics for scientists and engineers David Yevick Hannah Yevick
1 online resourceldquoPublished simultaneously in CanadardquondashTitle page versoIncludes indexDescription based on print version record and CIP data provided by publisher resource not viewedISBN 978-0-470-40784-4 (pbk) ndash ISBN 978-1-118-98559-5 (Adobe PDF) ndash ISBN 978-0-470-40784-4(pbk)1 Mathematics 2 Physics I Yevick Hannah author II TitleQA393510ndashdc23
2014040697
Cover Image iStockphotocopynadla
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
To George
CONTENTS
1 Introduction 1
2 Problem Solving 321 Analysis 322 Test-Taking Techniques 4
221 Dimensional Analysis 5
3 Scientific Programming 631 Language Fundamentals 6
311 Octave Programming 7
4 Elementary Mathematics 1241 Algebra 12
411 Equation Manipulation 12412 Linear Equation Systems 13413 Factoring 14414 Inequalities 15415 Sum Formulas 16416 Binomial Theorem 17
42 Geometry 17421 Angles 18422 Triangles 18423 Right Triangles 19424 Polygons 20425 Circles 20
vii
43 Exponential Logarithmic Functions and Trigonometry 21431 Exponential Functions 21432 Inverse Functions and Logarithms 21433 Hyperbolic Functions 22434 Complex Numbers and Harmonic Functions 23435 Inverse Harmonic and Hyperbolic Functions 25436 Trigonometric Identities 26
44 Analytic Geometry 28441 Lines and Planes 28442 Conic Sections 29443 Areas Volumes and Solid Angles 31
5 Vectors and Matrices 3251 Matrices and Matrix Products 3252 Equation Systems 3453 Traces and Determinants 3554 Vectors and Inner Products 3855 Cross and Outer Products 4056 Vector Identities 4157 Rotations and Orthogonal Matrices 4258 Groups and Matrix Generators 4359 Eigenvalues and Eigenvectors 45510 Similarity Transformations 48
6 Calculus of a Single Variable 5061 Derivatives 5062 Integrals 5463 Series 60
7 Calculus of Several Variables 6271 Partial Derivatives 6272 Multidimensional Taylor Series and
Extrema 6673 Multiple Integration 6774 Volumes and Surfaces of Revolution 6975 Change of Variables and Jacobians 70
8 Calculus of Vector Functions 7281 Generalized Coordinates 7282 Vector Differential Operators 7783 Vector Differential Identities 8184 Gaussrsquos and Stokesrsquo Laws and
Greenrsquos Identities 8285 Lagrange Multipliers 83
viii CONTENTS
9 Probability Theory and Statistics 8591 Random Variables Probability Density
and Distributions 8592 Mean Variance and Standard Deviation 8693 Variable Transformations 8694 Moments and Moment-Generating Function 8695 Multivariate Probability Distributions
Covariance and Correlation 8796 Gaussian Binomial and Poisson Distributions 8797 Least Squares Regression 9198 Error Propagation 9299 Numerical Models 93
10 Complex Analysis 94101 Functions of a Complex Variable 94102 Derivatives Analyticity and
the CauchyndashRiemann Relations 95103 Conformal Mapping 96104 Cauchyrsquos Theorem and Taylor and Laurent Series 97105 Residue Theorem 101106 Dispersion Relations 105107 Method of Steepest Decent 106
11 Differential Equations 108111 Linearity Superposition and Initial
and Boundary Values 108112 Numerical Solutions 109113 First-Order Differential Equations 112114 Wronskian 114115 Factorization 115116 Method of Undetermined Coefficients 115117 Variation of Parameters 116118 Reduction of Order 118119 Series Solution and Method of Frobenius 1181110 Systems of Equations Eigenvalues
and Eigenvectors 119
12 Transform Theory 122121 Eigenfunctions and Eigenvectors 122122 SturmndashLiouville Theory 123123 Fourier Series 125124 Fourier Transforms 127125 Delta Functions 128126 Greenrsquos Functions 131
ixCONTENTS
127 Laplace Transforms 135128 z-Transforms 137
13 Partial Differential Equations and Special Functions 138131 Separation of Variables and
Rectangular Coordinates 138132 Legendre Polynomials 145133 Spherical Harmonics 150134 Bessel Functions 156135 Spherical Bessel Functions 162
14 Integral Equations and the Calculus of Variations 166141 Volterra and Fredholm Equations 166142 Calculus of Variations the
Euler-Lagrange Equation 168
15 Particle Mechanics 170151 Newtonrsquos Laws 170152 Forces 171153 Numerical Methods 173154 Work and Energy 174155 Lagrange Equations 176156 Three-Dimensional Particle Motion 180157 Impulse 181158 Oscillatory Motion 181159 Rotational Motion About a Fixed Axis 1851510 Torque and Angular Momentum 1871511 Motion in Accelerating Reference Systems 1881512 Gravitational Forces and Fields 1891513 Celestial Mechanics 1911514 Dynamics of Systems of Particles 1931515 Two-Particle Collisions and Scattering 1971516 Mechanics of Rigid Bodies 1991517 Hamiltonrsquos Equation and Kinematics 206
16 Fluid Mechanics 210161 Continuity Equation 210162 Eulerrsquos Equation 212163 Bernoullirsquos Equation 213
17 Special Relativity 215171 Four-Vectors and Lorentz Transformation 215172 Length Contraction Time Dilation and Simultaneity 217
x CONTENTS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
Copyright copy 2015 by John Wiley amp Sons Inc All rights reserved
Published by John Wiley amp Sons Inc Hoboken New JerseyPublished simultaneously in Canada
No part of this publication may be reproduced stored in a retrieval system or transmitted in any formor by any means electronic mechanical photocopying recording scanning or otherwise exceptas permitted under Section 107 or 108 of the 1976 United States Copyright Act without either theprior written permission of the Publisher or authorization through payment of the appropriate per-copyfee to the Copyright Clearance Center Inc 222 Rosewood Drive Danvers MA 01923 (978) 750-8400fax (978) 750-4470 or on the web at wwwcopyrightcom Requests to the Publisher for permissionshould be addressed to the Permissions Department John Wiley amp Sons Inc 111 River Street HobokenNJ 07030 (201) 748-6011 fax (201) 748-6008 or online at httpwwwwileycomgopermissions
Limit of LiabilityDisclaimer of Warranty While the publisher and author have used their best effortsin preparing this book they make no representations or warranties with respect to the accuracy orcompleteness of the contents of this book and specifically disclaim any implied warranties ofmerchantability or fitness for a particular purpose No warranty may be created or extended by salesrepresentatives or written sales materials The advice and strategies contained herein may not besuitable for your situation You should consult with a professional where appropriate Neither thepublisher nor author shall be liable for any loss of profit or any other commercial damages includingbut not limited to special incidental consequential or other damages
For general information on our other products and services or for technical support please contactour Customer Care Department within the United States at (800) 762-2974 outside the United Statesat (317) 572-3993 or fax (317) 572-4002
Wiley also publishes its books in a variety of electronic formats Some content that appears in printmay not be available in electronic formats For more information about Wiley products visit our web siteat wwwwileycom
Library of Congress Cataloging-in-Publication Data
Yevick David authorFundamental math and physics for scientists and engineers David Yevick Hannah Yevick
1 online resourceldquoPublished simultaneously in CanadardquondashTitle page versoIncludes indexDescription based on print version record and CIP data provided by publisher resource not viewedISBN 978-0-470-40784-4 (pbk) ndash ISBN 978-1-118-98559-5 (Adobe PDF) ndash ISBN 978-0-470-40784-4(pbk)1 Mathematics 2 Physics I Yevick Hannah author II TitleQA393510ndashdc23
2014040697
Cover Image iStockphotocopynadla
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
To George
CONTENTS
1 Introduction 1
2 Problem Solving 321 Analysis 322 Test-Taking Techniques 4
221 Dimensional Analysis 5
3 Scientific Programming 631 Language Fundamentals 6
311 Octave Programming 7
4 Elementary Mathematics 1241 Algebra 12
411 Equation Manipulation 12412 Linear Equation Systems 13413 Factoring 14414 Inequalities 15415 Sum Formulas 16416 Binomial Theorem 17
42 Geometry 17421 Angles 18422 Triangles 18423 Right Triangles 19424 Polygons 20425 Circles 20
vii
43 Exponential Logarithmic Functions and Trigonometry 21431 Exponential Functions 21432 Inverse Functions and Logarithms 21433 Hyperbolic Functions 22434 Complex Numbers and Harmonic Functions 23435 Inverse Harmonic and Hyperbolic Functions 25436 Trigonometric Identities 26
44 Analytic Geometry 28441 Lines and Planes 28442 Conic Sections 29443 Areas Volumes and Solid Angles 31
5 Vectors and Matrices 3251 Matrices and Matrix Products 3252 Equation Systems 3453 Traces and Determinants 3554 Vectors and Inner Products 3855 Cross and Outer Products 4056 Vector Identities 4157 Rotations and Orthogonal Matrices 4258 Groups and Matrix Generators 4359 Eigenvalues and Eigenvectors 45510 Similarity Transformations 48
6 Calculus of a Single Variable 5061 Derivatives 5062 Integrals 5463 Series 60
7 Calculus of Several Variables 6271 Partial Derivatives 6272 Multidimensional Taylor Series and
Extrema 6673 Multiple Integration 6774 Volumes and Surfaces of Revolution 6975 Change of Variables and Jacobians 70
8 Calculus of Vector Functions 7281 Generalized Coordinates 7282 Vector Differential Operators 7783 Vector Differential Identities 8184 Gaussrsquos and Stokesrsquo Laws and
Greenrsquos Identities 8285 Lagrange Multipliers 83
viii CONTENTS
9 Probability Theory and Statistics 8591 Random Variables Probability Density
and Distributions 8592 Mean Variance and Standard Deviation 8693 Variable Transformations 8694 Moments and Moment-Generating Function 8695 Multivariate Probability Distributions
Covariance and Correlation 8796 Gaussian Binomial and Poisson Distributions 8797 Least Squares Regression 9198 Error Propagation 9299 Numerical Models 93
10 Complex Analysis 94101 Functions of a Complex Variable 94102 Derivatives Analyticity and
the CauchyndashRiemann Relations 95103 Conformal Mapping 96104 Cauchyrsquos Theorem and Taylor and Laurent Series 97105 Residue Theorem 101106 Dispersion Relations 105107 Method of Steepest Decent 106
11 Differential Equations 108111 Linearity Superposition and Initial
and Boundary Values 108112 Numerical Solutions 109113 First-Order Differential Equations 112114 Wronskian 114115 Factorization 115116 Method of Undetermined Coefficients 115117 Variation of Parameters 116118 Reduction of Order 118119 Series Solution and Method of Frobenius 1181110 Systems of Equations Eigenvalues
and Eigenvectors 119
12 Transform Theory 122121 Eigenfunctions and Eigenvectors 122122 SturmndashLiouville Theory 123123 Fourier Series 125124 Fourier Transforms 127125 Delta Functions 128126 Greenrsquos Functions 131
ixCONTENTS
127 Laplace Transforms 135128 z-Transforms 137
13 Partial Differential Equations and Special Functions 138131 Separation of Variables and
Rectangular Coordinates 138132 Legendre Polynomials 145133 Spherical Harmonics 150134 Bessel Functions 156135 Spherical Bessel Functions 162
14 Integral Equations and the Calculus of Variations 166141 Volterra and Fredholm Equations 166142 Calculus of Variations the
Euler-Lagrange Equation 168
15 Particle Mechanics 170151 Newtonrsquos Laws 170152 Forces 171153 Numerical Methods 173154 Work and Energy 174155 Lagrange Equations 176156 Three-Dimensional Particle Motion 180157 Impulse 181158 Oscillatory Motion 181159 Rotational Motion About a Fixed Axis 1851510 Torque and Angular Momentum 1871511 Motion in Accelerating Reference Systems 1881512 Gravitational Forces and Fields 1891513 Celestial Mechanics 1911514 Dynamics of Systems of Particles 1931515 Two-Particle Collisions and Scattering 1971516 Mechanics of Rigid Bodies 1991517 Hamiltonrsquos Equation and Kinematics 206
16 Fluid Mechanics 210161 Continuity Equation 210162 Eulerrsquos Equation 212163 Bernoullirsquos Equation 213
17 Special Relativity 215171 Four-Vectors and Lorentz Transformation 215172 Length Contraction Time Dilation and Simultaneity 217
x CONTENTS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
To George
CONTENTS
1 Introduction 1
2 Problem Solving 321 Analysis 322 Test-Taking Techniques 4
221 Dimensional Analysis 5
3 Scientific Programming 631 Language Fundamentals 6
311 Octave Programming 7
4 Elementary Mathematics 1241 Algebra 12
411 Equation Manipulation 12412 Linear Equation Systems 13413 Factoring 14414 Inequalities 15415 Sum Formulas 16416 Binomial Theorem 17
42 Geometry 17421 Angles 18422 Triangles 18423 Right Triangles 19424 Polygons 20425 Circles 20
vii
43 Exponential Logarithmic Functions and Trigonometry 21431 Exponential Functions 21432 Inverse Functions and Logarithms 21433 Hyperbolic Functions 22434 Complex Numbers and Harmonic Functions 23435 Inverse Harmonic and Hyperbolic Functions 25436 Trigonometric Identities 26
44 Analytic Geometry 28441 Lines and Planes 28442 Conic Sections 29443 Areas Volumes and Solid Angles 31
5 Vectors and Matrices 3251 Matrices and Matrix Products 3252 Equation Systems 3453 Traces and Determinants 3554 Vectors and Inner Products 3855 Cross and Outer Products 4056 Vector Identities 4157 Rotations and Orthogonal Matrices 4258 Groups and Matrix Generators 4359 Eigenvalues and Eigenvectors 45510 Similarity Transformations 48
6 Calculus of a Single Variable 5061 Derivatives 5062 Integrals 5463 Series 60
7 Calculus of Several Variables 6271 Partial Derivatives 6272 Multidimensional Taylor Series and
Extrema 6673 Multiple Integration 6774 Volumes and Surfaces of Revolution 6975 Change of Variables and Jacobians 70
8 Calculus of Vector Functions 7281 Generalized Coordinates 7282 Vector Differential Operators 7783 Vector Differential Identities 8184 Gaussrsquos and Stokesrsquo Laws and
Greenrsquos Identities 8285 Lagrange Multipliers 83
viii CONTENTS
9 Probability Theory and Statistics 8591 Random Variables Probability Density
and Distributions 8592 Mean Variance and Standard Deviation 8693 Variable Transformations 8694 Moments and Moment-Generating Function 8695 Multivariate Probability Distributions
Covariance and Correlation 8796 Gaussian Binomial and Poisson Distributions 8797 Least Squares Regression 9198 Error Propagation 9299 Numerical Models 93
10 Complex Analysis 94101 Functions of a Complex Variable 94102 Derivatives Analyticity and
the CauchyndashRiemann Relations 95103 Conformal Mapping 96104 Cauchyrsquos Theorem and Taylor and Laurent Series 97105 Residue Theorem 101106 Dispersion Relations 105107 Method of Steepest Decent 106
11 Differential Equations 108111 Linearity Superposition and Initial
and Boundary Values 108112 Numerical Solutions 109113 First-Order Differential Equations 112114 Wronskian 114115 Factorization 115116 Method of Undetermined Coefficients 115117 Variation of Parameters 116118 Reduction of Order 118119 Series Solution and Method of Frobenius 1181110 Systems of Equations Eigenvalues
and Eigenvectors 119
12 Transform Theory 122121 Eigenfunctions and Eigenvectors 122122 SturmndashLiouville Theory 123123 Fourier Series 125124 Fourier Transforms 127125 Delta Functions 128126 Greenrsquos Functions 131
ixCONTENTS
127 Laplace Transforms 135128 z-Transforms 137
13 Partial Differential Equations and Special Functions 138131 Separation of Variables and
Rectangular Coordinates 138132 Legendre Polynomials 145133 Spherical Harmonics 150134 Bessel Functions 156135 Spherical Bessel Functions 162
14 Integral Equations and the Calculus of Variations 166141 Volterra and Fredholm Equations 166142 Calculus of Variations the
Euler-Lagrange Equation 168
15 Particle Mechanics 170151 Newtonrsquos Laws 170152 Forces 171153 Numerical Methods 173154 Work and Energy 174155 Lagrange Equations 176156 Three-Dimensional Particle Motion 180157 Impulse 181158 Oscillatory Motion 181159 Rotational Motion About a Fixed Axis 1851510 Torque and Angular Momentum 1871511 Motion in Accelerating Reference Systems 1881512 Gravitational Forces and Fields 1891513 Celestial Mechanics 1911514 Dynamics of Systems of Particles 1931515 Two-Particle Collisions and Scattering 1971516 Mechanics of Rigid Bodies 1991517 Hamiltonrsquos Equation and Kinematics 206
16 Fluid Mechanics 210161 Continuity Equation 210162 Eulerrsquos Equation 212163 Bernoullirsquos Equation 213
17 Special Relativity 215171 Four-Vectors and Lorentz Transformation 215172 Length Contraction Time Dilation and Simultaneity 217
x CONTENTS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
CONTENTS
1 Introduction 1
2 Problem Solving 321 Analysis 322 Test-Taking Techniques 4
221 Dimensional Analysis 5
3 Scientific Programming 631 Language Fundamentals 6
311 Octave Programming 7
4 Elementary Mathematics 1241 Algebra 12
411 Equation Manipulation 12412 Linear Equation Systems 13413 Factoring 14414 Inequalities 15415 Sum Formulas 16416 Binomial Theorem 17
42 Geometry 17421 Angles 18422 Triangles 18423 Right Triangles 19424 Polygons 20425 Circles 20
vii
43 Exponential Logarithmic Functions and Trigonometry 21431 Exponential Functions 21432 Inverse Functions and Logarithms 21433 Hyperbolic Functions 22434 Complex Numbers and Harmonic Functions 23435 Inverse Harmonic and Hyperbolic Functions 25436 Trigonometric Identities 26
44 Analytic Geometry 28441 Lines and Planes 28442 Conic Sections 29443 Areas Volumes and Solid Angles 31
5 Vectors and Matrices 3251 Matrices and Matrix Products 3252 Equation Systems 3453 Traces and Determinants 3554 Vectors and Inner Products 3855 Cross and Outer Products 4056 Vector Identities 4157 Rotations and Orthogonal Matrices 4258 Groups and Matrix Generators 4359 Eigenvalues and Eigenvectors 45510 Similarity Transformations 48
6 Calculus of a Single Variable 5061 Derivatives 5062 Integrals 5463 Series 60
7 Calculus of Several Variables 6271 Partial Derivatives 6272 Multidimensional Taylor Series and
Extrema 6673 Multiple Integration 6774 Volumes and Surfaces of Revolution 6975 Change of Variables and Jacobians 70
8 Calculus of Vector Functions 7281 Generalized Coordinates 7282 Vector Differential Operators 7783 Vector Differential Identities 8184 Gaussrsquos and Stokesrsquo Laws and
Greenrsquos Identities 8285 Lagrange Multipliers 83
viii CONTENTS
9 Probability Theory and Statistics 8591 Random Variables Probability Density
and Distributions 8592 Mean Variance and Standard Deviation 8693 Variable Transformations 8694 Moments and Moment-Generating Function 8695 Multivariate Probability Distributions
Covariance and Correlation 8796 Gaussian Binomial and Poisson Distributions 8797 Least Squares Regression 9198 Error Propagation 9299 Numerical Models 93
10 Complex Analysis 94101 Functions of a Complex Variable 94102 Derivatives Analyticity and
the CauchyndashRiemann Relations 95103 Conformal Mapping 96104 Cauchyrsquos Theorem and Taylor and Laurent Series 97105 Residue Theorem 101106 Dispersion Relations 105107 Method of Steepest Decent 106
11 Differential Equations 108111 Linearity Superposition and Initial
and Boundary Values 108112 Numerical Solutions 109113 First-Order Differential Equations 112114 Wronskian 114115 Factorization 115116 Method of Undetermined Coefficients 115117 Variation of Parameters 116118 Reduction of Order 118119 Series Solution and Method of Frobenius 1181110 Systems of Equations Eigenvalues
and Eigenvectors 119
12 Transform Theory 122121 Eigenfunctions and Eigenvectors 122122 SturmndashLiouville Theory 123123 Fourier Series 125124 Fourier Transforms 127125 Delta Functions 128126 Greenrsquos Functions 131
ixCONTENTS
127 Laplace Transforms 135128 z-Transforms 137
13 Partial Differential Equations and Special Functions 138131 Separation of Variables and
Rectangular Coordinates 138132 Legendre Polynomials 145133 Spherical Harmonics 150134 Bessel Functions 156135 Spherical Bessel Functions 162
14 Integral Equations and the Calculus of Variations 166141 Volterra and Fredholm Equations 166142 Calculus of Variations the
Euler-Lagrange Equation 168
15 Particle Mechanics 170151 Newtonrsquos Laws 170152 Forces 171153 Numerical Methods 173154 Work and Energy 174155 Lagrange Equations 176156 Three-Dimensional Particle Motion 180157 Impulse 181158 Oscillatory Motion 181159 Rotational Motion About a Fixed Axis 1851510 Torque and Angular Momentum 1871511 Motion in Accelerating Reference Systems 1881512 Gravitational Forces and Fields 1891513 Celestial Mechanics 1911514 Dynamics of Systems of Particles 1931515 Two-Particle Collisions and Scattering 1971516 Mechanics of Rigid Bodies 1991517 Hamiltonrsquos Equation and Kinematics 206
16 Fluid Mechanics 210161 Continuity Equation 210162 Eulerrsquos Equation 212163 Bernoullirsquos Equation 213
17 Special Relativity 215171 Four-Vectors and Lorentz Transformation 215172 Length Contraction Time Dilation and Simultaneity 217
x CONTENTS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
43 Exponential Logarithmic Functions and Trigonometry 21431 Exponential Functions 21432 Inverse Functions and Logarithms 21433 Hyperbolic Functions 22434 Complex Numbers and Harmonic Functions 23435 Inverse Harmonic and Hyperbolic Functions 25436 Trigonometric Identities 26
44 Analytic Geometry 28441 Lines and Planes 28442 Conic Sections 29443 Areas Volumes and Solid Angles 31
5 Vectors and Matrices 3251 Matrices and Matrix Products 3252 Equation Systems 3453 Traces and Determinants 3554 Vectors and Inner Products 3855 Cross and Outer Products 4056 Vector Identities 4157 Rotations and Orthogonal Matrices 4258 Groups and Matrix Generators 4359 Eigenvalues and Eigenvectors 45510 Similarity Transformations 48
6 Calculus of a Single Variable 5061 Derivatives 5062 Integrals 5463 Series 60
7 Calculus of Several Variables 6271 Partial Derivatives 6272 Multidimensional Taylor Series and
Extrema 6673 Multiple Integration 6774 Volumes and Surfaces of Revolution 6975 Change of Variables and Jacobians 70
8 Calculus of Vector Functions 7281 Generalized Coordinates 7282 Vector Differential Operators 7783 Vector Differential Identities 8184 Gaussrsquos and Stokesrsquo Laws and
Greenrsquos Identities 8285 Lagrange Multipliers 83
viii CONTENTS
9 Probability Theory and Statistics 8591 Random Variables Probability Density
and Distributions 8592 Mean Variance and Standard Deviation 8693 Variable Transformations 8694 Moments and Moment-Generating Function 8695 Multivariate Probability Distributions
Covariance and Correlation 8796 Gaussian Binomial and Poisson Distributions 8797 Least Squares Regression 9198 Error Propagation 9299 Numerical Models 93
10 Complex Analysis 94101 Functions of a Complex Variable 94102 Derivatives Analyticity and
the CauchyndashRiemann Relations 95103 Conformal Mapping 96104 Cauchyrsquos Theorem and Taylor and Laurent Series 97105 Residue Theorem 101106 Dispersion Relations 105107 Method of Steepest Decent 106
11 Differential Equations 108111 Linearity Superposition and Initial
and Boundary Values 108112 Numerical Solutions 109113 First-Order Differential Equations 112114 Wronskian 114115 Factorization 115116 Method of Undetermined Coefficients 115117 Variation of Parameters 116118 Reduction of Order 118119 Series Solution and Method of Frobenius 1181110 Systems of Equations Eigenvalues
and Eigenvectors 119
12 Transform Theory 122121 Eigenfunctions and Eigenvectors 122122 SturmndashLiouville Theory 123123 Fourier Series 125124 Fourier Transforms 127125 Delta Functions 128126 Greenrsquos Functions 131
ixCONTENTS
127 Laplace Transforms 135128 z-Transforms 137
13 Partial Differential Equations and Special Functions 138131 Separation of Variables and
Rectangular Coordinates 138132 Legendre Polynomials 145133 Spherical Harmonics 150134 Bessel Functions 156135 Spherical Bessel Functions 162
14 Integral Equations and the Calculus of Variations 166141 Volterra and Fredholm Equations 166142 Calculus of Variations the
Euler-Lagrange Equation 168
15 Particle Mechanics 170151 Newtonrsquos Laws 170152 Forces 171153 Numerical Methods 173154 Work and Energy 174155 Lagrange Equations 176156 Three-Dimensional Particle Motion 180157 Impulse 181158 Oscillatory Motion 181159 Rotational Motion About a Fixed Axis 1851510 Torque and Angular Momentum 1871511 Motion in Accelerating Reference Systems 1881512 Gravitational Forces and Fields 1891513 Celestial Mechanics 1911514 Dynamics of Systems of Particles 1931515 Two-Particle Collisions and Scattering 1971516 Mechanics of Rigid Bodies 1991517 Hamiltonrsquos Equation and Kinematics 206
16 Fluid Mechanics 210161 Continuity Equation 210162 Eulerrsquos Equation 212163 Bernoullirsquos Equation 213
17 Special Relativity 215171 Four-Vectors and Lorentz Transformation 215172 Length Contraction Time Dilation and Simultaneity 217
x CONTENTS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
9 Probability Theory and Statistics 8591 Random Variables Probability Density
and Distributions 8592 Mean Variance and Standard Deviation 8693 Variable Transformations 8694 Moments and Moment-Generating Function 8695 Multivariate Probability Distributions
Covariance and Correlation 8796 Gaussian Binomial and Poisson Distributions 8797 Least Squares Regression 9198 Error Propagation 9299 Numerical Models 93
10 Complex Analysis 94101 Functions of a Complex Variable 94102 Derivatives Analyticity and
the CauchyndashRiemann Relations 95103 Conformal Mapping 96104 Cauchyrsquos Theorem and Taylor and Laurent Series 97105 Residue Theorem 101106 Dispersion Relations 105107 Method of Steepest Decent 106
11 Differential Equations 108111 Linearity Superposition and Initial
and Boundary Values 108112 Numerical Solutions 109113 First-Order Differential Equations 112114 Wronskian 114115 Factorization 115116 Method of Undetermined Coefficients 115117 Variation of Parameters 116118 Reduction of Order 118119 Series Solution and Method of Frobenius 1181110 Systems of Equations Eigenvalues
and Eigenvectors 119
12 Transform Theory 122121 Eigenfunctions and Eigenvectors 122122 SturmndashLiouville Theory 123123 Fourier Series 125124 Fourier Transforms 127125 Delta Functions 128126 Greenrsquos Functions 131
ixCONTENTS
127 Laplace Transforms 135128 z-Transforms 137
13 Partial Differential Equations and Special Functions 138131 Separation of Variables and
Rectangular Coordinates 138132 Legendre Polynomials 145133 Spherical Harmonics 150134 Bessel Functions 156135 Spherical Bessel Functions 162
14 Integral Equations and the Calculus of Variations 166141 Volterra and Fredholm Equations 166142 Calculus of Variations the
Euler-Lagrange Equation 168
15 Particle Mechanics 170151 Newtonrsquos Laws 170152 Forces 171153 Numerical Methods 173154 Work and Energy 174155 Lagrange Equations 176156 Three-Dimensional Particle Motion 180157 Impulse 181158 Oscillatory Motion 181159 Rotational Motion About a Fixed Axis 1851510 Torque and Angular Momentum 1871511 Motion in Accelerating Reference Systems 1881512 Gravitational Forces and Fields 1891513 Celestial Mechanics 1911514 Dynamics of Systems of Particles 1931515 Two-Particle Collisions and Scattering 1971516 Mechanics of Rigid Bodies 1991517 Hamiltonrsquos Equation and Kinematics 206
16 Fluid Mechanics 210161 Continuity Equation 210162 Eulerrsquos Equation 212163 Bernoullirsquos Equation 213
17 Special Relativity 215171 Four-Vectors and Lorentz Transformation 215172 Length Contraction Time Dilation and Simultaneity 217
x CONTENTS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
127 Laplace Transforms 135128 z-Transforms 137
13 Partial Differential Equations and Special Functions 138131 Separation of Variables and
Rectangular Coordinates 138132 Legendre Polynomials 145133 Spherical Harmonics 150134 Bessel Functions 156135 Spherical Bessel Functions 162
14 Integral Equations and the Calculus of Variations 166141 Volterra and Fredholm Equations 166142 Calculus of Variations the
Euler-Lagrange Equation 168
15 Particle Mechanics 170151 Newtonrsquos Laws 170152 Forces 171153 Numerical Methods 173154 Work and Energy 174155 Lagrange Equations 176156 Three-Dimensional Particle Motion 180157 Impulse 181158 Oscillatory Motion 181159 Rotational Motion About a Fixed Axis 1851510 Torque and Angular Momentum 1871511 Motion in Accelerating Reference Systems 1881512 Gravitational Forces and Fields 1891513 Celestial Mechanics 1911514 Dynamics of Systems of Particles 1931515 Two-Particle Collisions and Scattering 1971516 Mechanics of Rigid Bodies 1991517 Hamiltonrsquos Equation and Kinematics 206
16 Fluid Mechanics 210161 Continuity Equation 210162 Eulerrsquos Equation 212163 Bernoullirsquos Equation 213
17 Special Relativity 215171 Four-Vectors and Lorentz Transformation 215172 Length Contraction Time Dilation and Simultaneity 217
x CONTENTS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
173 Covariant Notation 219174 Casuality and Minkowski Diagrams 221175 Velocity Addition and Doppler Shift 222176 Energy and Momentum 223
18 Electromagnetism 227181 Maxwellrsquos Equations 227182 Gaussrsquos Law 233183 Electric Potential 235184 Current and Resistivity 238185 Dipoles and Polarization 241186 Boundary Conditions and
Greenrsquos Functions 244187 Multipole Expansion 248188 Relativistic Formulation of Electromagnetism
Gauge Transformations and Magnetic Fields 249189 Magnetostatics 2561810 Magnetic Dipoles 2591811 Magnetization 2601812 Induction and Faradayrsquos Law 2621813 Circuit Theory and Kirchoffrsquos Laws 2661814 Conservation Laws and the Stress Tensor 2701815 LienardndashWiechert Potentials 2741816 Radiation from Moving Charges 275
19 Wave Motion 282191 Wave Equation 282192 Propagation of Waves 284193 Planar Electromagnetic Waves 286194 Polarization 287195 Superposition and Interference 288196 Multipole Expansion for Radiating Fields 292197 Phase and Group Velocity 295198 Minimum Time Principle and Ray Optics 296199 Refraction and Snellrsquos Law 2971910 Lenses 2991911 Mechanical Reflection 3011912 Doppler Effect and Shock Waves 3021913 Waves in Periodic Media 3031914 Conducting Media 3041915 Dielectric Media 3061916 Reflection and Transmission 3071917 Diffraction 3111918 Waveguides and Cavities 313
xiCONTENTS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
20 Quantum Mechanics 318201 Fundamental Principles 318202 ParticlendashWave Duality 319203 Interference of Quantum Waves 320204 Schroumldinger Equation 321205 Particle Flux and Reflection 322206 Wave Packet Propagation 324207 Numerical Solutions 326208 Quantum Mechanical Operators 328209 Heisenberg Uncertainty Relation 3312010 Hilbert Space Representation 3342011 Square Well and Delta Function Potentials 3362012 WKB Method 3392013 Harmonic Oscillators 3422014 Heisenberg Representation 3432015 Translation Operators 3442016 Perturbation Theory 3452017 Adiabatic Theorem 351
21 Atomic Physics 353211 Properties of Fermions 353212 Bohr Model 354213 Atomic Spectra and X-Rays 356214 Atomic Units 356215 Angular Momentum 357216 Spin 358217 Interaction of Spins 359218 Hydrogenic Atoms 360219 Atomic Structure 3622110 SpinndashOrbit Coupling 3622111 Atoms in Static Electric and Magnetic Fields 3642112 Helium Atom and the H +
2 Molecule 3682113 Interaction of Atoms with Radiation 3712114 Selection Rules 3732115 Scattering Theory 374
22 Nuclear and Particle Physics 379221 Nuclear Properties 379222 Radioactive Decay 381223 Nuclear Reactions 382224 Fission and Fusion 383225 Fundamental Properties of
Elementary Particles 383
xii CONTENTS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
23 Thermodynamics and Statistical Mechanics 386231 Entropy 386232 Ensembles 388233 Statistics 391234 Partition Functions 393235 Density of States 396236 Temperature and Energy 397237 Phonons and Photons 400238 The Laws of Thermodynamics 401239 The Legendre Transformation and
Thermodynamic Quantities 4032310 Expansion of Gases 4072311 Heat Engines and the Carnot Cycle 4092312 Thermodynamic Fluctuations 4102313 Phase Transformations 4122314 The Chemical Potential and Chemical Reactions 4132315 The Fermi Gas 4142316 BosendashEinstein Condensation 4162317 Physical Kinetics and Transport Theory 417
24 Condensed Matter Physics 422241 Crystal Structure 422242 X-Ray Diffraction 423243 Thermal Properties 424244 Electron Theory of Metals 425245 Superconductors 426246 Semiconductors 427
25 Laboratory Methods 430251 Interaction of Particles with Matter 430252 Radiation Detection and Counting Statistics 431253 Lasers 432
Index 434
xiiiCONTENTS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
1INTRODUCTION
Unique among disciplines physics condenses the limitlessly complex behavior ofnature into a small set of underlying principles Once these are clearly understoodand supplemented with often superficial domain knowledge any scientific or engi-neering problem can be succinctly analyzed and solved Accordingly the study ofphysics leads to unsurpassed satisfaction and fulfillment
This book summarizes intermediate- college- and university-level physics and itsassociated mathematics identifying basic formulas and concepts that should be under-stood and memorized It can be employed to supplement courses as a reference text oras review material for the GRE and graduate comprehensive exams
Since physics incorporates broad areas of science and engineering many treat-ments overemphasize technical details and problems that require time-consumingmathematical manipulations The reader then often loses sight of fundamental issuesleading to gaps in comprehension that widen as more advanced material is introducedThis book accordingly focuses exclusively on core material relevant to practical prob-lem solving Fine details of the subject can later be assimilated rapidly effectivelyplacing leaves on the branches formed by the underlying concepts
Mathematics and physics constitute the language of science Hence as with anyspoken language they must be learned through repetition and memorization The cen-tral results and equations indicated in this book are therefore indicated by shaded textThese should be rederived transcribed into a notebook or review cards with a sum-mary of their derivation and memorized Problems from any source should be solvedin conjunction with this book however undertaking time-consuming problems
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
without recourse to worked solutions that indicate optimal calculational procedures isnot recommended
Finally we wish to thank our many inspiring teachers whose numerous insightsguided our approach in particular Paul Bamberg Alan Blair and Sam Treiman andabove all our father and grandfather George Yevick whose boundless love of phys-ics inspired generations of students
2 INTRODUCTION
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
2PROBLEM SOLVING
Problem solving especially on examinations should habitually follow the proceduresbelow
21 ANALYSIS
1 Problems are very often misread or answered incompletely Accordingly circlethe words in the problem that describe the required results and underline thespecified input data After completing the calculation insure that the quantitiesevaluated in fact correspond to those circled
2 Write down a summary of the problem in your own words as concisely aspossible
3 Draw a diagram of the physical situation that suggests the general propertiesof the solution Annotate the diagram as the solution progresses Always draw
diagrams that accentuate the difference between variables eg when drawing
triangles be sure that its angles are markedly unequal
4 Briefly contrast different solution methods and summarize on the examinationpaper the simplest of these (especially if partial credit is given)
5 Solve the problem proceeding in small steps Do not perform twomathematical
manipulations in a single line Align equal signs on subsequent lines and check
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
each line of the calculation against the previous line immediately after writing
it down Being careful and organized inevitably saves time
6 Reconsider periodically if you are employing the simplest solution method If
mathematics becomes involved backtrack and search for an error or a different
approach
7 Verify the dimensions of your answer and that its magnitude is physically
reasonable
8 Insert your answer into the initial equations that define the problem and check
that it yields the correct solution
9 If necessary and time permits solve the problem a second time with a differentmethod
22 TEST-TAKING TECHNIQUES
Strategies for improving examination performance include
1 For morning examinations 1ndash3 weeks before the examination start the daytwo or more hours before the examination time
2 Devise a plan of studying well before the examination that includes severalreview cycles
3 Outline on paper and review cards in your own words the required materialCarry the cards with you and read them throughout the day when unoccupied
4 To become aware of optimal solution procedures solve a variety of problemsin books that provide worked solutions and rederive the examples in this oranother textbook Limit the time spent on each problem in accordance withthe importance of the topic
5 Obtain or design your own practice exams and take these under simulated testconditions
6 In the day preceding a major examination at most briefly review notesmdashstudies have demonstrated that last-minute studying does not on averageimprove grades
7 Be aware of the examination rules in advance On multiple choice examsdetermining how many answers must be eliminated before selecting one ofthe remaining choices is statistically beneficial
8 If allowed take high-energy food to the exam
9 Arrive early at the examination location to familiarize yourself with the testenvironment
10 First read the entire examination and then solve the problems in order of
difficulty
4 PROBLEM SOLVING
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
11 Maintain awareness of the problem objective sometimes a solution can beworked backward from this knowledge
12 If a calculation proves more complex than expected either outline your solu-
tion method or address a different problem and return to the calculation later
possibly with a different perspective
13 For multiple choice questions insure that the solutions are placed correctly onthe answer sheet Write the number of the problem and the answer on a pieceof paper and transfer this information onto the answer sheet only at the end ofthe exam Retain the paper in case of grading error
14 On multiple choice tests examine the possible choices before solving the
problem Eliminate choices with incorrect dimensions and those that lack
physical meaning Those remaining often indicate the important features ofthe solution and possibly may even reveal the correct answer
15 Maintain an even composure possibly through short stretching or controlledbreathing exercises
221 Dimensional Analysis
Results can be partially verified through dimensional analysis Dimensions such as thoseof force [MDT2] are here distinguished by square brackets where eg D indicateslength T timeM mass and Q charge Quantities that are added subtracted or equated
must possess identical dimensions For example a = vt is potentially valid since theright-hand side dimension of this expression is the product [DT][1T] which agrees withthat of the left-hand side Similarly the argument of a transcendental function (a function
that can be expressed as an infinite power series) such as an exponential or harmonic
function or of polynomials such as f(x) = x + x2 must be dimensionless otherwise dif-ferent powers would possess different dimensions and could therefore not be summed
While the dimensions of important physical quantities should be memorized thedimensions of any quantity can be deduced from an equation expressing this quantityin terms of variables with known dimensions Thus eg F =ma implies that [F] = [M][DT2] = [MDT2] Quantities with involved dimensions are often expressed in termsof other standard variables such as voltage
Example
From Q = CV the units of capacitance can be expressed as [QV] with V repre-senting volts Subsequently from V = IR with I = dQdt the dimensions of egt = 1RC can be verified
5TEST-TAKING TECHNIQUES
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
3SCIENTIFIC PROGRAMMING
This text contains basic physics programs written in the Octave scientific program-ming language that is freely available from httpwwwgnuorgsoftwareoctaveindexhtml with documentation at wwwoctaveorg Default selections can be chosenduring setup Octave incorporates many features of the commercial MATLABreg lan-guage and facilitates rapid and compact coding (for a more extensive introductionrefer to A Short Course in Computational Science and Engineering C++ Java andOctave Numerical Programming with Free Software Tools by David YevickCopyright copy 2012 David Yevick) Some of the material in the following text isreprinted with permission from Cambridge University Press
31 LANGUAGE FUNDAMENTALS
A few important general programming concepts as applied to Octave are first sum-marized below
1 A program consists primarily of statements that result from terminating a validexpression not followed by the continuation character hellip (three lower dots) acarriage return or a semicolon
2 An expression can be formed from one or more subexpressions linked byoperators such as + or
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
3 Operators possess different levels of precedence eg in 24 + 3 the divisionoperation possesses a higher precedence and is therefore evaluated before addi-tion In expressions involving two or more operators with the same precedencelevel such as division and multiplication the operations are typically evaluatedfrom left to right eg 24 3 equals (24) 3
4 The parenthesis operator which evaluates the expression that it encloses isassigned to the highest precedence level This eliminates errors generated byincorrect use of precedence or associativity
5 Certain style conventions while not required enhance clarity and readability
a Variables and function names should be composed of one or more descrip-tive words The initial letter should be uncapitalized while the first letter ofeach subsequent word should be capitalized as in outputVelocity
b Spaces should be placed to the right and left of binary operators which acton the expressions (operands) to their left and right as in 3 + 4 but no spaceshould be employed in unary operator such as the negative sign in minus3 + 4Spaces are preferentially be inserted after commas as in computeVelo-city( 3 4 ) and within parentheses except where these indicate indices
c Indentation should be employed to indicate when a group of inner statementsis under the logical control of an outer statement such as in
if ( firstVariable == 0 )secondVariable = 5
end
d Any part of a line located to the right of the symbol constitutes a commentthat typically documents the program Statements that form a logical unitshould be preceded by one or more comment lines and surrounded by blanklines Statement lines that introduce input variables should end with a com-ment describing the variables
311 Octave Programming
Running Octave Starting Octave opens a command window into which statementscan be entered interactively Alternatively a program in the directory programsin partition C is created by first entering cd Cprograms into the command win-dow pressing the enter key and then entering the command edit Statements arethen typed into the program editor the file is saved by selecting Save from the buttonor menu bar as a MATrix LABoratory file such as myFilem (the m extension isappended automatically by the editor) and the program is then run by typing myFileinto the command window The program can also be activated by including thestatement myFile within another program To list the files in the current directoryenter dir into the Octave command window
Help Commands Typing help commandName yields a description of thecommand commandName To find all commands related to a word subject type
7LANGUAGE FUNDAMENTALS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
lookfor subject Entering doc or doc topic brings up respectively a com-plete help document and a description of the language feature topic
Input and Output A value of a variable G can be entered into a program (m file)from the keyboard by including the line G = input( lsquouser promptrsquo ) The state-ment format long e sets the output style to display all 15 floating-point numbersignificant digits after which format short e reverts to the default 5 output digits
Constants and Complex Numbers Some important constants are i and j whichboth equal
ffiffiffiffiffiffiffiminus1
p e and pi However if a variable assignment such as i = 3 is
encountered in an Octave program i ceases to be identified with the imaginary unituntil the command clear i is issued Imaginary numbers can be manipulated withthe functions real( ) imag( ) conj( ) and norm( ) and imaginary values areautomatically returned by standard functions such as exp( ) sin( ) and sinh( )for imaginary arguments
Arrays and Matrices A symbol A can represent a scalar row or column vector ormatrix of any dimension Row vectors are constructed either by
vR = [ 1 2 3 4 ]
or
vR = [ 1 2 3 4 ]
The corresponding column vector can similarly be entered in any of the followingthree ways
vC = [ 1234 ]
vC = [ 1 2 3 4 ]vC = [ 1 2 3 4 ]rsquo
Here rsquo indicates transpose while rsquo instead implements the Hermitian (complex con-jugate) transpose
A 2 times 2 matrix
mRC=1 23 4
can be constructed by eg mRC = [ 1 2 3 4 ] after which mRC(1 2) returns(MRC)12 here the value 2 Subsequently size(mRC) yields a vector containingthe row and column dimensions ofmRC while length( mRC ) returns the maximumof these values Here we introduce the convention of appending R C or RC to thevariable name to respectively identify row vectors column vectors and matrices
8 SCIENTIFIC PROGRAMMING
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
Basic Manipulations A value n is raised to the power m by n^m The remainderof nm is denoted rem( n m ) and is positive or zero for n gt 0 and negative or zerofor n lt 0 The function mod( n m ) returns n modulus m which is always positivewhile ceil( ) floor( ) and fix( ) round floating-point numbers to the nextlarger integer smaller integer and nearest integer closer to zero respectively
Vector and Matrix Operations Two vectors or matrices of the same dimension canbe added or subtracted Multiplying a matrix or vector by a scalar c multiplies eachelement by c Additionally eye( n n ) is the n times n unit or identity matrix with onesalong the main diagonal and zeros elsewhere while ones( n m ) and zeros( nm )are n timesm matrices with all elements one or zeros so that
2+mRC=2ones 2 2eth THORN +mRC=3 45 6
and
2eye 2 2eth THORN +mRC=3 23 6
Further mRC mRC or equivalently mRC^2 multiplies mRC by itself while
mRC mRC=mRC^2=1 49 16
implements component-by-component multiplication Other arithmetic operationsfunction analogously so that the (i j) element of M N is MijNij Functions suchas cos( M ) return a matrix composed of the cosines of each element in M
Solving Linear Equation Systems The solution of the linear equation systemxR mRC = yR is xR= yR mRC while mRC xC = yC is solved by xC = mRC yCThe inverse of a matrix mRC is represented by inv( mRC ) The eigenvalues of amatrix are obtained through eigenValues = eig( mRC ) while both the eigenva-lues and eigenvectors are returned through [ eigenValues eigenVectors ] =eig( mRC )
Random Number Generation A single random number between 0 and 1 is gener-ated by rand while rand( m n ) returns a m times n matrix with random entries Thesame random sequence can be generated each time a program is run by includingrand( state 0 ) before the first call to rand
Control Logic and Iteration The logical operators in octave are == lt lt= gt gt= ~=(not equal) and the and or and not operatorsmdashamp | and ~ respectively Any nonzerovalue is taken to represent a logical ldquotruerdquo value while a zero value corresponds toa logical ldquofalserdquo as can be seen by evaluating eg 3 amp 4 which produces the output1 Thus
if ( S == 2 )xxx
elseif ( S == 3 )yyy
9LANGUAGE FUNDAMENTALS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
elsezzz
end
executes the statements denoted by xxx if the logical statement S == 2 is true yyy ifS == 3 and zzz otherwise The for loop
for loop = 10 -1 0vR(loop) = sin(loop pi 10 )
end
yields the arrayvR = [sin( π)sin(9π10)hellipsin( π10)0] while 1 10yields an array with elements from 1 to 10 in unit increments Mistakenly replacingcolons by commas or semicolons results in severe and often difficult to detect errorsIf a break statement is encountered within a for loop control is passed to thestatement immediately following the end statement An alternative to the for loopis the while (logical condition) hellip statements hellip end construct
Vectorized Iterators A vectorized iterator such as vR = sin( pi -pi10-1e-4 ) which yields generates or manipulates a vector far more rapidly than thecorresponding for loop linspace( s1 s2 n ) and logspace( s1 s2 n )produce n equallylogarithmically spaced points from s1 to s2 An isolated colonemployed as an index iterates through the elements associated with the indexso that MRC( 1) = V() places the elements of the row or column vector V intothe first column of MRC
Files and Function Files A function that returns variables output1 output2hellip is called [ output1 output2 hellip ] = myFunction( input1 input2 hellip )and normally resides in a separate file myFunctionm in the current directory thefirst line of which must read function [ aOutput1 aOutput2 hellip ] =myFunction( aInput1 aInput2 hellip ) Variables defined (created) inside afunction are inaccessible in the remainder of the program once the function terminates(unless global statements are present) while only the argument variables andvariables local to the function are visible from within the function A function canaccept other functions as an arguments either (for Octave functions) with thesyntax fmin( functionname a b ) or through a function handle (pointer)as fmin( functionname a b )
Built-In Functions Some common functions are the discrete forward and inverseFourier transforms fft( ) and ifft( ) and mean( ) sum( ) min( ) max( )and sort( ) Data is interpolated by y1 = interp1( x y x1 method )where method is linear (the default) spline or cubic x and y arethe input x- and y-coordinate vectors and x1 contains the x-coordinate(s) of thepoint(s) at which interpolated values are desired The function roots( [ 1 3 5 ] )returns the roots of the polynomial x2 + 3x + 5
Graphic Operations plot( vY1 ) generates a simple line plot of the values in therow or column vector vY1 while plot( vX1 vY1 vX2 vY2 hellip ) creates a sin-gle plot with lines given by the multiple (x y) data sets Hence plot( C g )
10 SCIENTIFIC PROGRAMMING
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
where C is a complex vector graphs the real against the imaginary part of C in greenwith point marker style Logarithmic graphs are plotted with semilogy( )semilogx( ) or loglog( ) in place of plot( ) Three-dimensional grid andcontour plots with nContours contour levels are created with mesh( mRC ) ormesh( vX vY mRC ) and contour( mRC ) or contour( vX vY mRCnContours ) where vX and vY are row or column vectors that contain the x andy positions of the grid points along the axes The commands hold on and holdoff retain graphs so that additional curves can be overlaid Subsequently axisdefaults can be overridden with axis( [ xmin xmax ymin ymax ] ) while axislabels are implemented with xlabel( xtext ) and ylabel( ytext ) andthe plot title is specified by title( title text ) The command print( outputFileeps -deps ) or eg print( outputFilepdf -dpdf ) yields respectively encapsulated postscript or pdf files ofthe current plot window in the file outputFiledat or outputFilepdf(help print displays all options)
Memory Management User-defined variable or function names hide preexisting orbuilt-in variable and function names eg if the program defines a variable or functionlength or length( ) the Octave function length( ) becomes inaccessibleAdditionally if the second time a program is executed a smaller array is assignedto an variable the larger memory space will still be reserved by the variable causingerrors when eg its length or magnitude is computed Accordingly each programshould begin with clear all to remove all preexisting assignments (a single con-struct M is destroyed through clear M)
Structures To associate different variables with a single entity (structure) namea dot is placed after the name as in
Spring1position = 0Spring1velocity = 1Spring1position = Spring1position + deltaTime km
Spring1velocity
Variables pertaining to one entity can then be segregated from those such asSpring2position describing a different object The names of structures areconventionally capitalized
11LANGUAGE FUNDAMENTALS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
4ELEMENTARY MATHEMATICS
The following treatment of algebra and geometry focuses on often neglected aspects
41 ALGEBRA
While arithmetic concerns direct problems such as evaluating y = 2x + 5 for x = 3algebra addresses arithmetical inverse problems such as the determination of x giveny = 11 above Such generalizations of division can be highly involved depending onthe complexity of the direct equation
411 Equation Manipulation
Since both sides of an equation evaluate to the same quantity they can be added tosubtracted from or multiplied or divided by any number or expression Therefore
a
b=c
deth411THORN
can be simplified through cross multiplication eg multiplication of both sides bybd to yield
ad = bc eth412THORN
Fundamental Math and Physics for Scientists and Engineers First EditionDavid Yevick and Hannah Yevickcopy 2015 John Wiley amp Sons Inc Published 2015 by John Wiley amp Sons Inc
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
Similarly the left hand of one equation can be multiplied or divided by the left-handside of a second equation if the right-hand sides of the two equations are similarlymanipulated (as the right and left sides of each equation by definition represent thesame value)
Example
Equating the quotients of the right- and left-hand sides of the following twoequations
3y x + 1eth THORN= 44 x + 1eth THORN= 2 eth413THORN
results in 3y4 = 2
412 Linear Equation Systems
An algebraic equation is linear if all variables in the equation only enter to first order(eg as x and y but not xy) At least N linear equations are required to uniquely deter-mine the values of N variables The standard procedure for solving such a system firstreduces the system to a ldquotridiagonal formrdquo through repeated implementation of a smallnumber of basic operations
Example
To solve
x+ y = 3
2x + 3y= 7eth414THORN
for x and y the first equation can be recast as x = 3 minus y which yields a single equa-tion for y after substitution into the second equation Alternatively multiplying thefirst equation by two results in
2x + 2y= 6
2x + 3y= 7eth415THORN
Subtracting the first equation from the second equation then gives
2x + 2y= 6
y = 1eth416THORN
The inverted pyramidal form is termed an upper triangular linear equation systemand can be solved by back-substituting the solution for y from the second equationinto the first equation which then solved for x
13ALGEBRA
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS
A set of equations can be redundant in that one or more equations of the set canbe generated by summing the remaining equations with appropriate coefficients Ifthe number of independent equations is less or greater than N infinitely many orzero solutions exist respectively Nonlinear equation systems can sometimes belinearized through substitution of new variables formed from nonlinear combina-tions of the original variables Thus defining w = x2 z = y3 recasts
x2 + 3y3 = 4
2x2 + y3 = 3eth417THORN
into the linear equations w + 3z = 4 2w + z = 3
413 Factoring
The inverse problem to polynomial multiplication is termed factoring That is multi-plication and addition yield
ax+ beth THORN cx + deth THORN= acx2 + bc+ adeth THORNx + bd eth418THORNwhich is reversed by factoring the right-hand side into the left-hand product of two lesserdegree polynomials For quadratic (second-order) equations the quadratic formulastates that the roots (solutions) of ax2 + bx + c = 0 are
x12 =minusb plusmn
ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffib2minus4ac
p
2aeth419THORN
implying that the polynomial ax2 + bx + c can be factored as (x minus x1)(x minus x2)Equation (419) is derived by first completing the square according to
ax2 + bx+ c= a x2 +bx
a
0
1A+ c
= a x2 +bx
a+
b2
4a2
0
1Aminus
b2
4a+ c
= a x+b
2a
0
1A2
minusb2minus4ac
4a
eth4110THORN
Multiplying N terms of the form (x minus λi) yields
xminusλ1eth THORN xminusλ2eth THORNhellip xminusλNeth THORN = xN + xNminus1Xi
λi + xNminus2Xi ji 6frac14j
λiλj +hellip+Yi
λi eth4111THORN
14 ELEMENTARY MATHEMATICS