This content has been downloaded from IOPscience. Please scroll down to see the full text. Download details: IP Address: 148.251.232.83 This content was downloaded on 31/03/2019 at 13:36 Please note that terms and conditions apply.
Modelling Physics with Microsoft Excel
Modelling Physics with Microsoft Excel Bernard V Liengme St Francis Xavier University, Nova Scotia, Canada Morgan & Claypool Publishers
Copyright ª 2014 Morgan & Claypool Publishers All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior permission of the publisher, or as expressly permitted by law or under terms agreed with the appropriate rights organization. Multiple copying is permitted in accordance with the terms of licences issued by the Copyright Licensing Agency, the Copyright Clearance Centre and other reproduction rights organisations. Rights & Permissions To obtain permission to re-use copyrighted material from Morgan & Claypool Publishers, please contact info@morganclaypool.com. ISBN ISBN 978-1-627-05419-5 (ebook) 978-1-627-05418-8 (print) DOI 10.1088/978-1-627-05419-5 Version: 20141001 IOP Concise Physics ISSN 2053-2571 (online) ISSN 2054-7307 (print) A Morgan & Claypool publication as part of IOP Concise Physics Published by Morgan & Claypool Publishers, 40 Oak Drive, San Rafael, CA, 94903, USA IOP Publishing, Temple Circus, Temple Way, Bristol BS1 6HG, UK
Dedication To Pauline, my wife and my friend.
Contents Preface Acknowledgements Author biography ix x xi 1 Projectile trajectory 1-1 1.1 Football trajectory 1-1 1.2 Adding air resistance 1-4 2 The pursuit problem 2-1 2.1 The numerical approach 2-1 2.2 Comparison with the analytical solution 2-3 References 2-4 3 Equation solving with and without Solver 3-1 3.1 The van der Waals equation: the fixed point iteration method 3-1 3.2 van der Waals equation: using Solver 3-2 3.3 Finding roots graphically 3-6 3.4 Newton Raphson method 3-7 3.5 Using Solver to obtain multiple roots 3-8 3.6 The secant method and goal seek 3-10 3.7 The inverse quadratic method 3-11 3.8 Solving systems of linear equations 3-13 3.9 Solving a system of non-linear equations 3-14 3.10 Closing note on Solver 3-15 4 Temperature profile 4-1 4.1 A formula method 4-2 4.2 A matrix method 4-3 4.3 A Solver method 4-5 5 Numerical integration 5-1 5.1 Trapezoid rule and Simpson s ⅓ rule 5-1 5.2 Centroid of a plane using Simpson s ⅓ rule 5-3 5.3 Monte Carlo method I 5-4 vii
Modelling Physics with Microsoft Excel 5.4 Monte Carlo method II 5-5 5.5 Buffon s needle 5-7 References 5-9 6 Approximate solutions to differential equations 6-1 6.1 Ordinary differential equations (ODEs) 6-1 6.2 Euler s method 6-1 6.3 The Runge Kutta method 6-4 6.4 Testing for convergence 6-5 6.5 Systems of ODEs and second-order ODEs 6-7 References 6-10 7 Superposition of sine waves and Fourier series 7-1 7.1 Addition of sine waves; generation of beats 7-2 7.2 Fourier series 7-2 7.3 Parametric plots and Lissajous curves 7-4 8 Fast Fourier transform 8-1 9 Applying statistics to experimental data 9-1 9.1 Comparing averages 9-1 9.2 Comparing variances 9-4 9.3 Are my data normally distributed? 9-6 10 Electrostatics 10-1 10.1 Coulomb s law 10-1 10.2 Electrostatic potential 10-3 10.3 Discrete form of Laplace equation 10-4 References 10-6 11 Random events 11-1 11.1 Random walk and Brownian motion 11-1 11.2 A random self-avoiding walk 11-4 References 11-9 viii
Preface The purpose of this work is to show some of the ways in which Microsoft Excel may be used to solve numerical problems in the field of physics. But why use Excel in the first place? Certainly Excel is never going to out-perform the wonderful symbolic algebra tools that we have today Mathematica. Mathcad 1, Maple, MATLAB, etc. However, from a pedagogical stance Excel has the advantage of not being a black box approach to problem solving. The user must do a lot more work than just call up a function. The intermediate steps in a calculation are displayed on the worksheet of course this is not true with the Solver add-in which is a wonderful black box. Another advantage is the somewhat less steep learning curve. A high school student can quickly lean how to get Excel to do useful calculations. It is assumed that the reader has some prior knowledge of Excel, at least at the level of what one would find, for example, in Excel for Dummies. The author has observed while teaching Excel that, while a user might have a good knowledge of the features of the program, many are at a loss when asked to put them to use. It is only by hands-on experimentation that one learns the art of constructing an efficient worksheet. It is hoped that the examples herein will aid the reader to develop his/her own worksheets. Some Visual Basic for Applications (VBA) has been introduced with very little explanation. The purpose here is to show how the power of Excel can be greatly extended and hopefully to whet the appetite of a few readers to get familiar with the power of VBA. Those with programming experience in any other language should be able to follow the code. The author will be more than happy to reply to email enquiries, be they about a topic in the book or some other Excel question. Please use the word Excel in the subject line of each message. Have fun learning to Excel! Bernard V Liengme bliengme@stfx.ca The workbooks for this project were made using Excel 2013 but they should all work with the earlier Excel 2007 or Excel 2010 versions. It is assumed that the reader will have both the text and the Excel file open at the same time. 1 The author wonders how many readers have experimented with SMath Suite, a freely available application with many of the features of Mathcad. The interested reader might wish to look at http://smath.info/wiki/ (S(c4euu555aw3zio55yas5cj2j))/GetFile.aspx?File=Tutorials/SMathPrimer.pdf. ix
Acknowledgements The author thanks fellow Microsoft Excel MVPs Jon Peltier, Bob Umlas and Jan Karel Pieterse for their help over the years. x
Author biography Bernard V Liengme Bernard V Liengme attended Imperial College London for his undergraduate and postgraduate degrees; he held post-doctoral fellowships at Carnegie-Mellon University and the University of British Columbia. He has conducted extensive research in surface chemistry and the Mossbauer effect. He has been at St Francis Xavier University in Canada since 1968 as a Professor, Associate Dean and Registrar, as well as teaching chemistry and computer science. He currently lectures part-time on business information systems. Bernard is also the author of other successful books: COBOL by Command (1996), A Guide to Microsoft Excel for Scientists and Engineers (now in its 4th edition) and A Guide to Microsoft Excel for Business and Management (now in its 2nd edition). xi