NumPy1.5 Beginner's Guide(HD full text Download

c#小王子 c#小王子 2021-04-14 854 软件,编码,Python


Preface


Scientists, engineers, and quantitative data analysts face many challenges nowadays. Data scientists want to be able to do numerical analysis of large datasets with minimal programming effort. They want to write readable, efficient, and fast code, that is as close as possible to the mathematical language package they are used to. A number of accepted solutions are available in the scientific computing world.


The C, C++, and Fortran programming languages have their benefits, but they are not interactive and are considered too complex by many. The common commercial alternatives are, among others, Matlab, Maple, and Mathematica. These products provide powerful scripting languages, however, they are still more limited than any general purpose programming language. There are other open source tools similar to Matlab such as R, GNU Octave, and Scilab. Obviously, they also lack the power of a language such as Python.


Python is a popular general purpose programming language widely used by in the scientific community. You can access legacy C, Fortran, or R code easily from Python. It is objectoriented and considered more high-level than C or Fortran. Python allows you to write readable and clean code with minimal fuss. However, it lacks a Matlab equivalent out of the box. That's where NumPy comes in. This book is about NumPy and related Python libraries such as SciPy and Matplotlib.


What is NumPy?


NumPy (from Numerical Python) is an open source Python library for scientific computing. NumPy lets you work with arrays and matrices in a natural way. The library contains a long list of useful mathematical functions including some for linear algebra, Fourier transformation, and random number generation routines. LAPACK, a linear algebra library, is used by the NumPy linear algebra module if you have LAPACK installed on your system; otherwise NumPy provides its own implementation. LAPACK is a well known library originally written in Fortran—which Matlab relies on as well. In a sense, NumPy replaces some of the functionality of Matlab and Mathematica, allowing rapid interactive prototyping.


We will not be discussing NumPy from a developing contributor's perspective, but more from a user's perspective. NumPy is a very active project and has a lot of contributors. Maybe, one day you will be one of them!


History


NumPy is based on its predecessor, Numeric. Numeric was first released in 1995 and has a deprecated status now. Neither Numeric nor NumPy made it into the standard Python library for various reasons. However, you can install NumPy separately. More about that in the next chapter.


In 2001, a number of people inspired by Numeric created SciPy—an open source Python scientific computing library that provides functionality similar to that of Matlab, Maple, and Mathematica. Around this time, people were growing increasingly unhappy with Numeric. Numarray was created as alternative for Numeric. Numarray is currently also deprecated. Numarray was better in some areas than Numeric, but worked very differently. For that reason, SciPy kept on depending on the Numeric philosophy and the Numeric array object. As is customary with new "latest and greatest" software, the arrival of Numarray led to the development of an entire whole ecosystem around it with a range of useful tools. Unfortunately, the SciPy community could not enjoy the benefits of this development. It is quite possible that some Pythonista has decided to neither choose neither one nor the other camp.


In 2005, Travis Oliphant, an early contributor to SciPy, decided to do something about this situation. He tried to integrate some of the Numarray features into Numeric. A complete rewrite took place that culminated into the release of NumPy 1.0 in 2006. At this time, NumPy has all of the features of Numeric and Numarray and more. Upgrade tools are available to facilitate the upgrade from Numeric and Numarray. The upgrade is

recommended since Numeric and Numarray are not actively supported any more.


Originally the NumPy code was part of SciPy. It was later separated and is now used by SciPy for array and matrix processing.


Why use NumPy?


NumPy code is much cleaner than "straight" Python code that tries to accomplish the same task. There are fewer loops required because operations work directly on arrays and matrices. The many convenience and mathematical functions make life easier as well. The underlying algorithms have stood the test of time and have been designed with high performance in mind.


NumPy's arrays are stored more efficiently than an equivalent data structure in base Python such as a list of lists. Array I/O is significantly faster too. The performance improvement scales with the number of elements of an array. It really pays off to use NumPy for large arrays. Files as large as several terabytes can be memory-mapped to arrays leading to optimal reading and writing of data. The drawback of NumPy arrays is that they are more specialized than plain lists. Outside of the context of numerical computations, NumPy arrays are less useful. The technical details of NumPy arrays will be discussed in later chapters.


Large portions of NumPy are written in C. That makes NumPy faster than pure Python code. A NumPy C API exists as well. It allows further extension of the functionality with the help of the C language of NumPy. The C API falls outside the scope of the book. Finally, since NumPy is open source, you get all the added advantages. The price is the lowest possible—free as in 'beer'. You don't have to worry about licenses every time somebody joins your team or you need an upgrade of the software. The source code is available to everyone. This, of course, is beneficial to the code quality.


Limitations of NumPy


There is one important thing to know if you are planning to create Google App Engine applications. NumPy is not supported within the Google App Engine sandbox. NumPy is deemed "unsafe" partly because it is written in C.


If you are a Java programmer, you may be interested in Jython, the Java implementation of Python. In that case, I have bad news for you. Unfortunately, Jython runs on the Java Virtual Machine and cannot access NumPy because NumPy's modules are mostly written in C. You

could say that Jython and Python are from two totally different worlds, although they do implement the same specification.


The stable release of NumPy, at the time of writing, supported Python 2.4 to 2.6.x, and now also supports Python 3.


What this book covers


Chapter 1, NumPy Quick Start, will guide you through the steps needed to install NumPy on your system and create a basic NumPy application.


Chapter 2, Beginning with NumPy Fundamentals, introduces you to NumPy arrays and fundamentals.


Chapter 3, Get into Terms with Commonly Used Functions, will teach you about the most commonly used NumPy functions—the basic mathematical and statistical functions.


Chapter 4, Convenience Functions for Your Convenience, will teach you about functions that make working with NumPy easier. This includes functions that select certain parts of your arrays, for instance based on a Boolean condition. You will also learn about polynomials and manipulating the shape of NumPy objects.


Chapter 5, Working with Matrices and ufuncs, covers matrices and universal functions. Matrices are well known in mathematics and have their representation in NumPy as well. Universal functions (ufuncs) work on arrays element-by-element or on scalars. ufuncs expect a set of scalars as input and produce a set of scalars as output.


Chapter 6, Move Further with NumPy Modules, discusses how universal functions can typically be mapped to mathematical counterparts such as add, subtract, divide, multiply, and so on. NumPy has a number of basic modules that will be discussed in this chapter.


Chapter 7, Peeking into Special Routines, describes some of the more specialized NumPy functions. As NumPy users, we sometimes find ourselves having special needs. Fortunately, NumPy provides for most of our needs.


Chapter 8, Assured Quality with Testing, will teach you how to write NumPy unit tests.


Chapter 9, Plotting with Matplotlib, discusses how NumPy on its own cannot be used to create graphs and plots. This chapter covers (in-depth) Matplotlib, a very useful Python plotting library. Matplotlib integrates nicely with NumPy and has plotting capabilities comparable to Matlab.


Chapter 10, When NumPy is Not Enough: SciPy and Beyond, discuss how SciPy and NumPy are historically related. This chapter goes into more detail about SciPy. SciPy, as mentioned in the History section, is a high level Python scientific computing framework built on top of NumPy. It can be used in conjunction with NumPy.


What you need for this book


To try out the code samples in this book, you will need a recent build of NumPy. This means that you will need to have one of the Python versions supported by NumPy as well. Some code samples make use of Matplotlib for illustration purposes. Matplotlib is not strictly required to follow the examples, but it is recommended that you install it too. The last chapter is about SciPy and has one example involving SciKits.


Here is a list of software used to develop and test the code examples:


‹ Python 2.6


‹ NumPy 2.0.0.dev20100915

‹ SciPy 0.9.0.dev20100915


‹ Matplotlib 1.0.0


‹ Ipython 0.10


Needless to say, you don't need to have exactly this software and these versions on your computer. Python and NumPy is the absolute minimum you will need.


Who this book is for


This book is for you the scientist, engineer, programmer, or analyst looking for a high quality open source mathematical library. Knowledge of Python is assumed. Also, some affinity or at least interest in mathematics and statistics is required.


【下载地址】

链接:https://pan.baidu.com/s/1QuDpJiY8GQte1tFf628MXA

提取码:bl8p


相关文章


NumPy1.5 Beginner's Guide(HD full text Download

NumPy is an open source Python library for scientific computing.


文章热度: 166291
文章数量: 333
推荐阅读

FlashFXP绿色版网盘下载,附激活教程 1926

FlashFxp百度网盘下载链接:https://pan.baidu.com/s/1MBQ5gkZY1TCFY8A7fnZCfQ。FlashFxp是功能强大的FTP工具

Adobe Fireworks CS6 Ansifa绿色精简版网盘下载 1665

firework可以制作精美或是可以闪瞎眼的gif,这在广告领域是需要常用的,还有firework制作下logo,一些原创的图片还是很便捷的,而且fireworks用法简单,配合dw在做网站这一块往往会发挥出很强大的效果。百度网盘下载链接:https://pan.baidu.com/s/1fzIZszfy8VX6VzQBM_bdZQ

navicat for mysql中文绿色版网盘下载 1700

Navicat for Mysql是用于Mysql数据库管理的一款图形化管理软件,非常的便捷和好用,可以方便的增删改查数据库、数据表、字段、支持mysql命令,视图等等。百度网盘下载链接:https://pan.baidu.com/s/1T_tlgxzdQLtDr9TzptoWQw 提取码:y2yq

火车头采集器(旗舰版)绿色版网盘下载 1793

火车头采集器是站长常用的工具,相比于八爪鱼,简洁好用,易于配置。火车头能够轻松的抓取网页内容,并通过自带的工具对内容进行处理。站长圈想要做网站,火车头采集器是必不可少的。百度网盘链接:https://pan.baidu.com/s/1u8wUqS901HgOmucMBBOvEA

Photoshop(CS-2015-2023)绿色中文版软件下载 1916

安装文件清单(共46G)包含Window和Mac OS各个版本的安装包,从cs到cc,从绿色版到破解版,从安装文件激活工具,应有尽有,一次性打包。 Photoshop CC绿色精简版 Photoshop CS6 Mac版 Photoshop CC 2015 32位 Photoshop CC 2015 64位 Photoshop CC 2015 MAC版 Photoshop CC 2017 64位 Adobe Photoshop CC 2018 Adobe_Photoshop_CC_2018 Photoshop CC 2018 Win32 Photoshop CC 2018 Win64

知之

知之平台是全球领先的知识付费平台。提供各个领域的项目实战经验分享,提供优质的行业解决方案信息,来帮助您的工作和学习

使用指南 建议意见 用户协议 友情链接 隐私政策 Powered by NOOU ©2020 知之