Python, the Language of Science and Engineering for Engineers

25
Boey Pak Cheong B. Sc. (Hons) [email protected] http://pytechresources.com Specialized in Python Training Since 2006

Transcript of Python, the Language of Science and Engineering for Engineers

Page 1: Python, the Language of Science and Engineering for Engineers

Boey Pak Cheong B. Sc. (Hons)[email protected]://pytechresources.comSpecialized in Python Training

Since 2006

Page 2: Python, the Language of Science and Engineering for Engineers

Learning to write programs stretches your mind, and helps you think better, creates a way of thinking about things that I think is helpful in all domains

­ Bill Gates, Microsoft Co­founder

Page 3: Python, the Language of Science and Engineering for Engineers

What is Python?

● A programming language● Interpreted● Object-oriented● High-level

● Developed by Guido van Rossum from 1989

● Cross-platform● Open-source, freely distributable

Page 4: Python, the Language of Science and Engineering for Engineers

Python 2 or 3

● Python 2 or 3 ?● Python 2.x is legacy, Python 3.x is the

present and future of the language.● Where can I get Python from?

● Python Official Website– Standard Python installation

● Third Party Packagers– Anaconda– Enthought Canopy

Page 5: Python, the Language of Science and Engineering for Engineers
Page 6: Python, the Language of Science and Engineering for Engineers
Page 7: Python, the Language of Science and Engineering for Engineers

Who uses Python?

Page 8: Python, the Language of Science and Engineering for Engineers

Engineering Companies Using Python

Page 9: Python, the Language of Science and Engineering for Engineers

Saving Energy with PythonSMS Siemag AG

Page 10: Python, the Language of Science and Engineering for Engineers

Lift off with PythonDLR German Aerospace Center

VAMPzero: Aircraft Conceptual Design with Python

Page 11: Python, the Language of Science and Engineering for Engineers

● Johnson Space Center● Integrated Planning System

– Uses Python as standard scripting language

● modular collection of tools for assisting shuttle pre-mission planning

● For more info visit : https://www.python.org/about/success/usa/

Page 12: Python, the Language of Science and Engineering for Engineers

Why Python?

● Easy to learn● Simple, clean syntax● As readable as English

● Write less code● 3 to 5 time shorter than Java● 5 to 10 times shorter than C++

● Higher productivity

Page 13: Python, the Language of Science and Engineering for Engineers

Why Python? (2)

● Impressive Standard Libraries● Extensive Third Party Libraries● Excellent Documentation● Powerful & Versatile

● Build websites● Analyze and visualize data● Scientific and numeric computing

Page 14: Python, the Language of Science and Engineering for Engineers

Why Python? (3)

● Free & Open-source● Great community

Page 15: Python, the Language of Science and Engineering for Engineers

Job Trends from Indeed.com

Page 16: Python, the Language of Science and Engineering for Engineers

Some other considerations

● TIOBE index – October 2016● Python – 5th Position● Fortran – 28th Position

● Intel released its Python distribution in 2016

Page 17: Python, the Language of Science and Engineering for Engineers

Fortran Vs Python

● Fortran● Heavily optimized static typed compiler● World's oldest yet still used language

● Python● Dynamic typed interpreted language● Created 1990

Page 18: Python, the Language of Science and Engineering for Engineers

Fortran Vs Python (2)

● Fortran● Synonymous with scientific computing● Only real alternative was C++● Including C, only languages supported by

Intel– Until their Python came along

● Huge amount of scientific and engineering code written in Fortran– And still in use

Page 19: Python, the Language of Science and Engineering for Engineers

Fortran Vs Python (3)

● Computer processing time vs programming time

● Much easier to learn Python● Faster to develop code using Python

1960/70's (Fortran days) Today

Computer Processing Time

Expensive Cheap

Programming Time Relatively Cheap Expensive

Page 20: Python, the Language of Science and Engineering for Engineers

Fortran Vs Python (4)

● Compared with Fortran, the core Python arrays (lists) are not fast

● But Python with SciPy and NumPy is a game changer

● >90,000 Python packages in pypi● Scientific/Engineering Category

● > 5500 packages● In 16 sub-categories

Page 21: Python, the Language of Science and Engineering for Engineers

Fortran Vs PythonConclusion

● Fortran will still be around for some years● Existing software needs maintenance

● But for new software ...● Python is a good alternative

– Easy to learn– Free, open-source– Numerous packages– Strong community

Page 22: Python, the Language of Science and Engineering for Engineers

What can you do with Python?

● Python by itself not suitable for typical engineering calculations

● You also need the numeric, scientific and plotting libraries● NumPy● SciPy● Matplotlib

● Anaconda and Enthought Canopy distributions provide all

Page 23: Python, the Language of Science and Engineering for Engineers

● Some engineering calculations you can do ● Linear algebra● Root finding (non-linear algebra)● Linear or nonlinear regression● Integration and ordinary differential

equations● statistics● plotting

Page 24: Python, the Language of Science and Engineering for Engineers
Page 25: Python, the Language of Science and Engineering for Engineers

Example Jupyter Notebooks

● Quickstart Python Tutorial ● Using the integrate module from scipy● Digital Signal Processing