An Introduction To Python For Scientific Computing

An Introduction To Python For Scientific Computing

简介:

Python是一种非常有用的高级编程语言,正在迅速成为科学计算的标准。它是开源的,跨不同平台 (Windows / MacOS / Linux) 完全标准化,非常灵活,易于使用和学习。用Python编写的程序具有很高的可读性,并且通常比用C或Fortran等其他语言编写的程序短得多。此外,Python预先加载了标准模块,这些模块提供了大量的函数和算法,用于解析文本数据、操作和查找磁盘上的文件、读取/写入压缩文件以及从web服务器下载数据等任务。Python还能够使用高级程序员期望的所有复杂技术,例如面向对象。

Python与C,C或Fortran等语言有些不同。在后者中,必须首先将源代码编译为可执行格式,然后才能运行。在Python中,没有编译步骤; 相反,源代码是逐行解释的。也就是说,Python执行代码就像执行脚本一样。解释型语言的主要优点是它很灵活; 变量不需要提前声明,程序可以动态适应。然而,主要的缺点是用Python编写的数字密集型程序通常比编译语言运行得慢。这似乎使Python成为科学计算的一个糟糕的选择; 然而,时间密集型子程序可以用C或Fortran编译,并以这样的方式导入到Python中,它们看起来就像正常的Python函数一样。

英文简介:

Python is an extremely usable, high-level programming language that is quickly becoming a standard in scientific computing. It is open source, completely standardized across different platforms (Windows / MacOS / Linux), immensely flexible, and easy to use and learn. Programs written in Python are highly readable and often much shorter than comparable programs written in other languages like C or Fortran. Moreover, Python comes pre-loaded with standard modules that provide a huge array of functions and algorithms, for tasks like parsing text data, manipulating and finding files on disk, reading/writing compressed files, and downloading data from web servers. Python is also capable of all of the complex techniques that advanced programmers expect, like object orientation.

Python is somewhat different than languages like C, C++, or Fortran. In the latter, source code must first be compiled to an executable format before it can be run. In Python, there is no compilation step; instead, source code is interpreted on the fly in a line-by-line basis. That is, Python executes code as if it were a script. The main advantage of an interpreted language is that it is flexible; variables do not need to be declared ahead of time, and the program can adapt on-the-fly. The main disadvantage, however, is that numerically-intensive programs written in Python typically run slower than those in compiled languages. This would seem to make Python a poor choice for scientific computing; however, time-intensive subroutines can be compiled in C or Fortran and imported into Python in such a manner that they appear to behave just like normal Python functions.

书名
An Introduction To Python For Scientific Computing
译名
Python 科学计算简介
语言
英语
年份
2022
页数
65页
大小
717.26 kB
标签
  • 科学计算
  • Python
  • 下载
    pdf iconAn Introduction To Python For Scientific Computing.pdf
    密码
    65536

    最后更新:2025-04-12 23:58:12

    ←Android 4.2 App Development Essentials

    →Introduction to Python for Computational Science and Engineering