Computational Physics
[Pages:31]Computational Physics
Programming Style and Practices & Visualizing Data via Plotting
Prof. Paul Eugenio Department of Physics Florida State University
Jan 29, 2019
Announcements
Reading Chapter 4
Accuracy and Speed: pages 126 ? 137 Turn-In Questions
2 questions on reading due next Tuesday
Programming Conventions to follow in this class
Documentation via docstring
Include documenting comments in your
programs
Each program should include a prolog comment block or docstring
Each function should start with a docstring
ddeeff gg((mm,,nn))::
""" triple-double-quotes"""
""""""
GGrreeaatteesstt CCoommmmoonn DDiivviissoorr
EEuucclliidd''ss pprreessccrriippttiioonn::
gg((mm,,nn)) == mm iiff nn ==00 eellssee
gg((mm,,nn)) == gg((nn,, mm mmoodd nn))
bbootthh mm && nn mmuusstt bbootthh bbee nnoonnnneeggaattiivvee iinntteeggeerrss
""""""
## NNooww ffoorr tthhee ccooddee ..........
The use of docstring will have helpful advantages later on
Program Prolog via docstring
#"#"!"go!"go"cf"cf/d/du.tu.tspwspwryoryo//bcnbcniaoiaonlnnln/cn/cneueeuenlgnlgvaavaattttpeipeiysvysvtetehthtohiohinennenttgegergrgeeeearartstseesmsmttaacncnododmmmnmnoonunussdidiininvgvgiisEsEouourcrcllgigi(d(dmm,p,pnrnr)e)essccrriippttiioonn.. ""PPEJ"PPEJ"aHxa"aHxa"uZenuZenl4rl4r1c21c2E5i8E5i8u1s,u1s,gCegCee2e2n20n20i,1i,1o9o9PPrroobblleemm 44 ffrroomm ____ffuuttuurree____ iimmppoorrtt ddiivviissiioonn,, pprriinntt__ffuunnccttiioonn
Functions, variables, and constants
Use meaningful variable names
Function names: lower_case_with_underscores
Examples: catalan(), generate_data() Names to AVOID
l (lowercase el), O (uppercase oh), or I (uppercase eye)
Functions, variables, and constants
Use meaningful variable names
Function names: lower_case_with_underscores
Examples: catalan(), generate_data() Names to AVOID
l (lowercase el), O (uppercase oh), or I (uppercase eye)
Variables: b, B, lower, mixedCase
Examples: N, i, j, maxAngularMomentum
Functions, variables, and constants
Use meaningful variable names
Function names: lower_case_with_underscores
Examples: catalan(), generate_data() Names to AVOID
l (lowercase el), O (uppercase oh), or I (uppercase eye)
Variables: b, B, lower, mixedCase
Examples: N, i, j, maxAngularMomentum
Constants: CAPITAL_WITH_UNDERSCORES
Examples: RADIUS_EARTH, exceptions for common use single constants i.e., g = 9.81, c = 3e8
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- simulating liquid argon with gromacs documentation
- march 9th class 6 numpy and recursion i introduction of
- scientific python
- python for data science cheat sheet subsetting slicing
- screenshot of my desktop showing a figure
- homework 1 new york university
- 1 cse 252a computer vision i fall 2017
- matlab subplot tight layout weebly
- computational physics
Related searches
- communications in computational physics
- european journal of computational mechanics
- computational mechanics pdf
- engineering and computational mechanics
- computational fluid dynamics book pdf
- computational mechanics jobs
- computational solid mechanics
- applied and computational mechanics
- computational fluid dynamics software
- computational fluid dynamics ppt
- ucl msc computational finance
- ucl computational finance msc