100% found this document useful (10 votes)
123 views

Download ebooks file Applied Numerical Methods with MATLAB for Engineers and Scientists 2nd ed Edition Steven C. Chapra all chapters

Engineers

Uploaded by

ayroutjerine
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (10 votes)
123 views

Download ebooks file Applied Numerical Methods with MATLAB for Engineers and Scientists 2nd ed Edition Steven C. Chapra all chapters

Engineers

Uploaded by

ayroutjerine
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 85

Download the full version of the ebook at ebookfinal.

com

Applied Numerical Methods with MATLAB for


Engineers and Scientists 2nd ed Edition Steven C.
Chapra

https://ebookfinal.com/download/applied-numerical-methods-
with-matlab-for-engineers-and-scientists-2nd-ed-edition-
steven-c-chapra/

OR CLICK BUTTON

DOWNLOAD EBOOK

Download more ebook instantly today at https://ebookfinal.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Essential MATLAB for Engineers and Scientists Fourth


Edition Brian Hahn

https://ebookfinal.com/download/essential-matlab-for-engineers-and-
scientists-fourth-edition-brian-hahn/

ebookfinal.com

Physics for Scientists Engineers with Modern Physics


Douglas C. Giancoli

https://ebookfinal.com/download/physics-for-scientists-engineers-with-
modern-physics-douglas-c-giancoli/

ebookfinal.com

Essential C for Engineers and Scientists 2nd Edition Jeri


R. Hanly

https://ebookfinal.com/download/essential-c-for-engineers-and-
scientists-2nd-edition-jeri-r-hanly/

ebookfinal.com

Numerical Methods using MATLAB Gupta

https://ebookfinal.com/download/numerical-methods-using-matlab-gupta/

ebookfinal.com
Mathematical Methods for Mathematicians Physical
Scientists and Engineers 2nd Edition Jeremy Dunning-Davies

https://ebookfinal.com/download/mathematical-methods-for-
mathematicians-physical-scientists-and-engineers-2nd-edition-jeremy-
dunning-davies/
ebookfinal.com

Dictionary of Applied Math for Engineers and Scientists


1st Edition Emma Previato

https://ebookfinal.com/download/dictionary-of-applied-math-for-
engineers-and-scientists-1st-edition-emma-previato/

ebookfinal.com

C for Engineers and Scientists 3rd Edition Gary J. Bronson

https://ebookfinal.com/download/c-for-engineers-and-scientists-3rd-
edition-gary-j-bronson/

ebookfinal.com

Patent fundamentals for scientists and engineers 3rd ed


Edition Gordon

https://ebookfinal.com/download/patent-fundamentals-for-scientists-
and-engineers-3rd-ed-edition-gordon/

ebookfinal.com

Numerical Methods Third Edition Using MATLAB George


Lindfield

https://ebookfinal.com/download/numerical-methods-third-edition-using-
matlab-george-lindfield/

ebookfinal.com
CONTENTS
About the Aufhor iv

Prefoce xiii

Guided Tour xvii

PanrOur Modeling,Computers,
ond ErrorAnolysis I
l. I Motivofion I
1.2 Port Orgonizotion 2

CHAPTER
I
Mothemqticol Modeling, Numericol Methods,
ond Problem Solving 4
I . l A S i m p l eM o t h e m o t i c M
o lo d e l 5
1.2 Conservotion Lowsin Engineering ond Science 12
1.3 NumericolMethodsCoveredin ThisBook l3
P r o b l e m s1 7

CHAPTER2
MATLAB Fundomeniqls 20
2.1 TheMATIABEnvironmenl21
2.2 A s s i g n m e n t2 2
2.3 Mothemoticol Operotions 27
2.4 U s eo f B u i l t l nF u n c t i o n s3 0
2.5 Groohics 33
2.6 OtherResources36
2.7 CoseStudy:Explorotory DotoAnolysis 37
^ l l
rroblems JY

CHAPTER3
Progromming with MATTAB 42
3.1 M-Files43
3.2 InputOutput47
vl CONTENTS

3 . 3 S h u c t u r ePdr o g r o m m i n g5 l
3 . 4 N e s t i n go n d I n d e n t o t i o n6 3
3 . 5 P o s s i nF g u n c t i o nt os M - F i l e s 6 6
3.6 CoseStudy:BungeeJumperVelocity 71
Problems 75

4
CHAPTER
Roundoff qnd Truncotion Errors 79
4.1 ErrorsB0
4.2 RoundoffErrors 84
4.3 Truncotion Errors 92
,l03
4 . 4 T o t oNl u m e r i c oEl r r o r
4 . 5 B l u n d e r sM, o d e lE r r o r so, n d D o t oU n c e r t o i n t y1 0 8
,l09
Problems

.|11
PnnrTwo Roots
ondOptimizotion
2.1 Overview tll
2.2 Port Orgonizotion I 12

CHAPTER
5
Roois: Brocketing Methods I l4
5 . 1 R o o t si n E n g i n e e r i nogn d S c i e n c e I l 5
5 . 2 G r o p h i c oM l ethods I l6
5 . 3 B r o c k e t i nMg e t h o d so n d I n i t i oG
l u e s s e s1 1 7
5 . 4 B i s e c t i o n1 2 2
5 . 5 F o l s eP o s i t i o n 1 2 8
5.6 CoseStudv:Greenhouse Gosesond Roinwoter 132
,l35
Problems

CHAPTER
6
Roots: Open Methods | 39
6 . 1 S i m p l eF i x e d - P o ilnt ei r o t i o n 1 4 0
6 . 2 N e w t o n - R o p h s o1n4 4
6 . 3 S e c o nM t ethods 149
6.4 MATLAB F u n c t i o nf :z e r o r 5 1
6 . 5 P o l v n o m l o l s1 5 4
6 . 6 C o s eS t u d yP : i p eF r i c t i o n 1 5 7
Problems 162
CONTENTS Yrt

7
CHAPTER
Optimizofion 166
7.1 Introduciion ond Bockground 167
7 . 2 O n e - D i m e n s i o n o l O p t i m i z o t i1o7n0
7 . 3 M u l t i d i m e n s i o n o l O p t i m i z o t i1o7n9
7 . 4 C o s eS t u d yE : q u i l i b r i uomn d M i n i m u mP o t e n t i oEln e r g y l 8 l
P r o b l e m s1 8 3

,|89
PrnrTxnrr LineorSystems
3.1 Overview 189
3.2 Port Orgonizotion l9l

CHAPTER
8
Lineqr Algebroic Equofions ond Motrices | 93
8.1 MotrixAlgebroOverview 194
with MATLAB 203
8.2 SolvingLineorAlgebroicEquotions
8.3 CoseStudy:Currentsond Voltogesin Circuits 205
Problems 209

9
CHAPTER
Gouss Eliminotion 212
l u m b e r so f E q u o t i osn 2 1 3
9 . 1 S o l v i n gS m o l N
9 . 2 N o i v eG o u s sE l i m i n o t i o n2 1 8
9.3 Pivoting225
9 . 4 T r i d i o g o n oSly s t e m s2 2 7
9.5 CoseStudy:Model of o HeotedRod 229
Problems 233

IO
CHAPTER
[U Foctorizotion 236
l 0 . l O v e r v i e wo f l U F o c t o r i z o t i o n2 3 7
1 0 . 2 G o u s sE l i m i n o t i oons l U F o c t o r i z o t i o n2 3 8
1 0 . 3 C h o l e s kFy o c t o r i z o t i o n2 4 4
'l0.4
MATLABLeftDivision 246
Problems 247
vIt! CONIENTS

CHAPTERI I
Motrix lnverse ond Condition 249
1 i .l TheMotrix lnverse 249
I I .2 ErrorAnolysisond SystemCondition 253
I 1 . 3 C o s eS t u d yI:n d o o rA i r P o l l u t i o n2 5 8
Problems 261

CHAPTER
I2
Iterotive Methods 264
l2.l LineorSystems: Gouss-Seidel264
,l2.2
r y s t e m s2 7 0
N o n l i n e oS
1 2 . 3 C o s eS t u d vC : h e m i c oRl e o c t i o n s2 7 7
P r o b l e m s2 7 9

PtrnrFoun CurveFitting 281


4.1 Overview 281
4.2 Port Orgonizotion 283

CHAPTER
I3
Lineor Regression 284
1 3 . I S t o t i s t i cRse v i e w 2 8 6
1 3 . 2 L i n e o Lr e o s t - S q u oR r eesg r e s s i o n2 9 2
,l3.3
L i n e o r i z o t i o nf N o n l i n e oR
r e l o t i o n s h i p3s0 0
1 3 . 4 C o m p u t eAr p p l i c o t i o n s3 0 4
1 3 . 5 C o s eS i u d y E : n z y m eK i n e t i c s 3 0 7
^ l l
rroDtems 5 | z

CHAPTER
I4
Generol lineqr Leosf-Squores qnd Nonlineqr Regression 316
1 4 .I P o l y n o m i o Rle g r e s s i o n3 16
1 4 . 2 M u l t i p l eL i n e oR r e g r e s s i o n3 2 O
1 4 . 3 G e n e r oLl i n e oLr e o sSt o u o r e s 3 2 2
14.4 QR Foctorizotion ond the Bockslosh Ooerotor 325
1 4 . 5 N o n l i n e oR r e g r e s s i o n
3 2 6
1 4 . 6 C o s eS l u d y F : i t t i n gS i n u s o i d s3 2 8
h l l
rrontcms . 1 . 1/
CONIENIS

'I
5.'l lntroduction
to Interpotofion336
I5.2 NewronInterpoloring polynomiol
33g
j: .j tosron9etnrerpoloring polynomiol
347
rJ.4 tnversetnterpolotion
350
I J.J txkopolotion o n d O s c i l l o t i o n s3 5 1
Problems 355

t6
cHAPTER
Splines ond piecewise Inferpofofion
359
I 6 . I l n k o d u c t i otno S p l i n e s
359
l o . z L i n e aSr p l i n e s3 6 1
1 6 . 3 Q u o d r o i i cS p l i n e s
365
1 6 . 4 C u b i cS p l i n e s 3 6 8

l9: liTewiseInrerpotorion
i 6.6 Multidimensionol
inMATLAB 374
Interpolotion 37g
l6 Z CoseStudy:HeotTronsfer
3g2
rrobtems 386

PnnrFvr Infegrotion
ond Differentiotion3g9
5.1 Overview 3g9
5.2 Port Orgonizotion
39O
!H,\PTER| 7
Numericof fnfegrofion Formutos
'l Sg2
Z.J lnhoduction ond Bocrground 393
I7.2 Newton-Cotes Formutos 396
17.3 TheTropezoidol Rule 39g
1 7 . 4 S i m p s o n ,Rsu l e s 4 0 5
17.5 Higher-Order Newfon_Cotes Formulos 4j j
l7 6 lntegration with UnequolSegments 412
17.7 OpenMerhods 416
I 7 8 M u h , p l eI n t e g r o l s
4j 6
CompuringWork wirh Numericol
;lJ;:r";udy: lnregrorion 4j9
t
I
!
t
I

i{. Numericof Integrotion


'l of Functions
8.I Introducfion 426
1 8 . 2 R o m b e r Iqn i e q r o t i o n
427
CONTENTS

1 8 . 3 G o u s sQ u o d r o t u r e4 3 2
I 8 . 4 A d o p t i v eQ u o d r o t u r e4 3 9
I8.5 CoseStudy:Root-Meon-Squore Current 440
Problems 444

CHAPTER
I9
Numericql Differentiqtion 448
19.I Inhoduction ond Bockground 449
19.2 High-Accurocy Differentiotion Formulos 452
I9.3 R i c h o r d s oEnx t r o p o l o t i o n4 5 5
,l9.4
Derivotives of UnequollySpocedDoto 457
,l9.5
Derivotivesond lntegrolsfor Dofo with Errors 458
19.6 PortiolDerivotives 459
I9.2 NumericolDifferentiotion with MATLAB 460
I 9 . 8 C o s eS t u d yV : i s u o l i z i nFgi e l d s 4 6 5
Problems 467

Pnnr5x OrdinoryDifferentiol
Equotions473
6.1 Overview 473
6.2 Porl Orgonizofion 477

CHAPTER
20
Initiol-Volue Problems 479
20.I Overview 481
20.2 EuleisMethod 481
20.3 lmprovemenlsof Euler'sMethod 487
20.4 Runge-KutfoMethods 493
20.5 Systemsof Equotions 498
20.6 CoseStudy:Predotory-PreyModelsond Choos 50A
Problems 509

CHAPTER
2I
Adopfive Merhods ond Stiff Systems 514
21 .'l AdoptiveRunge-Kutto Methods 514
2l .2 MultistepMethods 521
2l .3 Stiffness525
2l .4 MATLAB A p p l i c o t i o nB: u n g e Je u m p ew
r i t hC o r d 5 3 1
2l .5 CoseStudy:Pliny'slntermittent Fountoin 532
r r o D l e m s3 J /
CONTENTS xl

22
CHAPTER
Boundory-Volue Problems 540
22.1 lntrodvction ond Bockground 541
22.2 lhe ShootingMethod 545
22.3 Finite-Difference Methods 552
P r o b l e m s5 5 9

APPENDIXA: EIGENVALUES
565
APPENDIXB: MATLABBUILT-INFUNCTIONS 576
APPENDIX€: MATIAB M-FltE FUNCTIONS 578
BIBLIOGRAPHY579
rNDEX 580
Modqling,CoTpute''i,
qnd Erior Anolysis

t.t MoTtvATtoN
What are numericalmethodsand why shouldyou stridythem?
Numericalmethodsare techniquesby which mathematicalproblemsare formulatedso
that they can be solved with arithmeticand logical operations.Becausedigital computers
excel at perform.ingsuchoperations.numericalmethodsare sometimesreferredto as com-
puter mathematics.
In the pre-computerera, the time and drudgeryof implementingsuchcalculationsse.--
riously limited their practical use. However, with the advent of fast, inexpensivedigttul
computers,the role of numerical methodsin engineeringand scientific problem solving
has exploded.Becausethey figure so prominently in,:'
much of our work, I believe that numerical methods
should be a part of every engineer'sand scientist's
basic education.Just as we a.ll must have solid foun-
dationsin the other areasof mathematicsand science,
we should also have a fundamentalunderstandingof
numerical methods.In particular,we should have a
solid appreciationof both their capabilitiesand their
limitations.
Beyond contributing to your overall education.
.thog T9 several additibnat reasons why you shoutO
study numerical methods: .",,,,rr,,,r,,,r,,,,,,

1. Numerical methods greatly expqld the types of ,


problems you can address.They are capableof
handlinglarge systemsof equations.nonlineari-
, , d.l, and complicated geometriesthat are not un-
common in engineeringand scienceand that are
often impossibleto solve analyticallywith stan-
dard calculus.As such"they greatlyenhanceyour
problem-solving skills.
2. Numorical methods allow you to use "canned"
so-ftwarewith insight. During your career,you will
q*"
AND ERROR
PARTI MODELING,COMPUTERS, ANALYSIS

invariablyhave occasionto use commerciallyavailableprepackaged computerpro-


grarnsthat involve numericalmethods.The intelligentuseof theseprogramsis greatly
enhancedby an understandingof the basic theory underlyingthe methods.In the ab-
senceof suchunderstanding,you will be left to treat suchpackagesas "black boxes"
with little critical insightinto their inner workingsor the validity of the resultsthey
produce.
3. Many problemscannotbe approachedusing cannedprograms.If you are conversant
with numerical methods,and are adept at computer programming,you can design
your own programsto solveproblemswithouthavingto buy or commissionexpensive
software.
4. Nr.rrnericalmethodsare an efficient vehiclefbr learningto usecomputers.Becausenu-
mericalmethodsale expresslydesignedfor computerimplementation,they areidealtbr
illustratingthe conrputer'spowers and limitations.When you successfullyimplement
numericalmethodson a computer,and then apply them to solve otherwiseintractable
problenrs,you will be plovided with a dramaticdernonstrationof how computerscan
serveyour professionaldevelopment.At the sarnelime, you rvilI alsolearnto acknowl-
edge and control the errors of approximationthat are part and parcel of large-scale
numericalcalculations.
5. Numericalmethodsprovidea vehiclefbr you to reinforceyour understandingof math-
ernatics.Becauseone tunction of numericalmethodsis to reducehigher mathematics
to basic arithmetic operations.they get at the "nuts and bolts" of some otherwise
obscuretopics. Enhancedunderstandingand insight can result from this alternative
perspective.

how numerical
With thesereasonslls motivation.we can now set out to understand
methodsand digital computerswork in tandemto generatereliablesolutionsto mathemat-
ical problems.The remainderof this book is devotedto this task.

1.2 PARTORGANIZATION

This book is divided into six parts.The latter five partsfocus on the major areasof numer-
ical methods.Although it might be temptingto jump right into this material,Part One con-
sistsof four chaptersdealng with essentialbackgroundmaterial.
Chapter 1 providesa concreteexampleof how a numericalmethodcan be employed
to solve a real problem. To do this, we develop tt muthematicalmodel of a fiee-falling
bungeejumper. The model, which is basedon Newton's secondlaw, resultsin an ordinary
differentialequation.After first using calculusto developa closed-formsolution,we then
show how a comparablesolution can be generatedwith a simple numerical method.We
end the chapterwith an overview of the major areers of numericalrnethodsthat we cover in
PartsTwo throughSir.
Chapters2 and 3 provide an introduction to the MATLAB' software environment.
Chapter2 dealswith the standardway of operatingMATLAB by enteringcommandsone
at a time in the so-calledt'alculatornuttle.Thisinteractivemodeprovidesa straightforward
meansto orient you kl the enviroumentand illustrateshow it is usedibr common opera-
I.2 PART
ORGANIZATION

Chapter-l shows how MATLAB's programming mode providesa vehicle for assem-
bling individualcommandsinto algorithms.Thus,our intentis to illustratehow MATLAB
servesas a convenientprogrammingenvironmentto developyour own software.
ChapterI dealswith the irnportanttopic of error analysis,which must be understood
for the effective use of numerical methods.The first part of the chapterfocuseson the
roundoJferrors thar result becausedigital computerscannot representsome quantities
truncationerrctrsthat arisefiom using an approximation
exactly.The latter part addresses
in place of an exactmathematicalprocedure.
{.1:i

ffilT** i.t "


i'i,r

TFi + I r,if i

..,,lrfi;
U1
I

MothemoticolModeling,
NumericolMethods,
ond ProblemSolving

4
CHAPTER
OBJECTIVES
r
The prirnary objectiveof this chapteris to provide you with a concreteidea of what
numericalmethodsare and how they relateto engineeringanclscientificproblem 1
solving. Specificobjectivesand topicscoveredare
o Learning how mathematicalmodelscan be formulatedon the basisof scientific FIG
principlesto simulatethe behaviorof a simplephysicalsystem. For
f-^^ l
I cc-
r Understandinghow numericalmethodsirlford a meansto generatesolutionsin a
rnannerthat can be irnplementedon a digital computer.
ium
o Understandingthe different typesof conservationlaws that lie beneaththe models
usedin the variousengineeringdisciplinesand appreciatingthe diff'erence
betweensteady-state irnd dynamic solutionsof thesemodels.
r Learning aboutthe difterent typesof numericalmethodswe will cover in this
book.

YOU'VE GOT A PROBTEM


upposethat a bungee-jumpingcompanyhires you. You're given the task of predict-
ing the velocity of a jumper (Fig. l.l ) as a function of time during the free-fall part
of thejump. This inlbrmationwill be usedaspart of a largeranalysisto determinethe
length and requiredstrengthof the bungeecord for jumpers of differentmass
You know from your studiesofphysics that the accelerationshouldbe equalto the ratio
of the tbrceto the mass(Newton'ssecondlaw). Basedon this insightandyour knowledge
I .I A SIMPTE
MATHEMATICAL
MODEL

Upwardforce of fluid mechanics,you developthe following mathematicalmodel for the rate of change
d u et o a i r o l ' v e l o c i t yr . r ' i t rhe s p e ctto t i m e .
resistance

t ducd.
dt''m

where rr : vertical velocity (n/s). r : time (s), g : the accelerationdue to gravity


(:9.81nls21, ca: a second-orderdrag coetficient (kg/m), and m: the jumper's
mass(kg).
Becausethis is a ditlerentialequation,you know that calculusmight be usedto obtain
an analyticalor exactsolutionfor u as a function of /. However,in the following pages,we
will illustrate an alternativesolution approach.This will involve developinga con.rputer-
orientednumericalor approximatesolution.
til
Aside from showing you how the computercan be usedto solve this particularprob-

vtil
Downward
lem, our more generalobjective will be to illustrate (a) what numericalmethodsare and
(b) how they figure in engineeringand scientificproblen solving.In so doing, we will also
forcedue show how mathematicaln.rodels figure prominentlyin the way engineersand scientistsuse
to gravrty numericalmethodsin their work.

flGUREl.l
Forces
ociingon o
lreeJolling
bungee
iumpet.

I.l A SIMPTEMATHEMATICAT
MODET
A motlrcnntical ntodelcan be broadly definedas a tbrmulation or equationthat expresses
the essentialfeaturesof a physicalsystemor processin mathematicalterms.In a very gen-
eral sense,it can be representedas a functionalrelationshipof the fonn

D e o e n d e n ( - / i n d e' .n,e, n c l e n t forcine \


.v.a' .n.a. ,o_l e, : J [ v a n a D t e s. p u r a n ) e t el rusn.c t l o n s| (l.l)
\ ,f

where the de;tendentvariable is a characteristicthat usually reflectsthe behavioror state


of the system:-the independetttvariablesare usually dimensions.such as time and space,
along which the system'sbehavioris beingdetermined;theparametersareretlectiveof the
system'sproperliesor composition;and thelbrring.functiottsareexternalintluencesacting
upon it.
The actual mathematicalexpressionof Eq. (1.1) can range from a sirnple algebraic
relationshipto largecomplicatedsetsof diff-erentialequations.For example,on the basisof
his observations,Newton formulatedhis secondlaw of motion, which statesthat the time
rateof changeof momentumof a body is equalto the resultantforce actingon it. The ntath-
ematicalexpression,or model,of the secondlaw is the well-known equation
F:ma (t.2)
whereF is the net force actingon the body (N, or kg nls"), m is the n.rass
of the object(kg),
a n dc i i s i t s a c c e l e r a t i o(nr n / s : ) .
6 MODELING,NUMERICAL
MATHEMATICAL METHODS,
AND PROBLEM
SOLVING

The secondlaw can be recastin the format of Eq. ( 1.l) by merely dividing both sides
by m to give
F
(1.-31
n1

where a is the dependentvariablereflecting the system'sbehavior,F is the forcing func-


tion, and nr is a parameter.Note that for this simple casethereis no independentvariable
becausewe are not yet predictinghow accelerationvariesin time or space.
Equation( 1.3)has a numberof characteristics that aretypical of mathematicalmodels
of the physicalworld.
. It describesa naturalprocessor systemin mathematicalterms.
. It represents an idealizationand sirnplificationof reality.That is. the model ignoresneg-
ligible detailsof the naturalprocessand focuseson its essentialmanif'estations. Thus,
the secondlaw doesnot include the effects of relativity that are of minimal importance
when appliedto objectsand forcesthat interacton or aboutthe earth'ssurfaceat veloc-
ities and on scalesvisible to humans.
. Finally, it yields reproducibleresultsand,consequently, can be usedfbr predictivepur-
poses.For example,if the force on an object and massare known, Eq. ( 1.3)can be
its
usedto compLlteacceleration.

Becauseof its simple algebraicform, the solution of Eq. (1.2) was obtainedeasily.
However,other mathernaticalmodelsof physicalphenomenamay be much more complex.
and either cannotbe solvedexactly or requiremore sophisticatedmathematicaltechniques
than simple algebrafor their solution.To illustrate a more complex model of this kind,
Newton's secondlaw can be usedto determinethe terminal velocity of a free-fallingbody
nearthe earth'ssurface.Our falling body will be a bungeejumper (Fig. 1.1).For this case,
a model can be derived by expressingthe accelerationas the time rate of changeof the
r,'elocity(tluldr) and substitutingit into Eq. (1.3)to yield
duF
(1.4)
dt nr
where u is velocity (in metersper second).Thus, the rate of changeof the velocity is equal
to the net force acting on the body normalizedto its mass.If the net force is positive,the
object will accelerate.Ifit is negative.the objectwill decelerate.Ifthe net force is zero,the
object'svelocity will remain at a constantlevel.
Next, we will expressthe net force in terms of measurablevariablesand parameters.
For a body talling witlrin the vicinity of the earth,the net force is composedof two oppos-
ing forces: the downward pull of gravity Fp and the upward force of air resistanceFy
(Fig.1.1):

F: Fol Fti (1 . 5 )

If force in the downward direction is assigneda positive sign, the secondlaw can be
u.sedto formulatethe force due to pravity as
Fo:m8 (1.6)

due to gravity(9.81m/s2).
whereg is the acceleration
I .I A SIMPLE
MATHEMATICAL
MODEI. 7

Air resistancecan be fbrmulatedin i.ivariety of ways. Knowledge from the scienceof


fluid ntechanics suggests thata gtrodfirst approxirrration
wouliJbe to assumethat it is pro-
portional to the squareof the velocitl,,
- l
f U: -cdr)' (1.7)

where r',1is a proporticlnalitvconstantcalled the drag coefticient(kg/m). Thus. the greater


the fall velocity, the greaterthe uprvardfbrce due to air resistance.The parameterc./ ac-
countslbr propertiesofthe ialling object,suchas shapeor surfaceroughness,that affect air
resistance.For the presentc&s€,c,7might be a function of the type of clothing or the orien-
tationusedby thejumper duringfree tall.
The rlet fbrce is the differencebetweenthe downward and upwi.rrdforce. Therefbre,
t h r o u g h( 1 . 7 )c a nb e c o m b i n e dt o y i e l d
E q s .1 1 . 4 1

dt: ctt t
-,5 (1.8)
,
dt tn

Ecluation(1.8) is a ntodelthat relatesthe accelerirtion of a falling objectto the tbrces


actingon it. It is a tli/Jerentialequtttiortbecauseit is written in terntsof the differentialrate
of change(d uI dt 1 of the variablethat we are interestedin predicting.However,in contrast
to the solutionof Newton'ssecondlaw in Eq. ( 1.3),the exactsolutionof Eq. ( 1.8)for the
velocity of the jumper cannot be obtirinedusing simple algebraicmanipulation.Rather,
more adt'ancedtechniquessuchas thoseof calculusnrustbe appliedto obtainan exactor
analyticalsolution.For example,if thejumper is initially at rest(r.,: 0 at / : 0), calculus
can be usedto solveEq. ( 1.8)for

:r,ff*"n(
u(/) ,8,) yilt /
(1.9)

where tanh is the hyperbolic tangent that can be either computed directlyr or via the more
elementary exponential function as in

e' - e-'
tanh-t: (1.10)
e . ,* e \

Note that Eq. ( 1.9)is castin the generalfbrm of Eq. (1.1)wheret,(/) is the dependent
variable.t is the independentvariable, ctt andm areparameters,
andg is theforcing function.

EXAMPLE
I .I A n o l y t i c o lS o l u t i o nt o t h e B u n g e eJ u m p e rP r o b l e m

ProblemStotement. A bungeejumper with a massof 68.1kg leapsliom a stationaryhot


air balloon.Use Eq. ( 1.9)to computevelocityfbr the first l2 s of fiee fall. Also deterr-nine
the terminal velocity that will be attainedfbr an infinitely long corcl(or alternatively,the
jumprrasteris havinga particuiarlybad dayl).Use a dragcoefticientof 0.25kg/m.

I MATLABG'allows
d i r e c rc a l c u l a t i o no f t h e h y p c r b o l i ct a n g e n vt i a t h c b u i l t - i nf u n c t i o nr d n h ( r ) .
MATHEMATICAL
MODELING,NUMERICAL
METHODSAND PROBTEM
SOLVING

Solution. Insertingthe parameters


into Eq. (1.9)yields

which can be usedto compute

t, 3 u,mfs

0 o
2 I B 72,92
4 33I I tB
6 42 4762
B 46 9575
t0 4 S4 2 t4
12 50 6175
516938

According to the model, the jumper acceleratesrapidly (Fig. 1.2). A velocity of


49.4214m/s (about 110mi/h) is attainedafter 10 s. Note also that after a sufficiently lons

FIGUREI.2
Theonolyticol
solution
forthebungee problem
iumper oscompured
in Exomple
I 1 Velociry
increoseswith time ond osympfoiicolly
opproocheso terminolvelociiy.
] .I A SIMPLE
MATHEMATICAL
MODEL 9

time, a constantvelocity.called the terminol velocitt',of 51.6983m/s (115.6mi/h) is


reached.This velocity is constantbecause,eventually,the force of gravity will be in bal-
Thus. the net force is zero and accelerationhas ceased.
ancewith the air resistance.

Equation( I .9) is called an anabtical or closed-formsolution becauseit exactly satis-


fies the oliginal diffbrentialequation.Unfortunately,tlrereare mirny matlrematicalnrodels
that cannotbe solved exactly.In many of thesecases,the only alternativeis to develop a
numericalsolutionthat approximatesthe exact solution.
Nttntericalntethodsare thosein which the mathemirticalproblerr is refbrmulatedso it
can be solvedby arithmeticoperations.This can be illustratedfor Eq. ( 1.8) by realizingthat
the time tateof changeof velocitycan be approximated by (Fig. 1.3):

dtt- Au u ( / i + r -) u ( t i )
- : - : Lt
dt ti+t - ti
(r.lr)

whereAu and At aredifferences in velocityand time computedoverflnite intervals,u(r1)


is velocity at an initial time ri, and u(ria;) is velocityat somelater time f11. Note that
du ldt = Lu I Lt is approximate becauseAr is flnite.Rememberfrom calculusthat
dtt
- Au
lim
dt A1+l) N
Equation( l. I I ) represents
the reverseprocess.

FIGURE I.3
Theuseof o finitedifference
to opproximote
thefirsfderlvotive io /
of u wifhrespect

AU

Approximateslope
-u(r,)
Ar_u(1,*,)
Lt li+t - ti
to MATHEMATICAL
MODELING,NUMERICAL
MEIHODS,AND PROBLEM
SOLVING

Equation( 1.1I ) is calleclaJinite-diJJeren.ce


opprcrirnationof the derivativeJt Iirnc /, .
It can be substituted into Eq. (1.8)to give

r'(1,,1)-u(t,l .J
:g _ _ t . t / 7 ) )-
tr+t * t; tn.

This equationcan then be rearrangecl


to yielcl

) : u(/i)-1_ - 9lrt,,ff(/,+r - /i)


u(/i+r ( r .r 2 )
[r
Notice that the tenn in bracketsis the right-handside of the diff'erentialequationitself
tEq. (1.8)1.That is, it providesa meansto computethe rateof changeor slopeof u. Thus,
the equat.ioncan be rewritten as

u i + :r r + ' ! u (t.13)
{1t

wherethe nomenclature u; clesignates velocityattinle /i and At : ti+t - ti.


We cannow seethat thedifferentialequationhasbeentransformedinto an equationthat
canbe usedto determinethe velocityalgebraically at ri+l usingthe slopeandpreviousval-
uesof u andt. If you aregivenan initial valuefor velocityat sometime l;, you caneasilycom-
putevelocityat a latertime f 11. This new valueof velocityat l;11canin tum be employedto
extendthe cornputationto velocityat l;12 and so on. Thus at any time along the way,

New valne: old vahle* slopex stepsize

This approachis tbrnrally calledEuler's metlnd. We'll discussit in more detail when we
turn to diff'erentialequationslater in this book.

E X A M P L E1 . 2 N u m e r i c o lS o l u i i o nt o t h e B u n g e eJ u m p e rP r o b l e m
' P r o b l e mS t o i e m e n t . P e r f o r mt h es a m ec o r n p L l t a t i o
ansi n E x a m p l e1 . 1 b u tu s eE q . ( J . 1 3 )
to colnputevelocitywith Euler'smethod.Employ a stepsizeof 2 s fbr the calculation.

Solution. At the startof the computation(/{):0), the velocity of the jumper is zero.
Using this infbrmationand the parameter
valuesfrom ExampleI . I , Eq. ( 1.13)can be used
to corxputevelocityat 11- 2 s:

r,: o* fr.r' - H,o,rl x 2 : te.62rls


L 68.r I

For the next interval lfiom r : 2 b 4 sJ,the colnplrtationis repeated,with the result

l- 0.2s .1
: l ( ) . 6 2+ 1 9 . 8 1- , ( 1 9 . 6 2 t - l " l:16.4117m/s
L 68.t r
I .1 A SIMPLE
MATHEMATICAL
MODEL tt

Terminalvelocity

F I G U R EI . 4
Compcrison of thenumericol
ond onclyticol for thebungeeiumperproblem
solutions

The calculationis continuedin a similar fashionto obtain additionalvalues:

ttS u, m/s

0 0
2 r9.6200
4 36.4137
6 46 2983
B 50 r802
r0 5t 3123
l2 5 r 6008
oo 5r 6938

The resultsare plotted in Fig. 1.4 along with the exact solution.We can seethat the nu-
merical methodcapturesthe essentialfeaturesof the exact solution.However,becausewe
have employed straighfline segmentsto approximatea continuouslycurving function,
there is some discrepancybetweenthe two results.One way to minimize such discrepan-
ciesis to usea smallerstepsize.Forexample,applyingEq. (1.13)at 1-sintervalsresultsin
a smaller error, as the straighrline segmentstrack closerto the true solution.Using hand
calculations,the effort associatedwith using smaller and smaller step sizeswould make
such numerical solutionsimpractical.However, with the aid of the computer,large num-
bers of calculationscan be performedeasily.Thus, you can accuratelymodel the velocity
of thejumper without having to solve the differentialequationexactly.
r2 MATHEMATICAL
MODELINGNUMERICAL
METHODS,
AND PROBLEM
SOLVING

As in Example 1.2,a cornputationalprice nrustbe paid for a nroreaccuratenumerical


result.Each halving of the stepsize to attainmorc accuracyleadsto a doubling of the nurn-
ber of computations.Thus, we seethat thereis a trade-offbetweenaccuracyand computa-
tional effort. Such trade-offsfigure prominently in numerical methodsand constitutean
importantthemeof this book.

L/AWSlN ENGINEERING
1.2 CONSERVATION AND SCIENCE
Aside from Newton's secondlaw. there are other major organizingprinciples in science
and engineering.Among the most importantof theseare the conserv,ationlan:s.Although
they form the basis for a variety of complicatedand powerful mathematicalmodels, the
great conservationlaws of scienceand engineeringare conceptuallyeasy to understand.
They all boil down to
- decreases
Change: increases (1.r4)
This is preciselythe fbrmat that we empioyedwhen using Newton'slaw to developa force
balancefor the bungeejumper tEq. ( 1.8)1.
Although simple,Eq. (1.14)embodiesone of the most fundarnentalways in which
conservation laws are used in engineering and science-that is. to predict changes
with respect to time. We will give it a special name-the time-variable (or transient)
computation.
Aside from predictingchanges,anotherway in which conservationlaws are appliedis
fbr caseswherechangeis nonexistent. If changeis zero,Eq. (I.14) becomes
-
Change: 0 : increases decreases
or
Increases: decreases (1.r5)
Thns, ifno changeoccurs,the increasesanddecreases nrustbe in balance.This case,which
is also given a specialnarne-the stea(ly-state
calculation-has many applicationsin engi-
neeringand science.For example,fbr steady-state incompressiblefluid flow in pipes,the
flow into a junction musl be balancedby flow going out. as in
Flow in : flow out
For the junction in Fig. I .5, the balancecan be used to computethat the flow out of the
fourth pipe must be 60.
For the bungeejumper, the steady-state condition would correspondto the casewhere
the net lbrce was zeroor [Eq. (1.8) with du ldt : 0l
f
l1l$ : 6411- (1.r6)
Thus. at steadystate,the downwardand upwardfbrcesarein balanceand Eq. ( 1.| 6) can be
solvedfor the terminal velocity

AlthoughEqs.(1.14)and (1.15)might appeartriviallysimple,they embodythe two funda-


mentalways that conservationlaws areemployedin engineeringand science.As such,they
will tbnn an importantpart of our et-fortsin subsequent
chaptersto illustratethe connection
betweennumericalmethodsand engineeringand science.
I.3 NUMERICAL
METHODSCOVERED
IN THISBOOK r3

P i p e2
F l o wi n = 8 0

Pipe 1 Pipe 4
F l o wi n : 1 0 0 Flow out =

P i p e3
F l o wo u t : 1 2 0

F I G U R EI . 5
A f o w b o o n c ef o rs t e o d yi n c o m p r e s s ifbuei df l o t vo t t h ej u n c l i oonf p i p e s

Tablel. I summarizes somemodelsandassociated conservation lawsthatfigurepromr-


nently in engineering.Many chemical engineeringproblems involve mass balancesfor
reactors.The massbalanceis derived from the conservationof mass.It specifiesthat the
changeof mass of a chemical in the reactordependson the amount of mass flowing in
minus the n.rassflowing out.
Civil and mechanicalengineersoften focus on models developedfrom the conserva-
tion of momentum.Forcivil engineering,force balancesare utilized to analyzestructures
suchas the simple trussin Table 1.1.The sameprinciplesare employedfor the mechanical
engineeringcasestudiesto analyzethe transientup-and-downmotion or vibrations of an
automobile.
Finally.electricalengineeringstudiesen-rploy both currentandenergybalancesto model
electriccircuits.The currentbalance,which resultsfrom the conservationof charge,is simi-
lar in spirit to the flow balancedepictedin Fig. 1.5.Justasflow mnstbalanceat thejunction
of pipes,electriccurrentmust balanceat thejunction of electricwires.The energybalance
specifiesthat the clrangesof voltagearoundany loop of the circuit must add up to zero.
We shouldnotethattherearemanyotherbranches of engineeringbeyondchemical,civi,,
electrical,andmechanical.Many of theseale relatedto the Big Four.For exalnple,chemical
engineeringskills are usedextensivelyin areassuchas environmental,petroleum,and bio-
rnedicalengineering.Sirnilarly,aerospace engineeringhasmuch in cornmonwith mechani-
cal engineering.We will endeavorto includeexamplesfrom theseareasin the coming pages.

I.3 NUMERICAT
METHODSCOVERED
IN THISBOOK
We choseEuler's methodfor this introductorychapterbecauseit is typical of many other
classesof numericalmethods.In essence, most consistof recastingmathematical opera-
tions into the simple kind of algebraicand logical operationscompatiblewith digital com-
pllters.Figure 1.6 summarizesthe major areascoveredin this text.
l4 MATHEMATICAT
MODELING,NUMERICAT AND PROBLEM
METHODS, SOLVING

TABTEl.l Devicesond typesof boloncesfhotore commonlyusedin ihe four moiororeosof engineering.


For
eochcose,lhe conservotion
low on whichthe bolonceis bosedis specified.

Field Device OrganizingPrinciple MathematicalExpression

Chemical Conservation Mass balance: ffi


engineering of mass inort ourpur
ff_--*
Over a unit of time period
Amass:inputs-outputs

Civil I Conservation Forcebalance: +Fv


e n g in e e r ni g t of momentum
+
,,\ I
structyz -Fn * O+ +FH
\ I
ffi
?7fu. ,1m77,
V
-at/

At each node
I horizontalforces (FH)= o
I vertical forces (I'u) : 0

Mechanical Conservation Forcebalance: I Upward force


engineering of momentum I
lr=0
I
V Downward force

m Li = downward force - upward force

ilH3
Electrical Conservation C u r r e n tb a l a n c e :+ i ,
engineering of charge
For each node
I current (i) = 0

I'R'
Conservation Voltagebalance:
of energy a{A&-l
,-, -R2,Jr * z- -Y f
L--\A7\--J
i:R:
Around each loop
I emf's - I voltage drops for resistors

>6->a:0
I.3 NUMERICAL
METHODSCOVERED
IN THISBOOK r5

lal Part 2: Roots and optimization f(xl

Roots: Solve for.r so thatfi-r) = 0

Optimization:Solvefor x so that/'(r) = 0

Optima
lbl Part 3: Linear algebraic equations
f\x\
Giventhe a's and the b's.solve for the.r's
a ' , r xt a r 2 x . ab
=,
arrx, 1-a,x, = b2

lcl Part 4: Curve fitting

ldl Part 5: Integration and differentiation

Integration:Find the area under the curve

Differentiation:Find the slooe of the curve

lel Part 6: Differential equations

Given
dv Av
:
,h N:flt'Yl
solve for r as a function of r
.,Ii+r= -]'i+ "f(ti,yJAr

FIGURE
I.6
of thenumericol
Summory methods inthisbook.
covered
t6 MATHEMATICAL
MODELING,NUMERICAT AND PROBLEM
METHODS, SOLVING

Part Two dealswith two relatedtopics:root finding and optimization.As depictedin


Fig. 1.6a,root locotiorrinvolvessearchingfor the zerosof a function.In contrast,optimiza-
rion involvesdetermininga valueor valuesof an independentvariablethat correspondto a
"best" or optirnalvalue of a function.Thus, as in Fig. 1.6a, optimizationinvolvesidentify-
ing maximir and minima. Although somewhatdifferent approachesare used,root location
and optimizationboth typically arisein designcontexts.
Part Three is devotedto solving systemsof simultaneouslinear algebraicequations
(Fig. 1.6&).Such systernsare similar in spirit to l'ootsof equationsin the sensethat they are
concemedwith values that satisfy equations.However, in contrastto satistying a single
equatiou,a set of valuesis soughtthat simultaneously satisfiesa set of linear algebraic
equations.Suchequationsarisein a varietyof problemcontextsand in all disciplinesof en-
gineeriugand science.In particular,they originate in the mathenraticalmodeling of Jarge
systemsof interconnected elementssuchas structures,electriccircuits.and fluid networks.
However,they are also encounteredin other areasof numericalmethodssuchas curve tit-
l i n g l r n dd i f f e r e n t i ael q u u t i o n s .
As an engineeror scientist.you will often haveoccasionto fit curvesto datapoints.The
techniquesdevelopedfor this pulposecanbe dividedinto two generalcategories:regression
and interpolation.As describedin Part Four tFig. 1.6c'1, regressionis ernployedwherethere
is a significantdegreeof error associirted with the data.Experimentalresultsareoften of this
kind. For thesesituations.the strategyis to derivea singlecurve that representsthe general
trend of the datawithout necessarilymatchingany individualpoints.
In contrast,interpolutionis usedwherethe objectiveis to determineintermediateval-
ues betweenrelativelyerror-freedata points. Such is usually the casefor tabulatedinfor-
mation.The strategyin suchcasesis to flt a curve directly throughthe datapoints and r.rse
the curve to predict the intermediatevalues.
As depicted in Fig. 1.6d, Part Five is devoted to integlation and differentiation.A
plrysical interpretationof ruurrcricctliltegratiott is tlre determinationof the area under a
curve. Integrationhas many applicationsin engineeringand science,rangingfrom the de-
terminationof the centroidsof oddly shapedobjectsto the calculationof total quantities
basedon setsof discretemeasurements. In addition,nurnericalintegrationformulasplay an
importtrntrole in the solution of diffbrentialequations.Part Five also covers methodsfor
nume.ricaldifr'erentiation. As you know fiom your study of calculus,this involves the de-
terminationof a function's slopeor its rate of change.
Finally.Part Si.xfocuseson the solutionof ordirro'vdi.fterential equations(Fig. 1.6e).
Such equationsare of greatsignificancein all areirsof engineeringand science.This is be-
causemany physicallaws arecouchedin termsof the rateof changeof a quantityratherthan
the magnitudeof the quantity itself. Examplesrangefrom population-forecasting rnodels
(rateofchangeof population)to tlreacceleration of a tallin-ebody (rateofchangeofvelocity).
Two typesof problemsareaddressed: initial-valueandboundary-valueproblems.
PROBLEMS t7

PROBTEMS
l.l Usecalculusto velity that Eq. (1.9) is a solutionof 1.7 Thc amountof a uniformly distributedradioactivecon-
E q (. 1 . 8 ) . taminant containedin a closed reactor is measuredby its
1.2The following infbrmation is availablc for a bank concentrationc (becquerel/literor Bq/L). The contaminant
acc0unt: decrcasesa1 a decay rate proportionalto its concentration;
that is
Dote Deposits Withdrowols Bolonce Decay rate : -tc
5ir I 5 I 2 .3 3 whereft is a constantwith units of day I. Thercfore,accord-
2 2 41 3 327.26 ing to Eq. (1.14),a rrass balancefbr the reactorcan be
6/l wntten as
2t6B0 3 7 86 1
7/l dc
, r ( nr < r 0 68 0 kt
dt
Bit
/ changc\ / decrease \
t 2 7. 3 1 3 5 06 r t .i"ntm: ta,rls
9ll \ / \ U l d e c a S
/

(a) Use Euler's mcthod to solve this equationfrom t : 0 to


Usetheconservation of cashto computethe balanceon 6/ l, I d w i t h k : 0 . 2 d r . E m p l o y a s t e p s i z eo f A r : 0 . I d .
111.811, and9/1. Showeachstcpin thc computation. ls this The concentration at /:0 is l0 Bq/L.
a steady-state or a transientcomputation? (b) Plot the solution on a semilog graph (i.e., ln c versus/)
1,3Repeat Example1.2.Computethc velocityto t: l2 s, and detenninethe slopc.Intcrpretyour results.
witha stepsize of (a) I and (b) 0.5 s. Can you make any l ll A storagetank (Fig. Pl.8) containsa liquid at depth)
statement regardingthe crrorsof thc calculationbasedon the where,r': 0 when the tank is half full. Liquid is withdrawn
results? at a constantflow rate Q to meetdemands.The contentsare
1.4Ratherthanthe nonlinearrclationshipof Eq. ( 1.7),you resuppliedat a sinusoidalrate3Q sin2(t).Equation(1.14)
mightchooseto model the upward fbrce on the bungee can be written fbr this systcrnas
j u m p car sa l i n e a r e l a t i o n r h i p :
rl
-d(+Av'\ : 3 0 s i n ' ( r )- O
f tt : C U AT

wherer'': a first-orderdrag coefTicient(kg/s). / c h a n e ei n \


| ,' l: tinflowt - (outflow)
(a) Usingcalculus,obtain the closed-fbnn solution fbr thc \ votume /
casewherethejurnperis initiallyat rcst (u : 0 at 1: 0).
(b) Repeatthe numericalcalculationin Example 1.2 with
the sameinitial condition and oarametervalues.Use a
valueof 12.5kg/s fbr c'.
1.5For the free-talling bungee jumper with linear drag
(Prob.I .4).assumea first jumper is 70 kg and hasa drag co-
efficientof l2 kg/s. If a secondjurnperhasa drag coefficient
of 15kg/sand a massof 75 kg, how long will it take her to
reach thesamevelocityjumpcr I rcachedin l0 s'l
1.6 For the fiee-falling bungce jumper with linear drag
(Prob. 1.4),compulethe velocityof a free-tallingparachutist
usrng methodfbr thc cascwhcre rr : 80 kg and c' :
Er-rler's
l0 kg/s.Perfbrm thc calculation from / : 0 to 20 s with a
stepsizeof I s. Use an initial conditionthat the parachutist
hasanupwardvclocity of 20 m/s at /: 0. At r: l0 s, as-
sume thatthe chuteis instantaneously deployedso that thc
F I G U RP
EI . 8
dragcocllicientjumps to 50 kg/s.
r8 MATHEMATICAL
MODELING,NUMERICAL
METHODS,
AND PROBLEM
SOTVING

or, sincethe surfaceareaA is constant nr the heat capacity,and thc changein temperatureby the
followingrelationship:
r/t'O.O
: :3: s i n - f t )_ :
drAA - rr)
o : - Ir': c,dr : nrc,,(rz
Use Euler's method to solve for the depth _vfron-rr : 0 to
I0 d with a step size of 0.5 d. The parametervaluesareA : The massof air can be obtainedliom the ideal sas larv:
1200m2 and p : 500 m3/d.Assumethat the initial condition
i s . y: 0 . nt
-P7
Plt :
1.9 For the same storagetank describedin Prob. 1.8, sup- Mwt
pose that the outflow is not constantbut rather dependson
the depth. For this case,the differential equationfbr depth where P is the gaspressure,V is lhe volume of the gas,Mwt
can be written as is the molecularweight of the gas (1br air 28.97 kg/krnol),
and rRis the ideal gas constant[8.31,1kPa m]/(kmol K)].
dl' O . a(ltr')r 1.12 FigureP1.12depictsthe variousways in which an aver-
= . 1 ; s i n - (tr-
dt A ilgeman gainsandloseswaterin oneday.One liter is ingested
as food, and the body metabolicallyproduces0.3 liters. In
Use Euler's method to solve for the depth )' fiom t : 0 to breathingair, the exchangeis 0.05 liters while inhaling, and
10 d with a step siz-eof 0.5 d. The parametervaluesareA : 0.4 literswhile exhalingover a one-dayperiod.The body will
1200m2,O:500 mr/d, and cv: -300.Assurnethat the ini- also lose 0.2, 1.4.0.2.and 0.35 litersthroughsweat,urine,
tial condition is _r: 0. feces,and throughthe skin, respectively.To maintainsteady
1.10 The volume flow rate through a pipe is given by Q : state,how much water must be drunk per day?
rA, whele u is the average velocity and A is the cross- l.13 In our example of the fiee-falling parachutist,we as-
sectionalarea.Use volume-continuityto solvefor the required sumed that the accelerationdue to gravity was a constant
areain pipe3 of Fig. P I . 10. value of 9.8 m/s2.Although this is a decentapproxinration
l.ll A group of 30 studentsattenda classin a room which when we are examining falling objectsnear the surtaceof
lneasuresl0 m by 8 m by 3 m. Each studenttakesup about the earth, the gravitational lbrce decreasesas we lrove
0.075 mr and gives out about 80 W of heat (l W = I J/s). above sea level. A rnore general representationbased on
Calculatethe air temperaturerise during the first l5 minutes Newton's inversesquarelaw of gravitationalattractioncan
of the class if the room is completely sealedand insulated. be written as
Assume the heat capacityC,. tbr air is 0.7 18 kJ/(kg K). As-
sume air is an ideal gas at 20 "C and 101.325kPa. Note that R:
s ( x ) : g ( 0 ) ( l-( + . r ) '
the heatabsorbedby the air O is relatedto the massof the air

Skin

Qr.in= Qz'rt: 20 m3/s


Food

Drink

u.,ou, = 6 m/s
A:=? Metabolism

F I G U R EP I . I O F I G U RPEI . I 2
PROBLEMS r9

whereg(r) : gravitationalaccelerationat altitude.r (in m) of your final computedvolume and verifying that it rs con-
measured upward fronr thc earth'ssurfacetm/s2).gtO) : sistentwith the evaporationrate.
gravitational accelerationat the earth'ssurface(! 9.8 rn/sr), l.l-5 Newton's law oicooling saysthat the temperatureof a
a n dR : t h ec a r t h ' sr a d i u s( = 6 . 3 7 x 1 0 6m t . body changesat a rateproportionalto the differencebetween
(a) In a fashionsimilar to the derivationof Eq. (1.8), use a its temperatureand that of the surroundingmedium (the am-
forcebalanceto derive a ditlerential equationfor veloc- bient temperature).
ity as a function of time that utilizes this more complete
d
-; T : - k ( T - T " )
representation of gravitation.However. lbr this deriva-
at
tion, assumethat upward velocity is positive.
(b.1For the casewhere drag is negligible,use the chain rule where Z: the temperatureof the body ("C), r : time (rnin),
to expressthe differentialequationas a function of alti- k : the proportionalityconstant(per minute), and 7, : ths
tuderatherthan time. Recall that the chain rule is arnbienttemperature("C). Supposethat a cup of coft-eeorig-
du du d-r inally has a temperatureof 68 'C. Use Euler's method to
computethe temperaturefrom I : 0 to l0 min using a step
dt d.r dt
sizeof I min if I.. : 2l "C and ft : 0.017/min.
(c) Use calculusto obtain the closed form solution where |.16 Afluid is pumpedinto the networkshownin Fig. P1.16.
u = u,,at.r : 0. lf 0, : 0.6.O.,: 0.4.Qt:O.2. andQo: 0..1mr/s.determine
(d) UseEuler's rnethodto obtain a numericalsolutionfrom the other flows.
r : 0 to 100,000m using a stepof 10,000m where the
initial velocity is 1400m/s upward.Compareyor,rrresult
u ith the analyticalsolr"rtion.
l. l{ Supposethat a sphericaldroplet of liquid evaporatesat
ilr*?-i=-i--I
iiri:;$
a ratethat is proportionalto its surfacearea.

dV
::
dt
-kA
bt'ili o,l "i "i "'i
rvhereV: volume 1mm3),t : time (hr), k : the evapol'ation
rate(mm/hr), and A : surface area 1mmr). Use Euler's
methodto conrputethe volume of the droplet from I : 0 to
i-.er-:--s...;-*-*L*-i
l0 min using a step size of 0.2,5min. Assume that ft :
0.1mm/min andthat thedropletinitially hasa radiusof 3 mm.
FIGURE
PI.I6
the validity oi your resultsby determiningthe radius
Assess
\
iiEi;4+'"
,l

i.

MATLABFundomentols

2.1

CHAPTER
OBJECTIVES
The primaryobjectiveo1'thischapteris to providean introductiorr
and overviewof
how MATLAB's calculatormodeis usedto implcmentinteractivecornputations.
Specificobjectivesand topicscoveredare
' Lcarninghow realanclcornplexnurrrbcrs areassignedto variables
. Learninghow vectorsand matricesareassignedvaluesusingsinrpleussignrnent.
.l
the colon ope'rator', and thc irs;p.r,:cand 1oq1,;piic:,--- l'ttnctitlns.
. Llnderstanding thc priority rulcsfirr constructingmathernatical cxpre-ssions.
. Gaininga gencralundcrstanding ol'built-in lr-rnctions and how you can lcarntnore
a b o u t h e mw i t h M A ' I ' L A B ' sH e l p f a c i l i t i e s .
. Learninghow to usc vectorsto crcirtca sinrplclinc plot baseclon an equation.

YOU'VE GOT A PROBLEM


n Chap. l. we usctlir firrcebalanceto detcrnrinethe tcrminalvelocityof a fiec-falling
I
o h j e c ll i k c i r h L r r r g cj uer n p c r .
I
T

tsi
V t,t

wher-er.,,: ternrinalvelocity(nr/s),,q: gravilationalaccelerertion


(m/s').m : mass(kg),
and t',,: a dragcoefl'icient(kg/m).Asidefrom prcdictingthe terminalvelocity,this equa-
tion can alsobe rearranged to computethe dragcoefficicnt

m8
( 2 .I ;
ut
20

ffi=?N 4_ =
,f %. uE-1 5t
zr'+ zl x+ %I
2r
MAT4gllyllerynENl
2 r THE

TABTE2.I Dotoforthemossondossociotedtermino|velociliesofonumberofiumpers
BO9
gll 929 653
836 6A2 721 4 7 7 5l l
m,kg (1,,1 la \ 509 557 5 4
u,,ml s

of knclwnmass,this
the terminal velocityof a numberol .iumpers
Thus, if we nleasure The clatain Table2' I werecol-
provides o *t-' tt.lestimatethe drag coeificient'
equation
l e c t u ' ldo r l h i s p u r p o s e ' r n : r l v . ztr ' s r rdclht u . B e y o n d
^ m , ^ n ^ ^ ^ , . ^ , , . n r rl n analyze
chapter, we will leartr how MATLAB canbe uscdto
In this
showinghowMATLABcanbeenlployedtocolnputeqtrantitieslikeclragcoetTicients'we
willalsoillustratchowttsgraphicalcapabilitiesp,*i.t.adtlititlnalinsightintosuchanalyses.

2.r
M A T L A B i s a c o m p u t e r p r o g r a l x t h a t p r o v i < l c s . t hiteprtlvides
u s e r w i ta
h avery v e l rtool
c o nnice e ninrple.
i e t r tto virontlrentfclr
typcs.ol.ctilculaticrns. ln particular,
perfornirrg many

" "!i:H:i:iilll1l;|;"vtoope * *' 1P,


rute ::::::::::):i:I;:;: ii' ffi:lr
:',:,'^
;::'# *.,ln u'T- crc ngprots n
ati
ff.:ll,'Ji:'.:il{; ilJffill'.":ili: "'" ":1
"'to createMAft-AB progralns'
commandscan be usecl
Chap.3, we show how sr'rch
o n e f u r t h e r . n o t c ' . [ h i s c h a p t e r h a s b e e n w r i tThe
t e n a s a l relficient l r r c xtoc lbeconle
a n c l s - t way .cise.Thatis,yott
it while ,,tring in fiont o1'youlcornpLrtcr. m.st
shoultlrcad
oroficientist'oacttrallyinl;llctlentthcctltntrratrclsonMATLABasyouprocccdthrotrghthe
following material'
witrclows:
fUeif-A,B usesthreeprimary
anddata'
. Conrtnancl winclow'Uscdto entercommancls
display plots and graphs'
. C."pt,i.* windtlw' Usedkr
. gaii winclow' Usecl tt'r creute and edit M-filcs'
wind.ws' ln chap' 3 we
usc of thc c.mmand anclgraphics
In this chapter,we wilr r.rake
crcatcM-iiles'
*iii ut. the edit window to openwith thc commancl
prompt
Afier startingMd;;;' tht tu'ntunti window will
bcingdisPlaYcd
y o L lt y p c i n c o n t -
o1'MATLAB lrI a s c q u c n t i i tl ll t s h i t r na s
oper''rtcs
The calculator nlode you can think of it as oper-
line' For each you get'r-result
cotnurancl'
manclsline by Lh::s'
tn
For exanlplc'if you typc
^ii"g f if,. a uery l'ancycalcttlator'
-_-, 51 Lo

rcsult'
MATL.AB will disPlaYthc
a,ttt-,=,,

' M A | l , A B s k r p s a l i n c b c t w c c l l t | - r | a h e l ( l , r r l . ) l t n d t h c n u n l b c r . ( - ] ) . H( e) rr: rr r- '.1$i(1..i (l L, m 1c'i':'r


I l r firtis: 1lAl cuhd b! .l rl :n' rk' 'l j n c s t o r
l i n e ' sa r e i n c l u d c t l w i t h t h c
a u n , , a r t. u h . i t h e rr r t a n t
co.ciscness.varuaun
comlrtnds.

8
ffi
qA b
zt\
4x
^r-
AL
?t 5t
4
,.-ILJ' !8
22 MATLABFUNDAMENTALS

Notice that MATLAB has automaticallyassignedthe answerto a variable,ans. Thus, you


could now use ans in a subseouentcalculation:
'- ars + II

with the result

50
MATLAB assignsthe resultto ans wheneveryou do not explicitlyassignthe calculation
to a variableof your own choosing.

2.2 ASSIGNMENT
Assignmentrefersto assigningvaluesto variablenames.This resultsin the storageof the
valuesin the memorylocationcorresponding to the variablename.

2.2.1 Scolors
of valuesto scalarvariables
The assignment is sirnilarto otherconlputerlanguages.
Try typing
1 _ A

echoprintsto confirmwhat you havedone:


Note how the assignment

4
Echoprintingis a charactelistic
of MATLAB. lt carrbe suppressed
by terminatingthecom-
mand line with the semicolon(; ) character.
Try typing

>> A = 5;

You can type severalcommandson the sameline by separating them with comnlasor
semicolons.If you separatethem with commas,they will be displayed,and if you usethe
semicolon,they will not.For example,
>> a - 4,A = 6;x = . 1;
twe

short
4 Iong
short e
MATLAB treatsnames in a case-sensitivernanner-that is. the nan)e a is not the same
long e
as the name a. To illustrate this. enter
long g
>> a

eh^rt end
and then enter
long eng
>>A
bank
Seehow their valuesare distinct.Thev are distinct names.

frT-Tbl -z th
"L x jj€- -r

zfTtr ='1.t- st
.-f J
4 _A
15/
zl-+ Z] X+? I
2.2 ASSIGNMENT 23

We can assigncomplex valuesto variables.since MATLAB handlescomplex arith-


metic automatically.The unit irnaginary number ir preassignedto the variable i.
"/J
Consequently,
a complexvaluecan be assignedsimply as in
>> x = 2+i*4

2.0000 + 4.0000i
It shouldbe notedthat MATLAB allows the symbol j to be usedto representthe unit imag-
inary numberfor input.However,it alwaysusesan i for display.For example,
>> x = 2+1*4

2.0000 + 4.0000i
Thereare severalpredefinedvariables.fbr example.pi.
>- pi

3 . r4r6
Noticehow MATLAB displaysfbur decinralplaces.If you desireadditionalprecision,
enterthe fbllowing:
>> format long

Now whenpi is enteledthe resultis displayedto l5 signilicantfigures:


>> pi

1 . 1 4 1 5 9 2 b 5 - 15 8 9 7 9

To return to the four decimal version, type

>> format short

The f<rllowing is a summary of the format commands you will employ routinely in engi-
ncering and.scientific calculations.They all have the syntax: f ormat typr...

twe Result Exomple

- c h o ]t S c o e d f i x e dp o i n t f o r m c tw i t h 5 d i g i t s 3. r416
Lcrng S c c r i e df r x e d - p o i nfto r m o iw i t h 1 5 d i g l h f o r d o u b l e o n d Z d i g i t sf o r s i n g l e i.1415q1b5J58979
srrort e F l o o i i n g ' p o i nfto r m c tw i i h 5 d i q i t s l.1415e+0tr0
lonlJ e F l o o i i n gp o i n t l o r m o tw i f h l 5 d i g i i s f o r d o u b l e o n d / d l g i t sl o r s i n g l e 3 . 1 4l 5 9 2 6 5 3 5 8 9 7 9 3 e + 0 0 0
shorl: g B e s lo f f i x e d o r f l o o f i n g - p o i nl ol r m o tw i t h 5 d i c t l t s 3.r416
lonq g B e s to [ [ i x e d o r f l o o t i n gp o i n l f o r m o fw i t h 1 5 d l g i t sf o r d o u b l e 3 . 1 4 1 5 9 2 . 6 5 ] , 5 8 997
andTaglsforsingie
short eng E n g i n e e r l n gf o r m o fw i t h o l l e c s l5 d i g i t so n d o p o w e r i h o t i s c r r n u t l p l eo f 3 1.1416er000
long eng Engineen r g f o r m o tw i i h e x c c l l y 1 6 s i g n i f i c o ndt i g i t so n d o p o w e r 3 . 1 4 1 5 9 26 5 3 5 8 9 79 e + 0 0 0
t h o t s o m ut i p l eo f 3
bank F i x e dd o l l o r so n d c e n t s 1 1A

ffiE\
z\ a-*!1,€
--T -
-a.[h
-_- a --:-----;:a,
+ .__..__i
. I el 5t
'"1F{'J 4
el + Z} X+ I
24 MATLABFUNDAMENTALS

2.2.2 Arroys, Vectors qnd Mqtrices


An arrat' is a collection of values that are representedby a single variable name. One-
dincnsirnalarral't arc callcd tu'/ort and two-dinensional anavs are c'allednrutnce:. The
scalarsusedin Section2.2.1 areactuallya matrix with one low andone column.
Bracketsare usedto enterarraysin the comnranilmode.For exan.rple, a row vectorcan
be assisnedas fbiiows:
123451

Note that this assignment


overridesthe previousassignment of a : 4.
In practice, row vectorsare rarely usedto solve rnathematical
problerns.When we
speakof vectors.we usuallyret-erto column vectors,which are more contmonlyused.A
column vectorcan be enteredin severalways.Try them.

or
_-..>b- |2;
1;
6;
8;
I0 l

a row vectorwith the ' operator,


or. by transposing
>> Lr = | 2, 4 6 I 10 I'

Tlre resultin all threecaseswill be


b=
1.
4
b
S
1t)

A rnatrixof valuescan be assignedas lblkrws:

r'23
456
789
In addition.the Enterkey (carriagereturn)can be usedto separirte the rows. For example.
in the followingcase,the Enterkey woulclbe struckafterthe 3. the 6 andthe I to assignthe
matrix:
.->A.. lr23
456
7 8 9l

ffi
qA1, "L x jl':-
<, lh
-r

a_J---*=
zf :5yst
LIZ _r -{ vI ?l 5t
zt -+
4

Z] X+
, - A

I
2.2 ASSIGNMENT 25

At any point in a session,a list of all currentvariablescan be obtainedby enteringthe


v;hocommand:
> > rvho

Your yariabl es .rrc:


al ans b x

or. with moredetail.cnterthc whos command:


>;.whos

f Jd r { i e Sr ze Byte:: Class
A lx3 12 clouble array
I x5 40 cloubLa array
dns LXL 8 tlouLr Lc: ;.Lrray
l) 5xi 4Ct il,trrb l e i)i I'ay
'1
x- xl I6 doubLe arr.r.y
(comfiLex)

Clrancl t-otal is 21 elenrrrnl.s; LrsinqJ 175 bytes

Note that subscriptnotationcan be usedto accessan individualelcmentof an array.


For exarnple.the firurthelemento['thc columnvccfort) can be displayedas
:> b(4)

,tlt si .

F o r a n a r r a y , A ( n, rn ) s e l e c t s l h e c l e m c n t i n m t h r o w a n d t h c n t h c o l u r n n . F o r e x a m p l e ,

A(:,1)

Thsre are sevcralbuilt-in functionsthat can be used1ocreatcmatrices.For cxarnplc,


the ones llnd zero:i l'unctionscreatcvcctol'sor matricesfilled with ones and zeros.
respectively.Both havetwo argumcnts, thc first tbr the nulnberof rows and the secondtbr
thc number-ofcolumns.For example.to creatca 2 x 3 matrixtl1'zeros:
E : 7 , c I o s ; ( 2 ., - ) J

00
UU

Sintilarly, the or-resfLtnctioncan be used to create a row vector of oncs:

u = o n c : : ;( j , - l)

2.2.3 The Colon Operotor


The colon opefatoris a powerfll tool fbr crertingand manipulatingarrays.If a colon is
used to separatetw'o nunrbers,MATLAB generaleslhe n u m b e r sb c l w e e nl h e m u s i n ua n

-
ffial <,
- [h
z$4 I
la-
s L Y
t('€ - ?'' 5l
zf Ll 2 ;n-Zt*
-i
5t
vI
zl' -+ Z] X+
'|-A

I
26 MATLABFUNDAMENTALS l.J

incrementof one: whi


-: l- - 1.(
For

If colonsare usedto separatethreenumbers.MAILAB generatesthe numbersbetweenthe


first and third numbersusing an incrementequal to the secondnumber: Ifn
>> t = L:0.5:3
f-
2.3 rnr
1.0000 1.5000 2.0000 2.5000 3.0000 ope
Note that negativeincrementscan also be used com
>-" f = i0:-1:5

t0 9 B 1 6 5
Aside from creatingseriesof numbers,the colon can also be usedas a wildcard to se-
lect the individualrows and columnsof a matrix.When a colon is usedin placeof a spe-
cific subscript,the colon reprcsentsthe entire row or column.For example,the secondrow
of the matrix A can be selectedas in
>> A(2,:)

We can also use the colon notation to selectivelyextract a seriesof elementsfrom


Alsc
within an array.For example,basedon the previousdefinition of the vector t :
> > ' 1 -( 2 : 4 )

981
Thus, the second through the fourth elements are returned.
Res
2.2.4 The rlnspace ond losspace Functions plv
The iinspacre and logspace functionsprovideotherhandytoolsto generatevectorsof thes
spacedpoints.The 1 inspace functiongenerates
a row vectorofequally spacedpoints.It ing
has the form
I i n s p a c e (x l . x 2 , n )
which generatesn points betweenxl and x2. For example
'> linspace(0,1,6)
Th
AS
0 0.2000 0.4000 0.6000 o.BOOO 1.0000
lf the n is omitted,the function alromatically generates100points.
The logspace l-unctiongenerates a row vectorthatis logarithmicallyequallyspaced.
It has the form
).
-t
logspace(x1, x2, n)

ffi= -tlh
"L x
Ll 2. * Zl eNst vI 2- 3l
J
?l -+ ZI X+? =$8
2.3 MATHEMATICAL
OPERATIONS 27

which generatesn logarithmicallyequally spacedpoints betweendecadesl0'r and 10":


For examp)e,
>> logspac e (-I ,2 , 4)

0.1000 1.0000 10.0000 100.0000


If n is omitted,it automaticallygenerates50 points.

2.3 MATHEMATICAL
OPERATIONS
Operationswith scalarquantitiesare handledin a straightforwardmanner,similar to other
computerlanguages.The common operators.in order of priority, are

Exponenliolion
Negotion
M u l t i p l i c o t i o no n d d i v i s i o n
L e f td i v i s i o n ' l
A d d i t i o no n d s u b l r o c t i o n

These operators will work in calculator fashion. Try

,r 2*pt

6 .2,832
Also, scalar real variables can be included:

>> Y - Pt/4;
>> y ^ 2.45

0.5533

Results of calculations can be assigned to a variable, as in the next-to-last example, or sim-


ply displayed, as in the Iast example.
As with other computer calculation, the priority order can be overridden with paren-
theses. For example, because exponentiation has higher priority then negation, the follow-
ing result would be obtained:

>> Y = 4 ^ 2

y-
_r6

Thus,4 is first squaredand then negated.Parentheses


can be usedto overridethe priorities
as in
>> Y = \-4)

L6
: Lefi division appliesto matrix algebra.It will be discussedin detail later in this book.

ffi= <, [h
-----
,"1lJ t
r\ a +
-
-=-:-T
*-6 -l 5[ s\
-{
.l - "L x
__..-..-..i,
4 6re
zl'+ Z] X+ %&
2a MATTABFUNDAMENTAIS

Calculationscan alsoinvolvecomplexquantities. Herearesomeexamplesthatusethe


valuesof x (2 + 4i) andv ( I 6) definedpreviously:
'>,'3 * x

ans -
5.0004 +I2.0000i

>>'1 /;<

0 . 1 0 1 10 0.2000r

>> x ^ ,2

ans -
-12.0000 +1r,.0000-r

>> x + y

an!; -
lB.O0tJ0 + 4.00001

The real power of MATLAB is illustrated in its ability to carry out vector-rnatrix
. l t h o u g h w e w i l l d e s c r i b es u c h c a l c u l a t i o n si n d e t a i l i n C h a p . 8 . i t i s w o r t h
c a l c u l a t i o n sA
introducing sorne of those manipulations here.
The irtner product of two vectors (dot product) can be calculated using the * operator,

:.:,d*b

r10

and likewise, the outer pnrluct

>:, b * -

allS -

2 4 b 8 I0
4 8 12 16 20
6 12 18 24 30
8 16 24 3'2 4t)
10 2t) l0 4L) 50

To further illustrate vector-matrix mLrltiplication,llrst redefine a and l:,:

. , ti 2 l;

and

>> b = f4 5 tjl';

Now. try

>> a * A

l0 t6 4?.

ffir
qAb Z
uNx
<,
- [h

ffi z_! 1J'€- sJ 5t


LJt A
zl' -& i- x+ 3$&
2.3 MATHEMATICAL
OPERATIONS 29

>>A*b

32
71
r22
Matrices cannot be multiplied if the inner dimensions are unequal. Here is what happens
when the dimensions are not those required by the operations. Try
>> A * a
MATLAB automatically displays the error message:
??? ETrar using =-> mtimes
Inner matrix dimensi.ons must aQfree.
Matrix-rnatrix multiplication is carried out in likewise fashion:
>> A * A

30 35 42
66 B1 96
102 126 150
Mixcd operations with scalarsare also possible:
>> A/pi
ans =
0.3183 0.5366 0.9549
'I
.2132 I.5915 1.9099
?,.2,?,82 2,.\46\ 2,.8648
We must always remember that MATLAB will apply the simple arithmetic operators
in vector-matrix fashion if possible.At times, you will want to carry out calculations item
by item in a matrix or vector. MATLAB provides for that too. For example,

30 35 4?,
66 81 9tr
r02 t2,6 1 50
resultsin matrix multiplicationof a with itself.
What if you want to squareeachelementof e? That can be donewith
>> A .^ 2

anS =
r49
16 2a 36
49 64 81
^
The . precedingthe operatorsignifiesthat the operationis to be carriedout elementby
element.The MATLAB manualcalls thesearray operatlons.They are also often referred
Loas element-hy-cIemen t t tparutit tn.s.

ffi
z\4 "L
<, lh
x _-T - 9f 5l
,"I LJ' Zl- gt st
-l
4 ,t\€
-l-

-2.(-h z_|lh I
30 MATLABFUNDAMENTALS

MATLAB containsa helpful shortcutfor performingcalculationsthat you've already


done.Pressthe up-arrowkey. You shouldget back the last line you typed in.
>> A .^ 2

PressingEnter will perform the calculation again. But you can also edit this line. For
example,changeit to the line below and then pressEnter.
>> A .". 3

1821
64 I25 216
343 5r2 129

Using the up-arrow key, you can go back to any command that you entered. Press the up-
arrow until you get back the line
F * -

Alternatively,you can type b and pressthe up-arrow once and it will automaticallybring
up the last commandbeginningwith the letter b. The up-arrow shortcutis a quick way to
fix errorswithouthavingto retypethe entireline.

2.4 USEOF BUIIT.INFUNCTIONS


MATLAB and its Toolboxeshavea rich collectionof built-infunctions.You can useonline
help to find out nroreaboutthem. For example.if you want to learnaboutthe 1og function,
type rn
>> helP log'

LOG lrlatural logarithm.


LOG(X) is the nat-ural lograrithm of the elements of X.
Complex results are produced if X is not posrtive.

See also LOG2, LOG10, EXP, LOGM.

For a list of all the elementaryfunctions,type


'> help elfun

One of their importantpropertiesof MATLAB's built-in functionsis that they will op-
eratedirectly on vectorand r.natrixquantities.For example,try
>> log (A)

0 0.6931 1.0986
1.3863 1.6094 r.79'LB
1.9459 2.0194 2.1912

and you will see that the natural logarithm function is applied in array style, element by
elenrent,to the matrix A. Most functions. such as sqr t, abs, sin, acos, f anh, and exp, op-
erate in anay fashion. Certain functions, such as exponential and square root, have matrix
definitions also. MATLAB will evaluate the matrix version when the letter m is appended to

ffi=
qA+, "L
<'- [h
Y - eJ 5t
a eys\
'\--
,"1{z -1 -l 4 ll'€
zf+ Z] X+ &
FUNCTIONS
2,4 USEOF BUILT-IN 3l

the function name.Try


>> sqr:tm(A)

A.4498 + 0.1623i 0.5526 + 0.2068i 0.5555 0.3481l


1.0185 + O.AB42i 1.2515 + 0.A22Bi I.4844 - 0.0385i
I.5813 - 0.594A1 1.9503 - 0.1611i 2.3134 + 0.21I7i

There are several functions for rounding. For example, suppose that we enter a vector:

>> E = l-1.6 -1.5 -I.4 I.4 1.5 I.6l;

The round function rounds the elements of E to the nearest integers:

>> round(E)

-2-2-1r22

The ceil (short fbr ceiling) function rounds to the nearestintegerstoward infinity:

>> ceil (E)

1 1 -1 2 2 2

The f loor function rounds down to the nearestintegers toward minus infinity:

>> f loor ( F t)

22 2rl
There are also functionsthat perform specialactionson the elementsof matricesand
arrays.For example,the sumfunctionreturnsthe sum of the elements:
>> F = l3 5 4 6 Il;
>> sum(F)

19
In a similar way, it should be pretty obvious what's happeningwith the following commands:

>> min(F),max(F),mean(F),prod(F),sort (F)

3.8000

360

13456

ffi Z} x --T<, lh
,f\€ - 9f >l
4 -l-

&
32 MATTABFUNDAMENTALS

A common useof functionsis to evaluatea fornrula for a seriesof arguments.Recall 2.5 G


that the velocityof a free-fallingbungeejumper canbe computedwith [Eq. (1.9)]:
M,
lom / loe, \ gft
, : , / a t a n h,l/ r - r I
V c.r \V trt /
Th
where u is velocity(m/s),g is the acceleration due to gravity(9.81 m/s:),n is mass(kg),
bo
c,,is the drag coefficient(kg/m), and r is time (s).
Createa columnvectort that containsvaluesfrom 0 to 20 in stepsof 2:
;'> l- = [0:2:20]'

t.-
0
2
4
6
B
l0
t2
l4
15
1B
20

Check the number of items in the t array with the lerrgLh function:

>> I cnqtlr (L ) Yor

allS =

1I

Assignvaluesto the parameters:

>:.9 = 9.81; in - 68.1; crl = 0.25;

M A T L A B a l l o w sy o u t o e v a l u a t ea f o r m u l as u c ha s r : . 1 ( r ) , w h e r et h e f b r r n u l ai s
computedfbr each value of tl.rer array,and the result is assignedto a correspondingposi-
tion in the u array.For our case,
-/ : s q L t - ( g * n / c ' d ) * 1 - a n h ( s q r t ( g * c c l/ n ) * t )

t) (
1B.'t292 (
33.r118 I

42 .01 62
46 .951 a
49 .42r4
50.6175
51.1871
51.4560
51.5823
br.6416

-
ffir <,
- [h
L x
j_f€ - sJ 5t
zl Llz 7f 5[ st
-{ -l vI
.r1 -\

zl'+ Z] X+?
2.5 GRAPHICS
33

2.5 GRAPHICS
createa
MMLAB allows graphsto be createdquickly and conveniently.For example,to
graphof the t and v arraysfrom the data above,enter
:,., nlol (t, ./)

lne gfapn appears ln tne grapnlcs wrnoow ano can De pnnteo or translerreo vra tne clrp-
board to other programs.

60

50

40

30

20

10

0
8 10 1214 16 18

You can customizethe grapha bit with commandssuchas the following:


>> til,re('Plot of v ver':jus t')
:':.' xlabel ('Valucs of L')
, -> y l . L b c l ('Valucs ol v')
.:'> qrid

Plot of u versus f
60
:
.'
l
t '!ry
50 l l

i I
40 l
l
a I

o i
: 30 : j
i
6
I !

20
I, i
.-..--- t. "- -

:
10 "-t--*
l
I
i
l I

0
8 10 12 14 16 18
Valuesof t

ffi
z\4+ a-* --4
<, lh
l,f.€- ef >l
,"lqfjeTl ^:,z,J -l-

?,r' zl x+ 3$&
34 MATLABFUNDAMENTALS

TAB E 2.:2 Specifiers


for colors,symbols,ond linetypes.
Colors Symbols Line Types
Bl,re Poinl
Green Solid
Circle Dolied
Red 'MO TK
Dcshdot
Cyon Pu l s
Doshed
A^agenio m Slcr
Yello'"v v Squore
Blccl. k Diomond
T r i o n ge ( d o v r n )
Triongle{up)
Triongie(leftJ
T ri o n g l e { r i g h t )
Penlogronr
nexogfcrn

The 1rlot- conlmandclisplays


a solidline by default.If you wantto plot eachpoint
a symbol' you can includea specifierenclosedin with
singlequotesin the pior functio..
Table2'2 Iiststhe availablespecifiers.
For example,if you want to useopencirclesenter
r-:.l:jlot (t, v, ,o,)

MATLAB allowsy.ruto displaymorethanonedataset


on the sameprot.For example,
if you want [o connecteachclatarnarkerwirh a straight
rineyou courdrype
:'i.I,1ol, (L, yt t, \r, ,o')

It shouldbe Inentionedthat,by clefault,previousplots


areerasedeverytirnethe plor
commandis implernented. The hol d c,nconrmanclhoidsthecurrcntplot anclall axis prop-
ertiesso that additionalgraphingcommancls can be addedto the existingplot. The h.tit
of f cornmandreturnsto the def'aultmocre.Fclr
exampre,if we had typed the tbilowing
cornmands, the flnal plot woukl only displaysyrnbols;
:'' pIoL (1, .r)
>> plot (t, v, ,o,)

ln contrast,the f<lilowingcommandswould
resurt in both lines and symborsbeing
displayed:

':' ploL (t, -,.)


'-. lLoLd on
>- Plot- (t, v, 'o')
::-, ho1c1 off

In additionto ho1.l, anotherhanrlyfunctionis subplor,


which alJowsyou lo split the
graphwindow into subwindows()rp(ute,r.It has
the svntax
subploL (n, n, pJ
This cornrnandbreaksthe graphwindow into
an m-by-nmatrixof small axes,and selects
the p-th axesfor the currentplot.

ffi
aAI z-t\ a.
- [h
- =,:st -x
7l Lt r --7i 5[ v! rf € - 1 5t
J'-l J-l
zt'-+ Z-} X+
2.5 GRAPHICS 35

We can demonstratesubplot by examiningMATLAB's capabilityto generatethree-


dimensionalplots. The simplest manifestationof this capability is the p1or3 command
which has the syntax
p1ot3 \x, y, z)

wherex, y, and z arethreevectorsof the samelength.The resultis a line in three-dimensional


spacethroughthe pointswhosecoordinatesarethe elementsof x, y, anrJz.
Plotting a helix providesa nice exampleto illustrateits utility. First, let's grapha circle
with the two-dimensional plot function using the parametricrepresentation: -r: sin(t)
and.y - cos(r).We employ the subplot commandso we can subsequently add the three-di-
mensionalplot.
>> l- = 0:pi/50:10*pi;
> > s u b p l o r -( 1 , 2 , I ) ; p 1 o t ( s j n ( L ) , c o s ( r ) )
>> axis squaLe
>> r.irle (' (a) ')

As in Fig. 2.la,the result is a circle. Note that the circle would have been distorted if we
had not used the axis sou.er e command.

F I G U R E2 . I
A twoponeplotof (o)o two-dimensionol
circleond (b)o three-dimensionoJ
helix

(b)

ffi=b "L Y
<, lh
_-T
5t(st j} € - eJ 5t
,"I LJ' 1t
-l
vI
z['+ Z] X+ 3$8
36 MATLABFUNDAMENTALS

Now, let's add the helix to the graph'sright pane.To do this, we againemploy a para-
x: sin(/),.)': cos(1),andu : /
metl'icrepresentation:
' > s u b p L o t (- I , 2 , 2 ) ; p 1 o t 3 ( s i n ( L ) , c o s ( 1 . ) , L ) ;
>> rirle('(b) ,)

The resultis shownin Fig. 2.l b. Can you visualizewhat'sgoingon?As time evolves.
the .r and .y coordinatessketchout the circumferenceof the circle in the r-r' plane in the
samefashionas the two-dimensional plot. However.simultaneously. the curverisesverti-
cally as the : coordinateincreaseslinearlywith time. The net resultis the characteristic
springor spiralstaircase shapeof the helix.
of graphicsthat are useful-fbr example.plotting obiects
Thele ale other f'eatr.rres
insteadof lines,familiesol curvesplots,plottingon the complexplane,log-logor semilog
plots,three-dimensional meshplots,and contourplots.As describednext,a varietyof re-
solll.cesareavailableto learnabouttheseas well as otherMATL,AB capabilities.

2.6 OTHERRESOURCES
The fbregoingwas designedto lbcus on thosef'eatures ol'MATLAB that we will be using
in the remainderof this book.As such.it is obviouslynot a comprehensive overviewof all
o1'MATLAB's capabilities. If you are interestedin learningrnore,you shouldconsultone
of the excellentbooksdevotedto MAILAB (e.g..Palrn.2005;Hanselmanand Littlefield.
2 0 0 5 :a n dM o o r e . 2 0 0 7 ) .
Further,the packageitsell'includes an extensiveHelp lacility thatcan be accessedby
clicking on the Help nrenuin the comnrandwindow.Thi.swill provideyou with a nutnber
of ditl'erentoptionsfbr exploringand searchingthloughMATLAB's Help material.In ad-
dition, it prclvidesaccessto a numberof instructivedetnos.
As describedin this chiLpter. help is also availablein interactivernodeby typing the
lrclp conrmandfbllowedby the narneo1'acommandor function.
If you do not know the narne,you can use the lookfor commandto searchthe
MATLAB Help files lbr occurrences of text.Fol example,supposethatyou wantto find all
the cornrnands and functionsthat relateto logarithrns, you couldenter

l-,kt ,r ..,'t irhn

anclMATLAB will displayall ret'erences that includethe word loq.rri t-hnr.


Finally.you can obtainhelp tionr The MathWorks.lnc., websiteat www.mathworks
.corn.Thereyou will l'indlinks to productinfbrmation,newsgroups, books,and technical
supportas well as a varietyofother uselitlresources.

ffiar a,
- [h
--=-al' "L x
z[ Ll 2 r
5y 5t
-r 4 1.|€- 1 5t
zl ,x+ =$8
L1 -l_t

zl'+
2.7 CASESTUDY 37

EXPLORATORY
DATAANALYSIS

Bockground. Your textbooks are filled with formulas developed in the past by
renowned scientistsand engineers.Although theseare of great utility, engineersand scien-
tists often must supplementtheserelationshipsby collectingand analyzingtheir own data.
Sometimesthis leads to a new forrnula. However, prior to arriving at a final predictive equa-
tion, we usually "play" with the data by per{ormingcalculationsand developingplots. ln
most cases,our intent is to gain insight into the pattemsand mechanismshiddenin the data.
In this casestudy,we will illustratehow MAILAB facilitatessuch exploratorydata
analysis.We will do this by estimatingthe drag coefficientof a free-falling human based
on Eq. (2.1) and the data from Table 2. 1. However, beyond merely computing the drag
coefficient, we will use MATLAB's graphicalcapabilitiesto discernpatternsin the data.

Solution. The datafrom Table2.1 alongwith gravitationalacceleration


canbe enteredas
, tr-jrr1.o f,0.ll 7.1.l 91.1 9)..9 (tir..l 8t:1.91;
:;'rrt::l!-1 .4 4|J.1 !0.9 !,5.i !,1 4l.l 'rl..ll;
,--. r; 9.fl1;

The drag coefficientscan then be computedwith Eq. (2. l). Becausewe are performing
element-by-element operationson vectors,we must include periodsprior to the operators:

(r. '.1, r 1)..tt,il') l).')t) lr)

We can now use someof MATLAB's built-in functionsto ceneratesome statisticsfor the
results:
- . . - 1 , J , 1 r 7 q = 1 1 r ( ' . (l (a i l l l i , i i r = t i ri r r ( .l r , n , . ,r , , , 1 , 'q1 ( r ' r l )
i Li,-.1';1,1 ,.

l) . .l llr;4
r l c l r r ri r r -
i)

r ' c l n t . r: .
0. J12!

Thus, the averagevalue is 0.2854 with a rangettom 0.25l l to 0.3125kg/m.


Now, let's start to play with this data by using Eq. (2 l) to makea predictionof the
teuninal velocity basedon the averagedrag:
',..
v l ) ] , . ' a l . , : l a l r L ( g * r l t r t r , l , r ' " ' ). 1

Vpl t r:Ci
'rl-t,(lL'r 1i,..iii,)/ 4'1. /!.1l'-r'r.ll1r',tr:,
'.1),.i
] ,) f "

Notice that we do not have to use periodsprior to the operatorsin this formula? Do you
understandwhy?
We can plot thesevaluesversusthe actualmeasuredterminal velocities.We will also
superimposea line indicating exact predictions(the l;1 line) to help assessthe results.

ffi=
qA+,
-z [h
x - eJ 5t
z(r Ll 2 2- e[ st /_l€
tr4 -\
-{
,e[r ?$ I
+ Z] X+?
38 MATLABFUNDAMENTALS

Plot of predictedversusmeasuredterminal velocities

3ss
€0)
o-' 50

45L
48 49 50 51 52 53 54 56
Measured

Plot of drag coefficientversusmass


0.35
o)F
o<.
q)
o
t! U.J
o O c,)
o.Y
o
oo
r!o

0 . 2|
60 65 70 75 80 85 95
Mass (kg)
PROBTE
FIGURE2.2
withMATIAB
Twoololscreoted 2.1 A simple electricc
pacitor, and an inductor
on the capacitor4(l) as
Becausewe are going to eventually generatea secondplot, we employ the subplot as
command:
' ' : : u l . , y r l o L( 2 , ) , 1 ) ; p l o t ( " / t - , v p r ( . 1 ( ,l ' . ) ' , ' , ' 1 . , v l - )
., x I a b , - l ( ' l r , : , , t : ; L r r i : c l)' q(t): q t ) g - R t / ( 2s1
I i.rlrt'I ('Irr i.:rlic lL-'tl')
'l'l ol Lrurar(l l,
I i t lc] ( ol I)t ('(l i ( t..crd
wherer:time,qo:tl
L: inductance,and (
As in the top plot of Fig.2.2,becausethe predictionsgenerallyfollow the l: I line, you
generatea plot of this fi
might initially concludethat the averagedrag coefficientyields decentresults.However,
4o:12,R:50'L-j
notice how the model tends to underpredictthe low velocitiesand overpredictthe high. 2.2 The standard norrr
This suggeststhat ratherthanbeing constant,theremight be a trendin the dragcoefficients. bell-shapedcurve that c
This can be seenby plotting the estimateddrag coefficientsversusmass:

x l ; r i r e I ( ' n r , r : r f , r( k q r ' t
' , ' l , i ' l : rl, ( ' , - ' : : 1 i t n a l ' t , r l L l r , t g r : t , [ ' l ' I i c t l l r l ( ] i q / 1 l l)
,)
L i 1 . L e 1 ' ; ; L i r l - O I c 1 L . i . - l] r o l r i I i . i c t l L \ " r r : . i 1 1 l rf li l , l Use MATLAB to ger
The resulting plot, which is the bottom graph in Fig. 2.2' suggeststhat rather than z: -4 to 4. Labelth
scissaasz.
being constant, the drag coefficient seems to be increasing as the mass of the jumper

ffi=
llAb : "L x
<,
- [h

rtE-:l 5
:
vI
zl'+ Z] X+? I
PROBLEMS 39

continued

increases.Basedon this result,you might concludethat your model needsto be improved.


At the least,it rnight motivateyou to conductfurther experimentswith a larger numberof
jumpers to confirm your preliminaryfinding.
In addition, the result might also stimulateyou to go to the fluid mechanicsliteratureand
leam more aboutthe scienceof drag.If you did this. you would discoverthat the parameter
c.,is actually a lumped drag coefficient that along with the true drag includes other factors
such as thejumper's frontal areaand air density:
CoPA
(2.2)

where C, : a dimensionlessdrag coefficient,p : tir density (kg/mr), and A : frontal


area (m2), which is the areaprojectedon a plane normal to the direction of the velocity.
Assuming that the densitieswere relatively constantduring data collection (a pretty
good assumptionif thejumpersall took off from the sameheighton the sameday),F,q.(2.2)
suggeststhat heavierjumpersmight have largerareas.This hypothesiscould be substanti-
atedby rneasuringthe frontal areasof individualsof varying masses.

PROBTEMS
2.1A simplcelcctlic circuit consistingol' a rcsistur,a ca- 2 . f U s c t h c I i r : r p , r c e l ' u n c t i o nt o c r c a t c v c c t o r s i d c n t i c a l t o
pacitor,
andan induc(oris dcpictcdin Fig. P2.l. T'hcchargc t h c l i r l l o w i n g c r c a t c c lw i t h c o k l n n o l a t i o n :
onthecapacitor
ri(t) as a lirnctionol'limc can bc cor.nputcd (a) t : !:{r:-JlJ
as (b) r: t,:,.1
2.4 Usc colon notution lo crcatc vectors idcntical to the
l i r l l o w i n g c r c u t c dw i t h t h c I i n : , [ ) , ] .r : l i r n c t i o n :

(#)' ,] ( a ) r ' : I i r s l ) . r c ' { Ir l , I , t t


( b ) | : 1 r n s l r . r c e ( r ,0 , I I )
2 . 5 I l ' a l i r r c c I - ( N ) i s a p p l i c d t o c o n r p r c s sa s p r i n g , i t s d i s -
placcmcnt,r (rn) can ol'tcn bc rnodclcd by Hookc's law:
whcre I = time,r7o: thc initial chargc.1l : the rcsistancc,
I = inductance, and C : capacitancc.Usc MATLAB to Ij:lr
generate r plot o1'thislirnctionliorn / - 0 Io 0.7, givcn that
q o - 1 2R. : 5 0 ,L : 5 , a n d C : l 0 r .
2.2Thestandardnorrnalprobabilitydensitylirnction is a
bell-shaped curvethat can be rcprescntcdas
Inductor
l-
It-\- -
-, :-'-
\ ! /
/
/ ; - .

\/ llt

Resistor
UseMATLAB to gencrate a plot ol' this fbnction liom
;=-,1 to.1. Labcl thc ordinateas lrcquencyand the ab- F I G U R EP 2 . I
scissa
as:.

ffir
qA+,
<,
- [h
x
,"1{t 6 e[st
-l -l
1-l€- eJ 5t
zt'+ Z] X+ 8,
40 MATLABFUNDAMENTALS P

where k : the spring constant(N/m). The potentialenergy 2.8 lt is general practice in enginceringand sciencc that 2.13 You conractthe jur
storedin the spring U (J) can then be computedas equationsbe plotted as lines and discretedata as syrnbols. Table 2.1 and measure
Here is somcdatafbr conccntration({) \'elsustimc (l) for the values, which are order
l-
U: -(.r- photodegradation of aqueousbromine: conespondingvaluesin T
2

Five springsare testcdand the following data compiled: A,m2 o45A O4OlO
t, min t0 2A 3C 40 50 60
c, PPm 414 26 t6 t3 i0 c5
F,N ll )2 l5 9 t2 (a) If the air density is p
r,rr 0013 0020 0C09 0010 0012
compute values of tl
This datacan bc dcscribedby the lbllowing function:
cD.
(._ 4.g4.,.00r.1/ (b) Determine the averag
LlseMATLAB to storeF and,t as vectorsand thcn conrputc
resultingvalues.
vcctorsof the spring constantsand the potentialenergics.
Usc MATLAB to crci\tc a plot displayirrgboth the data (c) Develop a side-by-si
Use thc max l-unctionto dcterminethe maxirnumpotential
(r-rsingsquarcsymbols)and the function (using a dotted C, versusrr (right sic
cncruy.
l i n e ) .P l o tt h c l u n c t i o nl b r r : 0 t o 7 5 r n i n . and titles on the plots
2.6 The densityoi treshwater canhe computedasa lunction
2.9 The senii 1o9i, lunctiont)pcratcs in an idcnticalfashion 2.14 The following para
ol'tcmperaturcwith the firllowinecubiccquation:
to thc frlot, lirnction cxccpt that a logarithrnic(basc-10) that contractsexponentia
p: - 5 . - 5 2 8x9 l 0 - 8 f ( l - 8 . - 5 0 1 x6 t o ' - 6 7 < ? scale is used lirr thc l axis. Usc this l'unctionto plot the - srnI
-ll l, .
.r:c
s data ancl l'unctionas dcscribcdirr Prob. 2.t1.Explain thc nt ,
i 6.5622x l0 11 + 0.99987 .v=e cosl
result s.
whcre p : dcnsity (g/cnr31and 16' : tcmperat.urc('C). Usc 2.1() Hcrc is sorncwirrd tunncl data lirr lirrcc (I-) vcrsus
MATLAB to gencratea vcctor of tcrnpcraturesrangingliorn v e l o c i t y( r ' ) : Use subplor to genera
32 "F to 82.-1'F usingincrcrncntsof 3.6 oF.Convcltthrsvcc- (.r, .y) in the top pane and
tor tclclcgrecsCelsiusanclthe'ncomputca vcclorof dcrrsitics (x,.v,l) in the bottompane
-i"1.. u , m l s 1 0 ? . 0 3 0 4A 50 60 7A B0
hascdon the cubic lbrmula. Crcatea plot ol'p vcrsus 't5 7A 3BO 2.15 Exactly what will t
: -
519(7'F 32).
I t , N 5 5 0 6 r 0 t 2 2 A 8 3 0 1 450
Rccallthat T( MATLAB commandsare I
2.7 Manning'scquationcanbc uscdto compulcthc vclocity (a)>>x=z;
01'wirtcrin a rectanglllar
opcn channcl: >> x ^ 3;
This clatacan bc describcdhy thc lirllowingl'ur.rction: >>Y=B-x
. /s/ BH \t'
rt \B+2H/ I" : 0.2711ttt')x+t (b) rt q = 4:2:L0;
>> r - 17 B 4; 3
whercU: r,clocity(nr/s),S: channelslopc,n: roughncss LJsr'MATLAB to crcatc a plot displayingboth thc data >> sum(q) * r(2,
Ii: yu;.1,1.r
cocfl'icient, (nr),and /1 : dcpth(rn).Thc lirllo',v- (usingdiantondsymbols)and thc llnction (usirrga dottcd
ing datais availablclbr I'ivechannels: l i n e ) .P l o tt h c l u n c t i o nl i r r u : 0 t o 9 ( )n r / s .
2.ll Thc loc_{locr lirnclionopcratcsin an idcnticalI'ashion
n5BH to the fil()'. lirnction cxccpt(hatlogarithnricscalcsarc uscd
lirr both thc,r ancl.r'axcs.Usc this lunctionto plot thc dau
0 035 0 0001 t0 2 and lunctionas dcsclihcdin Proh.2. I0. Explaintlrc rcsults.
0.020 0 0002 B I 2.12 Thc Maclaurinscricscxpansiontirr thc sinc is
00r5 oo0to l9 t5
'24 3
0 030 0 0008
t5 '25 . .r'l .r5 ,r7 .r'')
a a22 0 0c103 Sln,I=-t-- + +--
.r! 51 71 9l

Storethesevaluesin a matrix whereeachrow reprcscntsone Use MATLAB to creatca plot o1'thcsine(solid linc) along
oi'thc channelsandcachcolumn representsone of the paranr- r.vitha plot o1'thcscriescxpansion(dashedline) up ttr andin-
ctcrs.Writc a single-lineMATLAB statcmentto conputc a cluding the terni -r7171.Usc the Lruilt-intirnctionf .rct1)r
column vectorcontainingthe vclocitiesbasedon the virlues ial in conrputingthe scriesexpansion.Make the rangeof
in the parametermatrix. the abscissali'onr,r : O to 3tr 12.

+fi6-qrlal
4-t

zl 4+ a. th
-r

jlg- 1 5t
-----j

7l Llz *2f 5[st


" ::- ;:,

.l

z['+* Z] X+? I
PROBTEMS 4l

2.13You contactthe jumpers used to generatethe data in 2.16 The trajecbry of an object can be modeledas
Table2.1 and measure their frontal areas.The resulting
values,which are ordered in thc same sequenceas the R.
):(tando).\--r'*)t,
conespondingvaluc-sin Table 2. l, are IU;COs.d0

A,nt2 0.454 0 401 0 453 0 485 0 532 a 474 A 4B6 where _v: height (m), d,, : initial angle (radians),r :
horizontal distance (m), g = gravitationalacceleration
( : 9 . 8 1 m / s r ) ,u , , : i n i t i a lv e l o c i t y( m / s ) ,a n d y , , : i n i t i a l
find the displacementfbr r',, : Q
(a) Il the air densityis p : 1.225kg/mr, use MATLAB to height. Use MATLAB to
and r,,:30 nr/slbr initial angle-s rangingliom l5 to 75o in
computevaluesof the dimensionless drag coefficicrrt
increrncnts of 1,5".Employ a rangeof horizontaldistances
cD.
(b) Deternrine from -t : 0 to 100m in incremcnts of 5 m. Thc resultsshould
the average,minimunrand rnaxirlumol'thc
be assernblcd in an array where thc first dimension(rows)
resulting values.
distances.and the seconddimension
(c) Dcvelopa side-by-side plot ofA versusrr (lcft sidc)and correspondsto the
(columns)correspondsto the difl'erentinitial angles.Use
C.,versusrr (right side).lncludedescriptivcaxis liibels
this matrix to gcncratea singlc plot of thc hcightsversus
andtitlcson the plots.
horizontaldistanceslbr eachof the initial angles.E,rnploya
2.11The lbllowing paramctricequllirrrrsgenerrlc-l hclix
legenclto di.stinguish among the dill-crentcases.and scale
thatcontriicts r'xponentially
as it cvolvcs
thc plot so that thc minirnumheightis zero usingthe azis
.r:e ol'sinI commancl.
\'=c CosI 2.17 The lcmperature dcpendence ol'chcmicalreactionscan
bc ctrrnprrtetl wilh theArrhaniu.tt'tlutrtittn;

Usesubpl,rr to gcneratca two-dimcnsionallinc plot ot'


(-r,i') in the top pane and a three-dirncnsional k - Aa t'itRI,,1
line plot ol'
(,r,r, :) in thc bottom panc.
wherck: rcactionratc(s r).A : thc prccxponential (or tie-
2.15Exactlywhal will be displaycd alier thc lirllowing
quency)lactor,E: activationenergy(J/mol),R - gascon-
MATLABcourmandsarc typcd'l
stant [8.314J/(rnolc . K)], and l, : absolutetemperaturc
(a) -'> x - 2;
( K ) . A c o r n p o u n d h a s El :x l O s J / m oaln d A : 7 x 1 0 1 6 .
:':' X' l;
Usc MATLAB to gcncratevalucsol reactionratcs1brtem-
>-../ - lt x
peralurr-s rangin-u lrom 273 to 333 K. Usc subplot to gc'n-
(b)t- q . . 1: 2 : 1 0 ; crater sidc-by-side graphol'(a) /<vcrsusI,, and (b) logr{)ft
>> r . f] I 4; ) 6 2.);
vcrsus l/7,,. Enrploythc semi l.rqy functionto crcatc(b).
> > : i L l l r ( c 1 )* r(2, 3)
Interpretyour rcsults.

ffi=
z\4+ "L
<, lh

,jF-\ :
x
z,_! u=4
zt + zl F+ 3$8
3,I M-FITES 43

We also learnedthat a numericalsolutionof this eouationcould be obtainedwith Euler's


method:
dut
Ui+l: ui + Lt
dt
This equation can be implementedrepeatedlyto compute velocity as a function of
time. However, to obtain good accuracy,many small stepsmust be taken.This would be
extremelylaboriousand time consumingto implementby hand.However,with the aid of
MATLAB, suchcalculationscan be performedeasily.
So our problem now is to figure out how to do this. This chapterwill introduceyou to
how MATLAB M-files can be usedto obtainsuchsolutions.

3. I M-FIEs
The most common way to operateMATLAB is by enteringcommandsone at a time in the
command window. M-files provide an alternative way of performing operationsthat
greatly expand MATLAB's problem-solvingcapabilities.An M-file containsa seriesof
statementsthat can be run all at once.Note that the nomenclature"M-flle" comesliom the
fact that suchfiles are storedwith a .m extension.M-files comein lwo flavors:scrintfiles
and functionfiles.

3.l. t ScriptFiles
A scriptfile is merely a seriesof MMLAB comnrandsthat are savedon a file. They are
useful for retaininga seriesof commandsthat you want to executeon more than one occa-
sion.The scriptcan be executedby typing the file name in the commandwindow or by
invokingthe nrenuselections in the edit window: Debug,Run.

EXAMPTE
3.I S c r i p tF i l e

Problem Stotement. Developa script lile to computethe velocity of the lree-falling


bungeejumper.

Solution. Openthe editorwith the menuselection:File,New, M-file.Type in the fbllow-


ing statenrents to computethe velocityof the fiee-tallingbungeejunrperat a specifictime
[recalEl q. ( 1 . 9 )]:

9 = 9.81; m = 68.1; L - 12; cd = 0.25;


v = sqrt(g * m / cd) * tanh(sqrt-(g * cd / m) * L)
Savethe file as scriptdemo . rn.Returnto the commandwindow and typc
>>scriptdemo

The result will be displayedas

50.6175
just as if you had typedeachof its linesin the comntandwinclow.
Thus,the scriptexecutes

ffi L <,
- [h
---_ x eJ 5
zf Lt.t --At ^l
5[ st zJ lj€-
-l

zl'+
-{
zf x+ 8,
Exploring the Variety of Random
Documents with Different Content
peoples of the five continents, and is still retained in some parts of
Africa and elsewhere. In Holstein, Germany, it prevailed in all its
purity, according to Ploss, till the end of the fifteenth century. Nor
would it be doing facts great violence to class our frequent money-
marriages under this head.
There are two grades of the custom of Purchase. In the first the
girl has no choice whatever, but is sold by her father for so many
cows or camels, in some cases to the highest bidder. Among the
Turcomans a wife may be purchased for five camels if she be a girl,
or for fifty if a widow; whereas among the Tunguse a girl costs one
to twenty reindeer, while widows are considerably cheaper. In the
second class of cases the purchased girl is allowed a certain degree
of liberty of choice, as we shall see directly, under the head of
Individual Preference.
(3) Service.—On the custom of securing a wife by means of
services rendered her parents, Mr. Spencer remarks: “The practice
which Hebrew tradition acquaints us with in the case of Jacob,
proves to be a widely-diffused practice. It is general with the Bhils,
Ghonds, and Hill tribes of Nepaul; it obtained in Java before
Mahometanism was introduced; it was common in ancient Peru and
Central America; and among sundry existing American races it still
occurs. Obviously, a wife long laboured for is likely to be more
valued than one stolen or bought. Obviously, too, the period of
service, during which the betrothed girl is looked upon as a future
spouse, affords room for the growth of some feeling higher than the
merely instinctive—initiates something approaching to the courtship
and engagement of civilised peoples.”

INDIVIDUAL PREFERENCE

All the cases thus far referred to relate to what might be called
indirect or mediate courtship. When a girl is captured and knocked
on the head she can hardly be said to be courted and consulted as
to her wishes; and the man too, in such cases, owing to the dangers
of the sport, is apt to pay no great attention to a woman’s looks and
accomplishments, but to bag the first one that comes along. In
courtship by Purchase, again, the girl is rarely consulted as to her
own preferences, the addresses being paid to the father, who
invariably selects the wealthiest of the suitors, and only in rare cases
allows the daughter a choice, as among the Kaffirs if the suitors
happen to be equally well off. And thirdly, in courtship by Service,
the suitor’s work is not done to please the daughter, but to
recompense the parents for losing her.
Yet there appear to be some instances of real courtship, in the
modern sense of the word, among the lower races, where the lovers
pay their addresses directly to the girl and she chooses or rejects at
will. Thus, among the Orang-Sakai, on the Malayan peninsula, the
following custom prevails, as described by Ploss: “On the wedding-
day, the bride, in presence of her relatives, and those of her lover,
and many other witnesses, is obliged to run into the forest. After a
fixed interval the bridegroom follows and seeks to catch her. If he
succeeds in capturing the bride she becomes his wife, otherwise he
is compelled to renounce her for ever. If therefore a girl dislikes her
suitor, she can easily escape from him and hide in the forest until the
time allowed for his pursuit has expired.”
Darwin remarks, in trying to prove the existence of Sexual
Selection among the lower races, that “in utterly barbarous tribes
the women have more power in choosing, rejecting, and tempting
their lovers, or of afterwards changing their husbands, than might
have been expected;” and he cites the following cases, among
others: “Amongst the Abipones, a man on choosing a wife, bargains
with the parents about the price. But ‘it frequently happens that the
girl rescinds what has been agreed upon between the parents and
the bridegroom, obstinately rejecting the very mention of marriage.’
She often runs away, hides herself, and thus eludes the bridegroom.
Captain Musters, who lived with the Patagonians, says that their
marriages are always settled by inclination; ‘if the parents make a
match contrary to the daughter’s will, she refuses, and is never
compelled to comply.’ In Tierra del Fuego a young man first obtains
the consent of the parents by doing them some service, and then he
attempts to carry off the girl; ‘but if she is unwilling, she hides
herself in the woods until her admirer is heartily tired of looking for
her, and gives up the pursuit; but this seldom happens.’”

PERSONAL BEAUTY AND SEXUAL SELECTION

Evidence proving that primitive women are influenced in their


choice of a mate by æsthetic considerations appears to be almost as
scant as among animals. Darwin, however, tries to prove that men
owe their beards to sexual or female selection; and the following
more general instances may be cited for what they are worth: Azara
“describes how carefully a Guana woman bargains for all sorts of
privileges before accepting some one or more husbands; and the
men in consequence take unusual care of their personal
appearance.” Among the Kaffirs “very ugly, though rich men, have
been known to fail in getting wives. The girls, before consenting to
be betrothed, compel the men to show themselves off first in front
and then behind, and ‘exhibit their paces.’”
In general, however, it seems that the women choose, not the
handsomest men, but those whose boldness, pugnacity, and virility
promise them the surest protection against enemies, and general
domestic delights. Thus, we read that “before he is allowed to marry,
a young Dyack must prove his bravery by bringing back the head of
an enemy;” and that when the Apaches warriors return
unsuccessful, “the women turn away from them with assured
indifference and contempt. They are upbraided as cowards, or for
want of skill and tact, and are told that such men should not have
wives.”
It must be remembered, however, that (as we have seen in the
case of plants and animals) the greatest amount of health, vigour,
and courage generally coincide with the greatest physical beauty;
hence the continued preference of the most energetic and lusty men
by the superior women who have a choice, has naturally tended to
evolve a superior type of manly beauty.
In the case of men it seems much more probable that they
frequently select their wives in accordance with an æsthetic
standard. The chiefs of almost every tribe throughout the world have
more than one wife; and Mr. Mantell informed Darwin that until
recently almost every girl in New Zealand who was pretty, or
promised to be pretty, was tapu to some chief; while among the
Kaffirs, according to Mr. C. Hamilton, “the chiefs generally have the
pick of the women for many miles round, and are most persevering
in establishing or confirming their privilege.” In the lower tribes,
where “communal marriage” and marriage by Capture alone prevail,
æsthetic choice is of course out of the question, and cannot make its
appearance till we come to less pugnacious tribes, such as the
Dyacks, whose children “have the freedom implied by regular
courtship,” or the Samoans, whose children “have the degree of
independence implied by elopements when they cannot obtain
parental assent to their marriage” (Spencer).
In general, however, among the lower races, Sexual or æsthetic
Selection leads to sorry results, owing to the bad taste of the
selectors. The standard of primitive taste is not harmonious
proportion and capacity for expression, but Exaggeration. The negro
woman has naturally thicker lips, more prominent cheek-bones, and
a flatter nose than a white woman; and in selecting a mate,
preference is commonly given to the one whose lips are thickest,
nose most flattened, and cheek-bones most prominent: thus
producing gradually that monster of ugliness—the average negro
woman. What right we have to set ourselves up as judges, and claim
that our taste is superior to the negro’s, is a question which will be
discussed in a subsequent section of this treatise.
One other point, however, may be referred to here, namely, that
although the æsthetic overtone of Love—the Admiration of Personal
Beauty—may enter into a savage’s amorous feelings, it is only the
sensuous aspect of it that affects him, the intellectual and moral
sides being unknown to him. His admiration is purely physical. He
marries his chosen bride when she is a mere child, and before the
slightest spark of mental charm can illumine her features and impart
to them a superior beauty; and subsequently, when experience has
somewhat sharpened her intellectual powers, hard labour has
already destroyed all traces of her physical beauty so that the
combination of physical and mental charms which alone can inspire
the highest form of Love is never to be found in primitive woman.

JEALOUSY AND POLYGAMY

The moral mission of Jealousy, as stated on a preceding page, is,


by means of watchfulness and the inspiring of fear, to ensure fidelity
and chastity. Darwin says that from the strength of the feeling of
jealousy all through the animal kingdom, as well as from the analogy
of the lower animals, especially those which come nearest to man,
he “cannot believe that absolutely promiscuous intercourse prevailed
in times past, shortly before man attained to his present rank in the
zoological scale.” This may be true, yet it is astonishing to find how
many of the lower tribes are utterly unconcerned regarding the
morals both of married and unmarried women. A vast number of
cases illustrating this absence of jealousy are collected in Waitz’s
Anthropology, Spencer’s Sociology, the works of Lubbock, and
especially in Ploss’s Das Weib, i. 205-214. In some cases girls are
allowed to do as they please until after marriage, when they are
jealously guarded; in other cases the reverse is true. In some parts
of Africa a breach of faith on the wife’s part is regarded as an attack
not on the husband’s honour but on his property; hence a pecuniary
compensation is all that is required. Lubbock enumerates a large
number of races among whom the lending of a wife or daughter is a
common and obligatory form of hospitality. And the Chibchas of
South America went so far in their indifference to virginity that they
considered a virgin bride to be unfortunate, “as she had not inspired
affection in men.”
Jealousy for the possession of a woman, however, was much
sooner developed than jealous regard for her conduct. The
statement of Sir John Lubbock about the men of an Indian tribe,
that they “fight for the possession of the women, just like stags,”
and similar statements regarding other savages, imply that, just like
stags, these men feel the pangs of primitive Jealousy.
Among polygamous nations the women, too, often fight for the
men, whose favourites in their absence are apt to suffer much at the
hands of jealous rivals. It is among the polygamous semi-civilised
nations in general that Jealousy asserts itself in the most shrill and
dissonant manner. It is not that bitter-sweet romantic Jealousy which
by its constant fluctuations between hope and doubt fans a modern
lover’s passion into brighter flames; it is a more vicious kind of
conjugal Jealousy which destroys domestic peace and plots the ruin
of rivals. In Madagascar, Mr. Spencer tells us, “the name for Polygyny
—‘fampovafesana’—signifies ‘the means of causing enmity’”; and
that kindred names are commonly applicable to it we are shown by
their use among the Hebrews: in the Mishna a man’s several wives
are called ‘tzârot,’ that is, troubles, adversaries, or rivals. In modern
Persia, where polygamy prevails, the same state of affairs is
encountered. Says Ploss: “If there are several women in the house,
each one inhabits a separate division; in the houses of the wealthy
each wife, moreover, has her own servants. Constantly apprehending
evil intentions, no woman touches the dishes of a rival.”
It is among the polygamous nations of the East, too, that history
records such a profusion of bloody wars of succession waged by
half-brothers; for how could fraternal or any other kind of domestic
affection flourish in families where the mothers are constantly
goaded by Jealousy into deadly hatred of one another?

MONOPOLY AND MONOGAMY

The United States being a “free country,” its government has


sometimes been blamed by “freethinkers” for attempting to repress
Mormon Polygamy. But a free country is not one in which social
experiments injurious to public welfare are to be necessarily allowed.
Readers of history and anthropology know that polygamy is an
experiment which has been tried so often with disastrous social
results, that it may be looked upon safely as criminal and treated
accordingly. Even the forcible argument of that spiteful old pessimist,
Schopenhauer, that polygamy should be introduced because it would
rid the world of old maids, does not save the institution; since it is
well—for the prospects of Beauty, at any rate—that some women
should be “eliminated” in the form of old maids.
Among the causes which tended to make polygamy the
commonest form of marriage among savages, four may be briefly
enumerated: (1) The constant wars among the tribes decimated the
men, leaving a larger proportion of women than men, although this
was to some extent neutralised by the habit of female infanticide,
which the women indulged in to make themselves more cherished
through scarcity and, possibly, to preserve their beauty; (2) The
women being commonly secured as booty in war, it was naturally
looked on as an honour and a sign of valour to have more than one
wife; (3) Women being regarded and treated as slaves, the more a
man had of them the more they could, by their combined labour,
increase his wealth and influence in the tribe; (4) The rapid decay of
the youthful beauty of primitive woman, naturally inclined her
husband, whose affection was solely based on those physical
charms, to add a second or third, younger woman to his harem.
As woman’s position improved with advancing civilisation, these
influences favouring polygamy were gradually weakened; and as in
treating of Love among Animals, we found the most remarkable
instances of affection—conjugal and romantic—among birds, who
are mostly monogamous; so, among the lower races of man,
monogamy is commonly a sign of superior culture and higher
development of the affections. And this might have been foreseen a
priori, inasmuch as monogamy is the only marital relation compatible
with that Monopoly of affection which is one of the conditions of
Romantic Love. How could a man feel an exclusive amorous interest
in his bride, knowing that in a few months or years another would
come to claim half his interest? or how could the bride concentrate
all her Love on a man of whom she knew that he could give her only
half or a smaller fraction of his affection?
A similar view is taken by Mr. Spencer. Monogamic unions, he
says, “tend in no small degree indirectly to raise the quality of adult
life, by giving a permanent and deep source of æsthetic interest. On
recalling the many and keen pleasures derived from music, poetry,
fiction, the drama, etc.; and on remembering that their predominant
theme is the passion of love, we shall see that to monogamy, which
has developed this passion, we owe a large part of the gratifications
which fill our leisure hours.”

PRIMITIVE COYNESS

Among the Samoiedes, says Klemm, “a man purchases a wife for


a number of reindeer, varying from five to twenty; the bride, as is
the case also in Greenland, struggles violently against leaving the
paternal house, and commonly she has to be caught forcibly and
bound on the bridegroom’s sledge.” In some of the Bedouin tribes
the destined bride runs from tent to tent to escape being brought to
the bridegroom. When an Esquimaux girl is asked in marriage, says
Kranz (quoted by Mr. Spencer), she “directly falls into the greatest
apparent consternation and runs out of doors, tearing her bunch of
hair; for single women always affect the utmost bashfulness and
aversion to any proposal of marriage, lest they should lose their
reputation for modesty.” So among the Bushmen a lover’s attentions
“are received with an affectation of great alarm and disinclination on
her part”; while an Arab bride “defends herself with stones, and
often inflicts wounds on the young men, even though she does not
dislike the lover; for according to custom, the more she struggles,
bites, kicks, cries, and strikes, the more she is applauded ever after
by her own companions.”
Obviously these glacier, forest, and desert belles have a somewhat
cruder way than our city belles of hiding their feelings.
Mr. Spencer refers to the Coyness of these maidens as one motive
or cause of wife-capture, but he does not inquire into the origin of
Coyness itself, which is a much more interesting point in the
psychology of Love. The fear “lest they should lose their reputation
for modesty,” mentioned above, is the most obvious cause of this
exaggerated resistance, as it is of the excessive prudishness often
encountered in some European civilised countries of to-day. Again,
the sight of the harsh treatment to which her married sisters or
friends are subjected, would make the primitive bride naturally
averse to exchange her maiden freedom for conjugal slavery.
It seems, however, that in most cases, the Coyness is less real
than simulated; and for this form of Coyness—reversing Mr.
Spencer’s reasoning—we may say that Exogamy, or Capture, is
responsible. For since Capture implies courage and valour on the
part of the husband, it may have been to secure the “prestige of a
foreign marriage”—as fashionable novelists would say—that the form
of Capture was imitated in cases where there was no opposition,
either on the part of the girl or her parents.
Another explanation of sham Coyness is afforded by the following
case: Among the inhabitants of the Volga region, in Russia, the bride
is occasionally captured and carried off, though here too there is no
opposition on her part or from her parents. The cause of this
procedure is the desire to avoid the expenses of the marriage
ceremony, which in that region are out of all proportion to the
means of the lower classes.
Finally it may be suggested that Coyness, so far as it really exists
in the primitive maiden, owes its origin to the instinctive perception
that the men value them more if they do not throw themselves into
their arms on the first impulse. And more than anything else, this
attitude of reserve feeds the flames of Romantic Love by transferring
its delights and pangs to the imagination.
Yet, after all, manifestations of Coyness must be the exception
and not the rule in the lower races, inasmuch as in the vast majority
of cases, where no choice is allowed the bride, there is little or no
opportunity for the exercise of such a trait.
Of Gallantry I have not succeeded in discovering any traces in the
records of savage life, except possibly in the case of the natives of
Kamtchatka, where the wooer has to go into service for his bride,
and during this time endeavours constantly to lighten her labours
and make himself agreeable to her. So far as Gallantry occurs, it is
more likely to be a feminine trait—as among one of the North
American Indian tribes, where the maiden cooks her suitor’s game,
and sends him back the best morsels with presents; or as with
another tribe, the Osages, where the maidens pay court to the
warriors by offering them ears of corn.
As for the remaining characters of Romantic Love, which require a
vivid imagination and persistent emotions for their realisation, it
would be useless to look for them in Savagedom—except perhaps in
those infinitesimal proportions in which various chemical substances
are found by analysts in mineral waters. The following may be
offered as an approximate list of the ingredients in the Love of
savage and semi-civilised peoples:—
Selfishness 25·7684
Inconstancy 20·3701
Jealousy 0 to 20·7904
Coyness ” 10·5523
Individual Preference ” 5·0073
Personal Beauty ” 5·7002
Monopoly ” 7·3024
Pride of Possession 4·5082
Sympathy 0·0000
Gallantry 0·0006
Self-Sacrifice Traces
Ecstatic Adoration ”
Mixed Emotions ”

CAN AMERICAN NEGROES LOVE?

It is a very interesting question how far the negroes transplanted


to America, who have adopted so many of the habits and ways of
thinking of their white neighbours, are capable of forming a true
romantic attachment, characterised by the various traits described in
this work. I have not been able to find any conclusive evidence on
this head; and should any readers of this book positively know any
cases, I should be greatly obliged if they would forward a detailed
account of them to me, in care of the publisher.
As regards a negro’s capacity for falling in Love with a white
woman, the following interesting communication[1] appeared in the
New York Nation, 12th February 1885: “In corroboration of ‘Bill Arp’s’
view, referred to in No. 1020 of the Nation, that negroes, as a race,
do not desire to ‘mix’ with the white race, I may cite a remark
recently made by a negro carpenter to a friend of mine. The latter
said to him, as a village belle passed them on the street, ‘Charles,
don’t you think that’s a very handsome young lady?’ ‘I reckon so,’ he
answered doubtfully, and immediately added, ‘Fact is, boss, us
coloured folks don’t think white ladies handsome; we like ’em
coloured the best.’
“Had it been otherwise there would, doubtless, have been
innumerable instances, in the North as well as at the South, of love-
longings on the part of negro men toward girls of the dominant race.
Yet during all the years I have spent in the Southern States, I never
knew or heard of any instances of this kind, and their exceptional
character in the North must be known to all your readers. The
hopelessness of such attachments would, of course, diminish their
number; but fancy is always free, and ‘hopeless attachments’ among
members of the same race are as common now as when Petrarch
sighed for Laura, and Tasso wrote ‘The throne of Cupid has an easy
stair,’ himself having climbed it uninspired by hope. The existence of
many persons of mixed blood throughout the country affords no
proof that the two races feel toward each other the attraction of
love; for the fathers, in these cases, are almost invariably white, and
the offspring cannot be called ‘love-children,’ but the fruit of mere
passion linked with opportunity.”

1. Signed Sue Harry Clagett.

HISTORY OF LOVE
It would be a profitless task to hunt for the first traces of the
various elements of Love in the records of all the nations of
antiquity; for we meet almost everywhere with the same old story of
Romantic Love impeded in its growth or its very existence by the
degraded position of women, and by the absence of opportunities
for courtship, and for free matrimonial choice. A few remarks,
however, must be made concerning Love among the ancient
Egyptians, Hebrews, Greeks, Romans, and our Aryan kinsfolk in
India, before passing on to Mediæval and Modern Love.

LOVE IN EGYPT

Dr. Georg Ebers, the Leipzig professor, and author of the popular
series of historic Egyptian novels, remarks that “if it is true that a
nation’s degree of culture can be estimated by the more or less
favourable position accorded its women, then Egyptian culture ranks
above that of all other ancient peoples.”
The women of ancient Egypt were not kept in seclusion like those
of Greece. They did their own marketing, and had other domestic
and public liberties and privileges which astonished the Greek
historian Herodotus, who also mentions that although polygamy was
tolerated among them, monogamy was the rule. Inasmuch as the
Egyptians had an advanced culture, invented many arts, promoted
the sciences, and were industrial rather than militant in their
occupations, it is possible that several of the more refined elements
of Romantic Love may have existed among them; for just as we
have seen that some animals have higher notions of love, conjugal
and romantic, than some savages, although the latter represent a
later stage of evolution, so it seems probable that among the nations
of antiquity Love did not progress steadily, year by year; but that
some nations had more and some less of it; while the acquisitions of
one period may have been lost in evil and corrupt times following, as
was certainly the case in India.
Since we have no such extensive literature of Egypt as we have of
the Greeks, Romans, and Hebrews, it is not easy to arrive at definite
conclusions. But the Egyptian custom of forming “trial marriages” for
one year, and the ease with which a husband could divorce and
expel his wife by simply pronouncing three words in her presence do
not harmonise with our modern notions of Love. How scornfully a
modern Romeo would reject the very notion of such a trial-marriage!
for does he not feel absolutely certain that his Love is eternal and
unalterable?
The institution of trial-marriages seems to point to the conclusion
that the Egyptians, like the Greeks, looked upon marriage primarily
as a means of augmenting the family and the state, and not as a
union of loving souls—children or no children—which is the modern
ideal.
Professor Ebers of course has a right to make use of a poetic
license in painting the Love affairs of his Egyptian heroes and
heroines in modern colours, as Shakspere does in Antony and
Cleopatra. At the same time it would give an added flavour to
historic romances if their pictures of domestic and public life were
characterised by emotional realism as well as by general antiquarian
accuracy. The elaborate analysis of Love, for the first time attempted
in the present monograph, should facilitate this task for novelists.

ANCIENT HEBREW LOVE

It is almost startling to find, on consulting a Concordance of the


Old and New Testaments, that in the whole of the Bible there is not
a single reference to Romantic Love. Had this sentiment existed
among the ancient Hebrews as it does among their descendants to-
day, it is obvious that it could not possibly have been ignored in the
Book of Books, which so eloquently and poetically discourses of
everything else that is of vital interest to man. Conjugal Love (which
apparently antedates Romantic Love in every nation) is indeed
repeatedly referred to and enjoined, as well as the other family
affections; but in the remaining cases the word Love is always used
in the sense of religious veneration, or of regard for a neighbour or
an enemy.
This absence of any reference to Romantic Love is all the more
surprising in view of the fact that among the ancient Hebrews
woman was held more in honour than with any other Oriental
nation, ancient or modern. Thus we are told in M‘Clintock and
Strong’s Cyclopædia of Biblical etc. Literature, that “the seclusion of
the harem and the habits consequent upon it were utterly unknown
in early times, and the condition of the Oriental woman, as pictured
to us in the Bible, contrasts most favourably with that of her modern
representative. There is abundant evidence that women, whether
married or unmarried, went about with their faces unveiled. An
unmarried woman might meet and converse with men, even
strangers, in a public place; she might be found alone in the country
without any reflection on her character; or she might appear in a
court of justice.” The wife “entertained guests at her own desire in
the absence of her husband, and sometimes even in defiance of his
wishes.”
Since, therefore, the Hebrew woman was not “the husband’s slave
but his companion,” how are we to account for the absence of Love?
Some light is thrown on the matter by the prevalence of polygamy,
which, as we have seen, is inimical to the growth of Love. Polygamy,
though not universal, was sanctioned by the Mosaic law, except in
the case of priests. “The secondary wife was regarded by the
Hebrews as a wife, and her rights were secured by law.” In the cases
of Abraham and Jacob, polygamy was resorted to at the request of
their own wives, “under the idea that children born to a slave were
in the eye of the law the children of the mistress.” Now if a woman
advises her own husband to take another wife, there must be a total
absence of Jealousy and Monopoly—the two elements of Romantic
Love which pass into conjugal affection without diminution of force.
Again, although Hebrew women are said to have had considerable
liberty of going about alone in town and country, this probably refers
in most cases to the privilege of tending sheep and of fetching water
at the well. “From all education in general,” says Ploss, “as well as
from social intercourse with men, woman was excluded; her
destination being simply to increase the number of children, and
take care of household matters. She lived a quiet life, merely for her
husband, who, indeed, treated her with respect and consideration,
but without feeling any special tenderness toward her.”
It is the line which I have italicised in the above quotation that
suggests the principal reason of the non-existence of Love in Biblical
times: There were no meetings of the young, no opportunities for
Courtship, the indispensable condition of Love, which requires time
and opportunity for its growth. And not only were there no regular
opportunities for Courtship, but if they offered themselves casually,
the young folks could not derive much benefit, from them; for not
only the daughter’s choice, but even the son’s was neutralised by the
parental command. “Fathers from the beginning considered it both
their duty and prerogative to find or select wives for their sons (Gen.
xxiv. 3; xxxviii. 6). In the absence of the father, the selection
devolved upon the mother (Gen. xxi. 21). Even in cases where the
wishes of the son were consulted, the proposals were made by the
father (Gen. xxxiv. 4, 8); and the violation of this parental
prerogative on the part of the son was ‘a grief of mind’ to the father
(Gen. xxvi. 35). The proposals were generally made by the parents
of the young man, except when there was a difference of rank, in
which case the negotiations proceeded from the father of the
maiden (Exod. ii. 21), and when accepted by the parents on both
sides, sometimes also consulting the opinion of the adult brothers of
the maiden (Gen. xxiv. 51; xxxiv. 11), the matter was considered as
settled, without requiring the consent of the bride” (M‘Clintock and
Strong).
But how about the Song of Solomon—the Song of Songs? Is not
that a song of Love, and an exception to our general statement? It
appears so at first sight; and the German writer Herder, in his
detailed and glowing analysis of it, declares that it depicts love “from
its first origin, from its tenderest bud, through all stages and
conditions of its growth, its flowering, its maturing, to the ripe fruit
and new offshoot.” Herder, however, is a very unsafe and shallow
guide in this matter. An attempt has lately been made to rehabilitate
him in Germany, where his fame has become almost extinct; but in
vain, for his pompous, stilted rhetoric and imagery cannot conceal
from modern readers his lack of ideas and limited knowledge of
facts. He asserts that, as there is only one Goodness, one Truth, so
there is but one Love (or Affection). If you do not love your wife, he
says, you will not love your friend, parents, or child. A writer whose
notions of the psychology of love are so excessively crude cannot be
considered a trustworthy judge in the matter in question. So far as
love is referred to in the Song of Solomon, it is probable that
conjugal affection is meant.
It is a curious fact that of the famous German, English, and French
theologians who have written commentaries on the Song of Songs,
no two seem to agree in their interpretation of its plot and
significance. It is now generally agreed, too, that the Song was not
written by Solomon, but some time after him. It seems, indeed,
incredible that a monarch who had a thousand wives, and whose
affections must have been torn into a thousand shreds, and cannot
have been very lasting, should have written these marvellous lines:
“For love is strong as death; jealousy is cruel as the grave: the coals
thereof are coals of fire, which hath a most vehement flame. Many
waters cannot quench love, neither can the floods drown it: if a man
should give all the substance of his house for love, it would utterly
be contemned.”
This passage has a remarkably modern and romantic sound—so
modern and romantic that it would not seem out of place in
Shakspere. But it needs no knowledge of Hebrew to see that the
responsibility for this modern sound rests with the English
translators. Luther’s more literal version appears much less modern.
Indeed, throughout the Song of Solomon the English translators
have idealised the language of passion, in harmony with modern
notions on the subject; so that it is only on reading Luther’s version
that one begins to understand why the Talmudists did not allow the
Jews to read this book before their thirtieth year.
Perhaps the most ingenious and consistent of the numerous
interpretations of the Song of Solomon is that given by M. Chas.
Bruston in the Encyclopædie des Sciences Religieuses (ii. 610-612).
The repetition of the flatteries occurring in the poem he explains by
showing that the second time they refer, not to the Sulamite, but to
a princess of Lebanon whom Solomon married. Hence, he insists,
the repetition is not so much a literary blemish as an indication
“combien est vil et méprisable l’amour sensuel et polygame, qui
prodigue indifférement les mêmes flatteries a des femmes
différentes.”
The imaginative and poetic terms in which feminine charms are
depicted in the Song of Songs show that, nevertheless, at least the
sensuous phase of the overtone of Personal Admiration was strongly
developed among the ancient Hebrews; not strongly enough,
however, to lead them, as it led other ancient nations, to embody
their ideals of feminine and masculine beauty in marble monuments
of sculpture.

ANCIENT ARYAN LOVE

As it is among the Aryan or “Indo-Germanic” races of Europe and


America that Modern Love has produced its most beautiful blossoms,
it is, even more than in the case of the non-Aryan Jews and
Egyptians, of interest to know something concerning its prevalence
among the Asiatic peoples who appear as the nearest modern
representatives of our remote Aryan ancestors.
In no country, perhaps, has the position of woman differed so
greatly at various epochs as in India. Previous to the introduction of
Brahminism, women were held in esteem, enjoyed diverse privileges,
and were allowed free social intercourse with the men, while
monogamy was the recognised form of marriage. The Brahmins,
however, introduced polygamy, setting a good example by
sometimes marrying a whole family, “old and young, daughters,
aunts, sisters, and cousins”; and one case is known of a Brahmin
who had 120 wives, according to Schweiger Lerchenfeld. Family
feeling was subordinated to considerations of caste, and by a
sophistical interpretation of ancient laws the Brahmins introduced
the custom of Suttee, or the burning alive of widows on the
deceased husband’s funeral pyre. This habit is sometimes regarded
as the very apotheosis of conjugal affection, but it was simply what
is known in modern psychology as an epidemic delusion; the poor
women being rendered willing to sacrifice themselves by the
doctrine that to die in this way was something specially voluptuous
and meritorious; while those who refused to be immolated were
treated as social outcasts who were not allowed to marry again or to
adorn their persons in any way.
The references to women in the laws of Manu show in what low
esteem they came to be held in India. A few of the maxims
contained in this work may be cited: “Of dishonour woman is the
cause; of enmity woman is the cause; of mundane existence woman
is the cause; hence woman is to be avoided.” “A girl, a maiden, a
wife shall never do anything in accordance with her own will, not
even in her own house.” “A woman shall serve her husband all life
long, and remain true to him even after death; even though he
should deceive her, love another, and be devoid of good qualities, a
good wife should nevertheless revere him as if he were a god; she
must not displease him in anything, neither in life nor after his
death.” So wretched, indeed, became woman’s lot that Indian
mothers, it is said, “often drown their female children in the sacred
streams of India, to preserve them from the fate awaiting them in
life.” Letourneau states that “up to modern times Hindoo laws and
manners have been modelled after the sacred precepts. When
Somerat made his voyage, it was considered improper for a
respectable woman to know how to read or dance. These futile
accomplishments were left to the courtesan, the Bayadere.”

HINDOO LOVE MAXIMS

That such a state of affairs was not favourable to Romantic Love is


obvious. Nevertheless there appears to have been a period—about
1200 or 1500 years ago—when some of the inhabitants of India
were familiar with most of the emotions which enter into Modern
Love. This evidence is contained in the Seven Hundred Maxims of
Hâla, a collection of poetic utterances dating back not further than
the third century of our era, and comprising productions by various
authors, including as many as sixteen of the female persuasion.
They are written in a sister-language of Sanscrit, the Prâkrit; and
their form indicates that they were intended to be sung. Herr
Albrecht Weber remarks in the Deutsche Rundschau with reference
to this collection: “At the very beginning of our acquaintance with
Sanscrit literature, towards the end of the last century, it was
noticed, and was claimed forthwith as an eloquent proof of antique
relationship, that Indian poetry, especially of the amatory kind, is in
character remarkably allied to our own modern poetry. The
sentimental qualities of modern verse, in one word, were traced in
Indian poetry in a much higher degree than they had been found in
Greek and Roman literature; and this discovery awakened at once,
notably in Germany, a sympathetic interest in a country whose poets
spoke a language so well known to our hearts, as though they had
been born among ourselves.”
Some of these maxims apparently depict the family life of the
lower classes; others appear rather as if they had been intended to
be sung by the Bayaderes, or singing and dancing girls of the
Buddhist temples, who emancipated themselves from the domestic
and educational restrictions placed on other women, and sought to
fascinate men with their wit, love, and æsthetic accomplishments.
This suggestion is borne out by the fact that most of the maxims are
feminine utterances, and often of questionable moral character.
Although, therefore, some of these revelations of early Aryan Love
have an unpleasant by-flavour, they are yet extremely interesting as
showing how dependent Romantic Love is on the freedom and the
intellectual and æsthetic culture of woman.
We find in the maxims of Halâ evidences of that important
overtone of Love, Ecstatic Adoration or Poetic Hyperbole, which we
have not encountered elsewhere, so far. What could be more
modern than this:—
“Although all my possessions were burnt in the village fire, yet is
my heart delighted, since he took the buckets from me when they
were passed from hand to hand.”
Or this:—
“O thou who art skilled in cookery, restrain thy anger! The reason
why the fire refuses to burn, and only smokes, is that it may the
longer drink in the breath of your mouth, fragrant as the red potato-
blossoms.”
The following two show how Personal Beauty was appreciated:—
“He sees nothing but her face, and she too is quite intoxicated by
his looks. Both, satisfied with each other, act as if in the whole world
there were no other women or men.”
“Other beauties likewise have in their faces beautiful, wide black
eyes, with long lashes,—but no one else understands as she does
how to use them.”
How Love establishes his Monopoly in heart and mind, tolerating
no other thought, is thus shown:—
“She stares without a (visible) object, draws a deep sigh, laughs
into empty space, mutters unintelligible words—forsooth, there must
be something on her heart.”
Ovid himself might have written the following, showing Love’s
inconstancy:—
“Love departs when lovers are separated; it departs when they
see too much of each other; it departs in consequence of malicious
gossip; aye, it departs also without these causes.”
The nature of Coyness is evidently understood, for the lover is
thus admonished:—
“My son, such is the nature of love, suddenly to get angry, to
make up again in a moment, to dissemble its language, to tease
immoderately.”
And yet the poet deems it necessary to tell a sweetheart that—
“By forgiving him at first sight, you foolish girl, you deprived
yourself of many pleasures,—of his prostration at your feet [a trace
of Gallantry], of a kiss passionately stolen.”
The sadness of separation thus finds utterance:—
“As is sickness without a physician; as living with relatives when
one is poor,—as the sight of an enemy’s prosperity,—so is it difficult
to endure separation from you.”
Thus we find in Ancient Aryan Love some of the leading features
of modern romantic passion.

GREEK LOVE

The Greeks, too, were Aryans, and they were the most refined
and æsthetic nation of antiquity; yet we look in vain in their
literature for delineations of that Romantic Love which, according to
our notions, ought to accompany so high a degree of culture.

FAMILY AFFECTIONS

Conjugal tenderness and the other family affections appear;


indeed, to have been known and cherished by the Greeks at all
times, in the days of Athenian supremacy, when women were kept in
entire seclusion, no less than in Homeric times, when they seem to
have enjoyed more liberty of action. Plutarch tells us in his Conjugal
Precepts that “With women tenderness of heart is indicated by a
pleasing countenance, by sweetness of speech, by an affectionate
grace, and by a high degree of sensitiveness;” and Mr. Lecky thus
eloquently sums up the evidence that the Greeks appreciated the
various forms of domestic affection:—
“The types of female excellence which are contained in the Greek
poems, while they are among the earliest, are also among the most
perfect in the literature of mankind. The conjugal tenderness of
Hector and Andromache; the unwearied fidelity of Penelope,
awaiting through the long revolving years the return of her storm-
tossed husband, who looked forward to her as the crown of all his
labours; the heroic love of Alcestis, voluntarily dying that her
husband might live; the filial piety of Antigone; the majestic
grandeur of the death of Polyxena; the more subdued and saintly
resignation of Iphigenia, excusing with her last breath the father
who had condemned her; the joyous, modest, and loving Nausicaa,
whose figure shines like a perfect idyll among the tragedies of the
Odyssey—all these are pictures of perennial beauty, which Rome and
Christendom, chivalry and modern civilisation, have neither eclipsed
nor transcended. Virgin modesty and conjugal fidelity, the graces as
well as the virtues of the most perfect womanhood, have never been
more exquisitely portrayed.”

NO LOVE-STORIES

But Mr. Lecky, ignoring, like most writers, the enormous difference
between conjugal and romantic love, forgets to notice the absolute
silence of Greek literature on the subject of pre-matrimonial
infatuation. Not one of the Greek tragedies is a “love-drama”;
romantic love does not appear even in the writings of Euripides, who
has so much to say about women, and who named most of his plays
after his heroines. Had Love been known to Sophokles and
Euripides, as it was known to Shakspere and Goethe, we should no
doubt have a Greek Romeo and Juliet and a Greek Faust. For
although there were certain limitations as to the scope and the
dramatis personæ of a Greek play, there was nothing whatever to
exclude a love-story. And when we consider how the sentiment of
Love colours all modern literature; how almost impossible it is for a
play or a novel to succeed unless it embodies a love-story: the
absolute ignoring of this passion in Greek literature forces on us the
inevitable conclusion that Romantic Love was unknown to them, or
only so faintly developed as to excite no interest whatever.
And this conclusion harmonises with the dictum of the best Greek
scholars. It is true that Becker, in his Charikles, referring to the
frequency with which the comedians introduce a youth desperately
enamoured of a girl, faintly objects to the statement that “There is
no instance of an Athenian falling in love with a free-born woman,
and marrying her from violent passion,”—made by Müller in his
famous work on the Dorians. But he makes the fatal admission that
“Sensuality was the soil from which such passion sprang, and none
other than a sensual love was acknowledged between man and
wife.” No one, of course, would deny that sensual passion prevailed
in Athens; but sensuality is the very antipode of Romantic Love.

WOMAN’S POSITION

How are we to account for this anomaly—the absence of sexual


romance in a nation which was so passionately enamoured of Beauty
in its various forms?
The answer is to be found in the non-existence of opportunities
for courtship, and the degraded position of woman. The following
sentences, culled at random from Becker’s classical work, show how
the Greek men regarded their women, whom they considered
inferior to themselves in heart as well as in intellect. Iphigenia
herself is made to admit by Euripides that one man is worth more
than a myriad of women:—

εἶς γ’ ανὴρ κρείσσων γυναικῶν μυρίων.


“The ἀρετή (virtue) of which a woman was thought capable in
that age differed but little from that of a faithful slave.” “Except in
her own immediate circle, a woman’s existence was scarcely
recognised.” “It was quite a Grecian view of the case to consider a
wife as a necessary evil.” "Athenians, in speaking of their wives and
children, generally said τέκνα καὶ γυναῖκας, putting their wives last: a
phrase which indicates very clearly what was the tone of feeling on
this subject" (Smith).
Women “were not allowed to conclude any bargain or transaction
of consequence on their own account,” though Plato urged that this
concession should be made to them; and it was even “enacted that
everything a man did by the counsel or request of a woman should
be null.” “There were no educational institutions for girls, nor any
private teachers at home.” “Hence there were no scientifically-
learned ladies, with the exception of the Hetæræ.”

CHAPERONAGE VERSUS COURTSHIP

In such an arid, rocky soil Love of course could not grow or even
germinate. Still more fatal to the romantic passion, however, was the
absolute seclusion of the sexes, precluding all possibility of courtship
and free choice among the young. Greek women were not allowed
to enjoy the society of men, nor to attend “those public spectacles
which were the chief means of Athenian culture,” and which would
have afforded the young folks an opportunity of seeing and falling in
love with one another. The wife was not even permitted to eat with
her husband if male visitors were present, but had to retire to her
private apartments, so absurd was the jealousy of the men. “The
maidens lived in the greatest seclusion till their marriage, and, so to
speak, regularly under lock and key,” which had the “effect of
rendering the girls excessively bashful, and even prudish,” and so
stupid, in all probability, that no wonder the men considered
marriage a punishment, and sought entertainment with the
educated Hetæræ—as to-day in France. Even young married women
were obliged to have a chaperon. “No respectable lady thought of
going out without a female slave.” “Even the married woman shrank
back and blushed if she chanced to be seen at the window by a
man.”

PLATO ON COURTSHIP

It is one of the most remarkable facts in the history of Love and of


social philosophy that Plato, the most modern of all ancient thinkers,
foresaw the importance of pre-matrimonial acquaintance as the
basis of a rational and happy marriage choice long before any other
writer. Making allowance for the fact that Greek notions as to what is
within “the rules of modesty” differed from our own, the following
passage cannot be too deeply pondered: “People,” Plato tells us in
the sixth book of the Laws (p. 771), “must be acquainted with those
into whose families and to whom they marry and are given in
marriage; in such matters as far as possible to avoid mistakes is all-
important, and with this serious purpose let games be instituted, in
which youths and maidens shall dance together, seeing and being
seen naked, at a proper age and on a suitable occasion, not
transgressing the rules of modesty.”

PARENTAL VERSUS LOVERS’ CHOICE

Marriages in Greece were often arranged for girls while they were
mere children, of course without any reference to their choice, since
they were looked upon as the property of the father, who could
dispose of them at his pleasure. Besides these early betrothals there
was an obstacle to free choice in the Athenian law which forbade a
citizen under very severe penalties to marry a foreigner. And again,
“In the case of a father dying intestate, and without male children,
his heiress had no choice in marriage; she was compelled by law to
marry her nearest kinsman, not in the ascending line.... Where there
were several co-heiresses, they were respectively married to their
kinsmen, the nearest having the first choice”—a law resembling one
in the Jewish code, and exemplified by Ruth, as pointed out in
Smith’s Dictionary.
How Sexual Selection was rendered impracticable in Greece is
further shown in the following citations from Becker: “The choice of
the bride seldom depended on previous, or at least on intimate
acquaintance. More attention was generally paid to the position of a
damsel’s family, and the amount of her dowry, than to her personal
qualities.” "It was usual for a father to choose for his son a wife, and
one perhaps whom the bridegroom had never seen." “Widows
frequently married again; this was often in compliance with the
testamentary dispositions of their husbands, as little regard being
paid to their wishes as in the case of girls.”
Thus we see that three causes combined to prevent the growth of
Romantic Love in Greece—the degraded position of women, the
absence of direct Courtship, and the impossibility of exercising
Individual Preference.

THE HETÆRÆ

That the absolute seclusion and chaperonage of the young


women, and their consequent ignorance and insipidity, were the
reasons why they could neither feel nor inspire Romantic Love, is
shown by the fact that there existed in Greece in the time of Perikles
a mentally superior class of women who appear to have aroused
Love, or something very like it, by means of the artistic and
intellectual charms which they united with their physical beauty.
These women were called Ἡταίραι, or companions, evidently to
distinguish them from the domestic women who were no
“companions” after the first charm of novelty had worn away: a
state of affairs for which of course the men themselves, who gave
them no education and locked them up, were to blame.
What seems paradoxical is that these women, who were morally
inferior to the others, should have been the first to inspire in men a
more refined sort of Love; but the paradox is rendered the more
probable by the circumstance that in India, likewise, we found the
first traces of Romantic Love among the Bayaderes, a class
corresponding to the Hetæræ.
There is reason to believe that Aspasia, who aided the greatest
statesman of antiquity in writing his stirring speeches, inspired not
only him but other great contemporaries with true Romantic passion
—which they were enabled to feel because men of genius are not
only intellectually but also emotionally ahead of their time.
Diotima was another of these women. She was also revered as a
prophetess, and is credited by Plato with having given Sokrates, and
through him Greece, the first adequate discourse on Love—a
discourse, we may add, in which some flashes of true modern
insight are mingled with the curiously confused notions of the
Greeks on the subject of Love and Friendship. What these notions
were is best seen by briefly considering the peculiarities of

PLATONIC LOVE

On this subject the most incorrect and absurd notions universally


pervade modern literature and conversation. As commonly
understood, “Platonic Love” means a friendship between a man and
a woman from which all traces of passion are excluded. Such a
notion is utterly foreign to Plato’s way of thinking, and is nowhere
referred to in his writings. Platonic love has nothing to do with
women whatever. It is an attachment between a man and a youth,
which may be defined as friendship united with the ecstatic ardour
which in modern life is associated only with Romantic Love.
Mr. George Grote thus describes what he calls the “truly Platonic
conception of love”. It is “a vehement impulse towards mental
communion with some favoured youth, in view of producing mental
improvement, good, and happiness to both persons concerned: the
same impulse afterwards expanding, so as to grasp the good and
beautiful in a larger sense, and ultimately to fasten on goodness and
beauty in the pure Ideal.”
Once more, Platonic love might be defined as creative friendship,
which has for its object the conception of great ideas,—of works of
art, literature, philosophy. Such a friendship, Plato tells us, should be
formed between a man and a youth, not too young, but when his
beard begins to grow and his intellect to develop; and such a
friendship is apt to last throughout life.
Perhaps the most striking instance in Greek literature of Platonic
love is that given in Plato’s Symposium as existing between the pure-
minded Sokrates, who kept aloof from all Greek vices, and the
beautiful young Alkibiades. This youth thus describes the effect
which the discourse of Sokrates has on him: “When I hear him, my
heart leaps in my breast, more than it does among the Korybantes,
and tears roll down my cheeks at his words, and I notice that many
others have the same experience. When I heard Perikles and other
excellent orators, I came to the conclusion that they spoke well; but
this experience was different from the other, and my soul did not
lose its control or gnash its teeth like a prostrate slave, but by this
Marsyas (= Sokrates) I was put into such a mood that the condition
in which I found myself did not seem praiseworthy.”
He further describes Sokrates as being always “in love with
beautiful youths, and talking with them, and being quite beside
himself”; hence when he (Alkibiades) appears at the Symposium,
and finds Sokrates sitting next to the most beautiful man in the
company, he chides him in words which have exactly the sound of
Jealousy inspired by Romantic Love: “And why did you recline here
and not next to Aristophanes, or some other wit, or would-be wit,
but, instead, crowded forward in order to be next to the
handsomest?”
To which Sokrates replies: “Agathon, come to my assistance; for
my love for this person has cost me dearly. Ever since I have loved
him, I have not been allowed to look at anybody, or to talk with any
one who is beautiful, or else this youth, in his jealousy and envy,
does unheard-of-things, and chides me, and hardly refrains from
violence. Be on your guard, therefore, that he may not resort to
violence now, and reconcile us, or if he dares to become unruly,
assist me; for I very much fear his madness and infatuation.”
Although this was probably said in the playful tone common to
Sokrates, it yet is noticeable how closely the language used
resembles the language of modern Romantic Love.

SAPPHO AND FEMALE FRIENDSHIP

To this form of Platonic or mono-sexual love there existed a


female counterpart, as shown in some of the lyric effusions of Greek
poets. Some of these poets, it is true, especially Anakreon, knew
naught of the imaginative side of Love—of its protracted tortures
and intermittent joys. Like a butterfly that kisses every flower on its
way, he “cared only for the enjoyment of the passing moment.” But
Sappho apparently wrote of Love in terms worthy of Heine or Byron,
as shown even in this crude translation of one of her poems:—

“While gazing on thy charms I hung,


My voice died faltering on my tongue,
With subtle flames my bosom glows,
Quick through each vein the poison flows;
Dark dimming mists my eyes surround,
My ears with hollow murmurs sound.
My limbs with dewy chillness freeze,
On my whole frame pale tremblings seize,
And losing colour, sense, and breath,
I seem quite languishing in death.”

Longinus calls this the most perfect expression in all ancient


literature of the effects of Love. It happens, however, to have
nothing to do with Love. For, as Plato’s “love” is merely ecstatic
friendship between man and youth, so Sappho’s love is friendship
between two women. This is the opinion of Bode and Müller, and it is
entirely borne out by the language of the original text.
It has been suggested that Sappho, being a woman, and a Greek
woman, could not have addressed such glowing words to a man
without violating the current notions of decorum; and hence wrote
as if she were a man addressing a woman. But Sappho was one of
the Æolian women who had greater liberty than the Athenians; and
she was, moreover, a blue-stocking who would not have stuck at
such a trifle as shocking Greek notions regarding woman’s privileges.
And in some of her poems she does mention a youth “to whom she
gave her whole heart, while he requited her passion with cold
indifference” (Müller).
One of the Platonists, Maximus Tyrius (dis. 24, p. 297), takes the
same view regarding Sappho. “The love of the Lesbian poet,” he
says, “what can it be, if we may compare remote with more recent
things than the Sokratic art of love? For both appear to promote the
same Friendship, she among women, he among men. They both
confess they love many, and are captivated by all beauties. For what
Alkibiades and Charmides are to Sokrates, Gyrinna and Atthis and
Anaktoria are to Sappho.” “Even Sokrates confesses that it was from
Sappho that he partly derived his noble views of the enthusiastic
love of mental beauty” (Phædon, c. 225).
To one of the girls just referred to, Sappho addresses these words:
“Again does the strength-dissolving Eros, that bittersweet, resistless
monster, agitate me; but to thee, O Atthis, the thought of me is
importunate; thou fliest to Andromeda.” “It is obvious,” says Müller,
“that this attachment bears less the character of maternal interest
than of passionate love; as amongst Dorians in Sparta and Crete
analogous connections between men and youths, in which the latter
were trained to noble and manly deeds, were carried on in a
language of high-wrought and passionate feeling, which had all the
character of an attachment between persons of different sexes. This
mixture of feelings, which among nations of a calmer temperament
have always been perfectly distinct, is an essential feature of the
Greek character.”
Greek Love, i.e. Friendship, being thus tinged and strengthened,
as we see in the cases of Sokrates and Alkibiades, Sappho and
Atthis, by jealousy, ecstatic adoration, exclusiveness, admiration of
personal beauty, and other qualities which modern civilisation has
transferred to Romantic Love, we are enabled to understand why
Friendship was so much more potent and prevalent in antiquity than
it is now, when, having lost these traits through the differentiation of
emotions, it seems “insipid to those who have tasted Love.”

You might also like