Book Image

Scientific Computing with Python 3

By : Claus Führer, Jan Erik Solem, Olivier Verdier
Book Image

Scientific Computing with Python 3

By: Claus Führer, Jan Erik Solem, Olivier Verdier

Overview of this book

Python can be used for more than just general-purpose programming. It is a free, open source language and environment that has tremendous potential for use within the domain of scientific computing. This book presents Python in tight connection with mathematical applications and demonstrates how to use various concepts in Python for computing purposes, including examples with the latest version of Python 3. Python is an effective tool to use when coupling scientific computing and mathematics and this book will teach you how to use it for linear algebra, arrays, plotting, iterating, functions, polynomials, and much more.
Table of Contents (23 chapters)
Scientific Computing with Python 3
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Acknowledgement
Preface
References

Finding Errors: Debugging


Errors in software code are sometimes referred to as bugs. Debugging is the process of finding and fixing bugs in code. This process can be performed at varying degrees of sophistication. The most efficient way is to use a tool called debugger. Having unittests in place is a good way to identify errors early, refer section Using unittest of Chapter 13, Testing. When it is not obvious where or what the problem is, a debugger is very useful.

Bugs

There are typically two kinds of bugs:

  • An exception is raised and not caught.
  • The code does not function properly.

The first case is usually easier to fix. The second can be more difficult as the problem can be a faulty idea or solution, a faulty implementation, or a combination of the two.

We are only concerned with the first case in what follows, but the same tools can be used to help find why the code does not do what it is supposed to.

The stack

When an exception is raised, you see the call stack. The call stack contains the...