Applied Maple for Engineers and Scientists Applied Maple for Engineers and Scientists Chris Tocci Steve Adams • Artech House Boston • London LibraryofCongress Cataloging-in-PublicationData Tocci,Christopher. AppliedMaplefor engineersandscientists/ChrisTocciand SteveAdams. p. cm. Includesbibliographicalreferencesandindex. ISBN0-89006-853-4(alk.paper) 1.Engineering mathematics—Dataprocessing. 2.Science— Mathematics—Dataprocessing. 3.Maple(Computerfile) I.Adams, Stephen, 1959– . II.Title. TA345.T63 1996 620’.00285’53—dc20 96-19492 CIP BritishLibrary CataloguinginPublication Data Tocci,Chris Appled Maplefor engineersand scientists 1.Maple(Computerprogram) 2.Algebra—Computer programs 3.Engineering mathematics—Computerprograms I.Title II.Adams,Steve,1959– 620’.00285’5369 ISBN0-89006-853-4 Coverandtextdesign by DarrellJudd ©1996ARTECH HOUSE,INC. 685Canton Street Norwood,MA 02062 Allrightsreserved.Printedand bound intheUnitedStatesofAmerica.Nopartof this bookmaybereproducedor utilizedinanyform or byanymeans,electronicor me- chanical, including photocopying,recording,or byany informationstorageand re- trievalsystem,withoutpermissioninwritingfrom thepublisher. Alltermsmentionedinthisbookthatareknown to betrademarksor servicemarks havebeenappropriatelycapitalized.ArtechHousecannot attesttotheaccuracyof this information.Useof aterminthisbook shouldnotberegardedasaffecting thevalidity of anytrademarkor servicemark. International StandardBookNumber:0-89006-853-4 Libraryof CongressCatalogCardNumber:96-19492 10987654321 To mywife,Mercedes,my dad,Anthony,andthe ‘leggy’Woolfie C.T. To mylongsufferingwife,Fiona,and mydaughter,Sophie,whowillhaveto leeratthisstuff S.A. AScpipelnietdis Mtsaplefor Engineersand Contents Foreword 1 More aboutMaple 5 Maple:atutorial 5 Help 6 Preface 1 Mapleasacalculator 9 Motive forusingthisbook 1 Mapleasaprogrammablecalculator 27 Who needs to use thisbook 2 Purpose ofthe book 2 Chapter 2 Philosophyofthe book 2 Chapter structureandorder 2 Active filter designand analysis 39 Case I:analoglow-passfilterdesign Chapter 1 andanalysis 40 UseofLaplacetransformexplained 41 Introduction 1 Constituent relationships derived 41 Whatisa CAS ? 2 Designing a1-kHzButterworthLPF 47 Numbers 2 Bode magnitudeandphase plots 49 Symbols 3 Improvement on the 1-kHzButterworth LPF 53 vii Applied Maplefor Engineersand Scientists Butterworth LPFcomponent Chapter 4 sensitivityanalysis 55 Mathematical models:working with Unequalresistance valuesin the Butterworth differentialequations 133 LPFtopology 57 Butterworth LPFtest setup 60 ODE tools:a tour 134 Design iteration ofLPFsfor newerfiltering Thedsolvefunction 134 requirements 64 TheDEtoolspackage 137 Unitstep response 68 Thedifformspackage 143 Conclusion 70 Seriesmethods 144 CaseII:combfilter analysisanddesign 71 Modeling dynamic systems 152 Filter derivation andanalysis 72 Asimple shock absorber 152 Separating aknownsignalfrom aninterfering Atwin massshock absorber 158 neighboring backgrounddesign 81 Anonlinearsystem 166 Cascading combfilters 87 Conclusion 91 Chapter 5 Chapter 3 Continuouscontrolapplication theory 173 Curve fitting 93 Linear control systemanalysis 173 Introduction 93 Frequency-domain approach 175 Casestudy:Gaussian peakestimatorfilter Partialfraction expansion 179 examplewith regressive curvefitting 95 Time-domain approach 194 Starting the Maple regression session 96 Time-invariantversustime-variantsystems 194 Linear regression using alogarithmic Analysisofatime-invariant system: representation ofthe Gaussianmodel 96 fundamentals 195 Problemdatasetfor linear regression 111 Thestatetransition matrix 200 Nonlinearregression: Conclusion 210 the Levenberg-Marquardt algorithm 115 General polynomialregression 121 High-orderpolynomialregressionfit Chapter 6 problems 126 Quick moral about curvefitting 131 Discrete controlapplications 213 Conclusion 132 The pulsetransferfunction 215 Transformingcontinuoussignals 216 Calculatingthe timeresponse 234 State spaceequations andtheircanonical forms 242 viii Contents Transferfunctionto statespace (thecontrollable Chapter 8 canonical form) 242 Switching topologies 301 Observablecanonicalform 247 Steady-statemethod 302 Pulsewidth modulator driver 302 Chapter 7 Switchingpowersupply 316 Discretedata processing 249 Fourier method 330 Maple plots 249 The plot structure 250 Appendix A 345 Imageconversion 252 Togreyscale 260 Appendix B 351 Normalize 263 Tofalsecolor 269 Conclusion 272 Glossary 357 Linearfilters 273 Differencing 273 About the authors 391 Moving average 276 Moving median 282 Exponentialfiltering 288 Index 393 Conclusion 296 ix Applied Maplefor Engineersand Scientists Foreword A bout7 yearsago, aftersome35years asa computational physi- cist, I opened upmyfirst version of the computer algebrasystem (CAS), Maple IV.Maple seemedtobeananswertomy needfor an error-freeand fast systemto derive longinvolved algebra andcalculus solu- tions.My delight turnedtoa somberrealizationthatMaple didnotreplace allthe mathematicaland appliedmathematicalskills thatIhaddeveloped. I stillhad tothink like a computational physicist and tolearnhowto use Maple asa tool to extendmy capabilitiestoachieve solutions morequickly andwithgreateraccuracy. Maple isnota mathematicianin a box! My usualapproachtosolving,numerically, physics(andelectrical en- gineering) problems using computers involved developing a sequenceof models: Physicsfi Mathematicalfi Numerical Analyticalfi Softwarefi Computer xi Applied Maplefor Engineersand Scientists Each of these models represents an approximationtothe actual physi- calprocess.Infact,the abovechain represented thesettingupof the prob- lemfor a solution.The actual running of the solutionon a computer was the trivial part.WhenI startedto use Maple IVto developfirst the mathe- matical andthenthe software model, I realized I wouldhave tolearna new languagetoeffectively use this tool. Ihadtorethink thewayIsolved the problemof a mathematicalrepresentationofthe physicsor engineering processI wastryingto solve.However,I hadno guide,nohandbook, no MorseandFeshbach(MethodsofTheoreticalPhysics), thebiblefor mathe- maticalphysicistsof mygeneration! So,I had tolearnby trying,byexperi- menting. It was a longanddifficult process,especiallysinceMaple was continuously being improvedand its capabilities extended. Afterseveral years, I am stillnotfinishedwith this process. However, Steve Adams and ChrisToccihave made the roadmuch smoother andmorelevel withthis book,Applied Maple forEngineers and Scientists. Setaround Maple V,Release4—thelatest version of this software—they showhowto solvea varietyofproblems using Maple as the principal tool.Ranging fromlinear activefiltersthroughcurvefitting to ODEs,they showhowto set up theproblem usingMaple. Mostimpor- tantly,evenif noneof the applicationscovered in thebook is germaneto the reader’sspecific problems,Adams and Toccidemonstrate howan engi- neer orscientistshould to thinkabouta problemwhenusing Maple as a tool. The authors donot leavethereaderhangingif they arenot already proficientin Maple—they includea tutorialon Maple V,Release4,which contains the principal featuresof this system.Ofequalimportance isthe discussion of the physicsorengineering processesandof the important mathematicalfunctions used ineachexample. These discussions, plusthe plotting ofthe solutions using the Maple graphic engine,arecriticalele- mentsin makingthis book analmost-self-containedreference andteaching text. ThomasN.Casselman Casselman Computational Consultants(C3) Dublin, CA July1996 xii Applied Maplefor Engineersand Scientists Preface Motive for using this book M aple is one of themostpowerful mathematics computeralge- bra systems or computer algebrasystem (CAS)packageson the markettoday.Consideringtoday’seconomic realities, it makes perfect sensethatan initial indepth computer analysisof a quantitative problemcould save manyperson-hoursandmaterialresource costs, hence makingyou andyourorganizationmore competitive.Applied Maplefor Engineersand Scientistswill get readersthinkingabouttheirspecific prob- lems by using what the authorscall “template”applicationcase studies. xiii