A Beginners Guide to Python Programming - Part 0: Introduction, Goals and Software installation

in #steemit6 years ago (edited)

Text placeholder.png

Source

Introduction

Dear fellow Steemians.

In a recent post by @SteemSTEM my latest post about fusion was also mentioned and I was lovingly named as the "fusion guy". That certainly did not offend me, actually it made me laugh. But what it also did is it made me think. Do I really want to be so one-dimensional? What made me think further is all the posts made post-festum about STEEMfest (do you see what I did there?). They all posted that the future of STEEM is dApps and other things that introduce "ordinary people" from the internet, non-crypto users, to STEEM. While I have zero capability in programming in any of the web programming languages like javascript and therefore I cant really write a dApp, I do want to make a contribution to STEEM in my own way. I can do that with bringing ordinary people from the web to steemit specifically by posting about one of the hottest topics on the internet. Internet beginners tutorials about programming.

So... That is what I decided to do. At work I do a lot of programming as a phyicist as all theoretical physics nowadays happens on computers. I usually use Fortran which is an old but extremely functional programming language that is especially suited for challenging computations with its many useful libraries designed to speed up mathematical computations like solving of ordinary differential equations which are all-prevalent across physics.

A much more beginner friendly programming language in my opinion is Python because of its intuitive syntax. It is a bit slower than fortran, so for really costly computations, fortran is usually used. But with excellent libraries based on Fortran actually, like scipy and numpy python is still used when a computation is not too expensive. So, because of these reasons we will use python in this tutorial.

Goals of this Tutorial

So what are the goals of this tutorial series and who is it suited for? Well as the name itself suggests it is made for beginners as I intend to start at the very begining with presenting various concepts integral to python like objects and their type. Later I will focus on operations with lists and arrays as numpy calls them as they are the most usefull in computational physics.

The end goal of this tutorial is three-fold. I hope you will be able to absorb all the lessons which would mean you will be able to solve all, even multi-dimensional differential equations with ease. To test this we will solve a simple diffusion equation of two liquids mixing in a round pipe, where one fluid will have a vector field of velocity and the other will be added as a sort of cloud of liquid. We will of course do this together here in my post gradually. I encourage you to follow along. At the end of each post after this one I will also include some "homework". You will then be able to upload your "homework" onto a repository on GitHub where I will go over them and comment if anything can be upgraded. I will provide the link in Part 1.

The second goal will be done after we finish the project on the physical problem. It will be how to make a simple game on your own. We will illustrate this on an example of the classic snake game.

post-14916-0-39203900-1454001177.gif
Source

Important notice!!!

Also, three most innovative solutions for each part of the tutorial will be chosen and a portion of the revenue of the corresponding post will be sent to them. First place will get 5% of the payed out rewards, second place 3% and third place 2%. If the post gets a 40 SBD pay-out this means the first place gets 2 SBD, second about 1.2 SBD and third place 0.8 SBD.

Needed software

We will be working with python 3 or later. But most of the stuff will also work on distributions of python 2.7 or later. The packages you will need are:

The first two are used for calculations purposes and the last one will be used to plot our results. For the snake end project I havent decided on what to use yet, so I will answer that question when we get to it.

How to get the python distribution and all the necessary packages?

Well in my opinion it is easiest to just download a Anaconda or Conda distribution from here. It provides you with a nice graphical installer and it configures all the system paths needed itself, making it extremely usefull. It also contains all the packages that I have talked about! So if you manage to download it and install it, then you are all set for a long time.

The distribution comes with its own text editor called spyder which contains an integrated console from which you can compile and execute your programs.

spyder.png

You write your program.py on the left in the text editor and by pressing F5 it executes your program in the console on the right.

After you have installed an Anaconda or Conda distribution start the Spyder text editor. When it opens (it takes a long time, so dont worry) type the following things into the console directly:

import numpy

Press Enter. If nothing happes this means you have succesfully installed everything and you ready for Part 1.

If any of you have any problems, do not hesitate to type your issue into the comments section. I will help you to the best of my abilities.

Sort:  

@maticpecovnik, tvoja objava je dobila 100% upvote od @teamslovenia!

Kako dobiti upvote?

Pridruži se nam v Discord strežniku!
Uporabi TeamSlovenia upvote bot!

Kako lahko tudi ti pomagaš, da bo @teamslovenia bot močnejši?

Delegiraj steem power - 50 SP - 100 SP - 500 SP - 1000 SP - Po želji!
Sledi upvotom od @teamslovenia - Navodila


Ta projekt podpira Steem Witness @fbslo - Glasuj zdaj!

I'm into learning Python these days, so your series came right on time, I'll keep my eye on it! :D

I know to work in Matlab, so I believe that it won't be much hard to conquer Python.

Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!

Reply !stop to disable the comment. Thanks!

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 16 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

I upvoted your contribution because to my mind your post is at least 5 SBD worth and should receive 66 votes. It's now up to the lovely Steemit community to make this come true.

I am TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!

Have a nice day and sincerely yours,
trufflepig
TrufflePig





This post has been voted on by the SteemSTEM curation team and voting trail in collaboration with @curie.

If you appreciate the work we are doing then consider voting both projects for witness by selecting stem.witness and curie!

For additional information please join us on the SteemSTEM discord and to get to know the rest of the community!

Hi, @maticpecovnik!

You just got a 0.18% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.033
BTC 69831.92
ETH 3744.43
USDT 1.00
SBD 3.77