Book Image

Scientific Computing with Python - Second Edition

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

Scientific Computing with Python - Second Edition

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

Overview of this book

Python has tremendous potential within the scientific computing domain. This updated edition of Scientific Computing with Python features new chapters on graphical user interfaces, efficient data processing, and parallel computing to help you perform mathematical and scientific computing efficiently using Python. This book will help you to explore new Python syntax features and create different models using scientific computing principles. The book presents Python alongside mathematical applications and demonstrates how to apply Python concepts in computing with the help of examples involving Python 3.8. You'll use pandas for basic data analysis to understand the modern needs of scientific computing, and cover data module improvements and built-in features. You'll also explore numerical computation modules such as NumPy and SciPy, which enable fast access to highly efficient numerical algorithms. By learning to use the plotting module Matplotlib, you will be able to represent your computational results in talks and publications. A special chapter is devoted to SymPy, a tool for bridging symbolic and numerical computations. By the end of this Python book, you'll have gained a solid understanding of task automation and how to implement and test mathematical algorithms within the realm of scientific computing.
Table of Contents (23 chapters)
20
About Packt
22
References

11.1 A guiding example to widgets

In this section, we present the basic components11.1 A guiding example to widgets of a widget and their counterparts in Python. We do this by using the guiding example displayed in the following figure:

Figure 11.1: A widget to display  for user-given frequencies

In this figure, we see a slider bar at the top. With the use of a computer mouse, the blue bar can be moved from left to right and the value for , ranging between 1 and 5, is displayed on the right of the bar.

Correspondingly, the frequency of the sine wave displayed in the plot window changes.

This widget consists of three parts:

  • A figure object with an axes object and the plot
  • An axes object containing a slider object
  • A call-back function for updating the plot as soon as the slider value changes

We discussed how to program the first part, in Section 6.2Working with Matplotlib objects directly.

In the following code snippet, we first create a figure with a given size and...