SciPy Recipes
eBook - ePub

SciPy Recipes

V Kishore Ayyadevara, Luiz Felipe Martins, Ruben Oliva Ramos, Tomas Oliva, Ke Wu

Compartir libro
  1. 386 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

SciPy Recipes

V Kishore Ayyadevara, Luiz Felipe Martins, Ruben Oliva Ramos, Tomas Oliva, Ke Wu

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Tackle the most sophisticated problems associated with scientific computing and data manipulation using SciPy

Key Features

  • Covers a wide range of data science tasks using SciPy, NumPy, pandas, and matplotlib
  • Effective recipes on advanced scientific computations, statistics, data wrangling, data visualization, and more
  • A must-have book if you're looking to solve your data-related problems using SciPy, on-the-go

Book Description

With the SciPy Stack, you get the power to effectively process, manipulate, and visualize your data using the popular Python language. Utilizing SciPy correctly can sometimes be a very tricky proposition. This book provides the right techniques so you can use SciPy to perform different data science tasks with ease.

This book includes hands-on recipes for using the different components of the SciPy Stack such as NumPy, SciPy, matplotlib, and pandas, among others. You will use these libraries to solve real-world problems in linear algebra, numerical analysis, data visualization, and much more. The recipes included in the book will ensure you get a practical understanding not only of how a particular feature in SciPy Stack works, but also of its application to real-world problems. The independent nature of the recipes also ensure that you can pick up any one and learn about a particular feature of SciPy without reading through the other recipes, thus making the book a very handy and useful guide.

What you will learn

  • Get a solid foundation in scientific computing using Python
  • Master common tasks related to SciPy and associated libraries such as NumPy, pandas, and matplotlib
  • Perform mathematical operations such as linear algebra and work with the statistical and probability functions in SciPy
  • Master advanced computing such as Discrete Fourier Transform and K-means with the SciPy Stack
  • Implement data wrangling tasks efficiently using pandas
  • Visualize your data through various graphs and charts using matplotlib

Who this book is for

Python developers, aspiring data scientists, and analysts who want to get started with scientific computing using Python will find this book an indispensable resource. If you want to learn how to manipulate and visualize your data using the SciPy Stack, this book will also help you. A basic understanding of Python programming is all you need to get started.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es SciPy Recipes un PDF/ePUB en línea?
Sí, puedes acceder a SciPy Recipes de V Kishore Ayyadevara, Luiz Felipe Martins, Ruben Oliva Ramos, Tomas Oliva, Ke Wu en formato PDF o ePUB, así como a otros libros populares de Ciencia de la computación y Tratamiento de datos. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2017
ISBN
9781788295819

Calculus, Interpolation, and Differential Equations

In this chapter, we will present the following recipes:
  • Integration
  • Computing integrals using a Gaussian quadrature
  • Computing integrals with weighting functions
  • Computing multiple integrals
  • Interpolation
  • Computing a polynomial interpolation for a set of data points
  • Univariate interpolation
  • Finding a cubic spline that interpolates a set of data
  • Defining a B-spline for a given set of control points
  • Differentiation
  • Solving a one-dimensional ordinary differential equation
  • Solving a system of ordinary differential equations
  • Solving differential equations and systems with parameters
  • Using ode and the objected-oriented interface to solve differential equations

Introduction

Common to the design of a railway or road building (especially for highway exits), as well as those crazy loops in many roller coasters, is the solution of differential equations in two or three dimensions that address the effect of curvature and centripetal acceleration on moving bodies. In the 1970s, Werner Stengel studied and applied several models to attack this problem and, among the many solutions he found, one struck him as particularly brilliant—the employment of clothoid loops (based on sections of Cornu's spiral). The first looping coaster designed with this paradigm was constructed in 1976 in the Baja Ridge area of Six Flags Magic Mountain, in Valencia, California, USA. It was built during the great American Revolution, and it featured the very first vertical loop (together with two corkscrews, for a total of three inversions). The following is an image of a roller coaster for you to relate this to:
>
The tricky part of the design was based on a system of differential equations, whose solution depended on the integration of Fresnel-type sine and cosine integrals, and then selecting the appropriate sections of the resulting curve. Let's see the computation and plot of these interesting functions:
import numpy as np
from scipy.special import fresnel
import pylab
t = np.linspace(-10, 10, 1000)
pylab.plot(*fresnel(t), c='k')
pylab.show()
This results in the following plot:
The importance of Fresnel integrals granted them a permanent place in SciPy libraries. There are many other useful integrals that shared the same fate and now lie ready for action in the scipy.special module. For a complete list of all of those integrals, as well as the implementation of other relevant functions and their roots or derivatives, refer to the online documentation of scipy.special at: http://docs.scipy.org/doc/scipy-0.13.0/reference/special.html.

Integration

In the next section, we will get ourselves acquainted with the methods of integration.

Getting ready

To get involved in the following recipe, we need to know about the following instructions and requirements:
  • To achieve the definite integration of functions on suitable domains, we have mainly two methods—numerical integration and symbolic integration.
  • Numerical integration refers to the approximation of a definite integral via a quadrature process. Depending on how the function f(x) is given, the domain of integration, the knowledge of its singularities, and the choice of quadrature is the main part of this section.
  • In many cases, it is also possible to perform exact integration, even for non-bounded domains, with the aid of symbolic computation. In the SciPy stack, to this effect, we have an implementation of the Risch algorithm for elementary functions, and Meijer G-functions for non-elementary integrals. Both methods are housed in the SymPy libraries. Unfortunately, these symbolic procedures do not work for all functions, and due to the complexity of the generated codes in general, the solutions obtained by this method are by no means as fast as any numerical approximation.

How to do it…

Symbolic integration is done through the following steps:
  1. The definite integral of a polynomial function on a finite domain [a,b] can be computed very accurately via the fundamental theorem of calculus, using the numpy.polynomial module. For instance, to calculate the integral of the polynomial p(x)=x5 on the interval [-1,1].
  2. We could issue the fo...

Índice