-
Notifications
You must be signed in to change notification settings - Fork 2
/
python.html
executable file
·155 lines (155 loc) · 10.2 KB
/
python.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<link rel="stylesheet" type="text/css" href="css/menu.css">
<title>python</title>
</head>
<body> <a href="index.html"><img src="images/eyes-logo.png" height="100" width="420"></a>
<div id="mynb">
<ul>
<li><a href="../Expt17/expts.html"><span>Experiments</span></a></li>
<li><a href="../design.html"> <span>Design</span></a></li>
<li><a href="../hardware.html"> <span>How to Buy</span></a></li>
<li><a href="../software.html"> <span>Software</span></a></li>
<li><a href="../android.html"> <span>Android</span></a></li>
<li><a href="../python.html"> <span>python</span></a></li>
<li><a href="../microhope.html"><span>MicroHOPE</span></a></li>
<li><a href="../people.html"> <span>People</span></a></li>
<li><a href="../news.html"><span>News</span></a></li>
</ul>
</div>
<h1 class="title">Python Programming</h1>
<p> <a href="http://www.python.org/">Python</a> is an interpreted language
with an easy to learn syntax and has very good libraries for graphics,
networking, scientific computation etc. It is freely downloadable and
available on almost all operating systems. The Phoenix project uses Python
for developing all the code except the one running on the
micro-controller. There are so many books available on Internet for
learning Python. The book "Python for Education" tries to introduce Python as a tool for learning
Science & Mathematics. To run and modify the examples given in this
book, a code browser program also is available as a Debian package.
</p>
<p>Download the <a href="Documents/pythonForEducation.pdf">Book
in PDF format</a> and the <a href "Documents/learn-by-coding-1.4.0.deb">
code example browser</a>. A screen-shot of this program is <a href="images/learn-by-coding.png">here</a>. <h3 style="margin-bottom: 0cm; line-height: 100%; text-align: left;">Python
for learning Science and Maths </h3>
<p> In the high school classes, we learn about the various
branches of mathematics, like geometry, algebra, trigonometry, calculus
etc. , without bothering much about their interconnections. Plotting the
graphs of different algebraic and trigonometric functions helps
understanding them better. Simple numerical methods can demonstrate the
connection between algebra and calculus. This knowledge is useful for for
exploring the problems in physics in a different manner.</p>
<p style="margin-bottom: 0cm; line-height: 100%; text-align: justify;">The
software requirement is Python Interpreter along with <a href="http://www.scipy.org/getting-started.html">Numpy,
Scipy</a> and <a href="http://matplotlib.org/">Matplotlib</a> packages.</p>
<p style="margin-bottom: 0cm; line-height: 100%; text-align: left;"><span style="font-weight: bold;"><a
title="videos" href="https://www.youtube.com/channel/UCzIRARfyO-cd1VezgZlEaQw">Youtube
Videos</a></span></p>
<p style="margin-bottom: 0cm; line-height: 100%; text-align: justify;">Several
videos made during writing these examples also have been uploaded to the
Youtube. (Keeping the RecordmyDesktop program running and mumbling while
writing code can generate the drag and audio comparable to that of a 19th
century steam locomotive) </p>
<p style="margin-bottom: 0cm; line-height: 100%; text-align: justify;"> </p>
<p><span style="color: #ff6600;"><span style="font-weight: bold;">Short
Python Programs, based on Higher Secondary Mathematics and Physics
topics</span></span></p>
<p style="margin-bottom: 0cm; line-height: 100%; text-align: justify;">All
the examples below have <span style="font-weight: bold;">less than 20
lines</span> of Python code, excluding empty lines and comments. If any
example exceeds 20 lines, you will find a shorter version also given.</p>
<p><a href="Documents/Examples/plot-equation.py">plot-equation.py</a> :
Plotting Graphs using numpy and matplotlib. The example demonstrates
sine(x), you may also try other functions. <a href="Documents/Examples/plot-ncurve.py">screenshot
<br></a></p>
<a href="Documents/Examples/plot-ncurve.py">plot-ncurve.py</a> : Plot
some interesting graphs . <a href="Documents/Images/plot-ncurve.png">screenshot</a><br>
<br>
<a href="Documents/Examples/sum-of-sines.py">sum-of-sines.py</a> : Sum of
two sine waves result in beats. <a title="Beats" href="Documents/Images/sum-of-sines.png">screenshot</a>.
<br>
<a href="Documents/Examples/product-of-sines.py"><br>
product-of-sines.py</a> : Amplitude modulation by multiplying two sine
waves. <a href="Documents/Images/product-of-sines.png">screenshot</a><br>
<a href="file:///home/ajith/expeyes-website/Documents/Examples/mass-spring-euler.py"><br>
</a><a href="Documents/Examples/3phase-ac.py"> 3phase-ac.py</a> : Plots the
3 phases of 230 Vrms AC mains, and the voltage difference between two
phases. <a href="Documents/Images/3phase-ac.png">screenshot</a><br>
<br>
<a href="Documents/Examples/mass-spring-euler.py">mass-spring-euler.py</a> :
Solve the mass on a spring system using Euler method of integration. <a href="Documents/Images/mass-spring-euler.png">screenshot</a><br>
<a href="Documents/Examples/mass-spring-visual.py"><br>
mass-spring-visual.py</a> : Mass Spring system animation using
python-visual, computation using Euler method of integration<br>
<a href="Documents/Examples/accn-vel-from-pos.py"><br>
accn-vel-from-pos.py</a> : Calculate acceleration and velocity from
position data. <a href="Documents/Images/accn-vel-from-pos.png">screenshot</a><br>
<br>
<a href="Documents/Examples/integrate-trapez.py">integrate-trapez.py</a> :
Calculate the area under an arc of unit radius from x=0 to 1, using
trapezoid rule . Compare the result with pi/4. <a href="Documents/Images/integrate-trapez.png">screenshot</a><br>
<br>
<a href="Documents/Examples/integrate-scipy-quad.py">integrate-scipy-quad.py</a>
: Calculate the area under an arc of unit radius from x=0 to 1, using
scipy.integrate.quad() function<br>
<br>
<a href="Documents/Examples/pos-time-plot-euler.py">pos-time-plot-euler.py</a>
: One dimensional motion. Velocity and initial position given. Use
Euler integration to plot x(t) . <a href="Documents/Images/pos-time-plot-euler.png">screenshot</a><br>
<a href="Documents/Examples/rdecay-euler.py"><br>
rdecay-euler.py</a> : Plot the radioactive decay curve calculated using
Euler method of solving differential equation dN/dt = -L * N. <a href="Documents/Images/rdecay-euler.png">screenshot</a><br>
<a href="Documents/Examples/rdecay-scipy.py"><br>
rdecay-scipy.py</a> : Radioactive decay curve. dN/dt = -L * N, solved
using scipy.integrate.odeint() . <a href="Documents/Images/rdecay-scipy.png">screenshot</a><br>
<br>
<a href="Documents/Examples/rdecay-scipy-2.py">rdecay2-scipy.py</a> :
Radioactive decay curve. dN/dt = L * N. Two of them solved at a time using
scipy.integrate.odeint() . <a href="Documents/Images/rdecay-scipy-2.png">screenshot</a><br>
<br>
<a href="Documents/Examples/second-order-de-scipy.py">second-order-de-scipy.py</a>
: Solving second order equation by splitting into two first order ones.
solve d2y/dx2 = -y gives y=sin(x). <a href="Documents/Images/second-order-de-scipy.png">screenshot</a><br>
<br>
<a href="Documents/Examples/projectile-2d-euler.py">projectile-2d-euler.py</a>
: Projectile motion, trajectory in x-y plane calculated using Euler's
method. <a href="Documents/Images/projectile-2d-euler.png">screenshot</a><br>
<br>
<a href="Documents/Examples/projectile-2d-scipy.py">projectile-2d-scipy.py</a>
: Projectile motion, trajectory in x-y plane calculated using
scipy.integrate.odeint(). <a href="Documents/Images/projectile-2d-scipy.png">screenshot</a><br>
<br>
<a href="Documents/Examples/mass-spring-scipy.py">mass-spring-scipy.py</a> :
Solve the mass on a spring system using scipy.integrate.odeint(). <a href="Documents/Images/mass-spring-scipy.png">screenshot</a><br>
<br>
<a href="Documents/Examples/Lorentz-force-scipy.py">Lorentz-force-scipy.py</a>
: Trajectory of a charged particle in electric and magnetic fields. <a href="Documents/Images/Lorentz-force-scipy.png">screenshot</a><br>
<a href="file:///home/ajith/Videos/python4schools/Examples/accn-vel-from-pos.py"><br>
</a><a href="Documents/Examples/Lorentz-force-scipy-vector.py">Lorentz-force-scipy-vector.py</a>
: Trajectory of a charged particle in electric and magnetic fields, using
vector equations. <a href="Documents/Images/Lorentz-force-scipy-vector.png">screenshot</a><br>
<a href="file:///home/ajith/Videos/python4schools/Examples/accn-vel-from-pos.py"><br>
</a><a href="Documents/Examples/Lorentz-force-euler.py">Lorentz-force-euler.py</a>
: Trajectory of a charged particle in electric and magnetic fields. <a href="Documents/Images/Lorentz-force-euler.png">screenshot</a>
, circle is becoming spiral due to computational error.<br>
<a href="file:///home/ajith/Videos/python4schools/Examples/accn-vel-from-pos.py"><br>
</a><a href="Documents/Examples/plot-data-3d.py">plot-data-3d.py</a> : Reads
multi-column text data from files and plots the first 3 columns, <a href="Documents/Images/plot-data-3d.png">screenshot</a>
shows the data from file.<br>
<br>
<a href="Documents/Examples/plot-data-3d.py">plot-data-2d.py</a> : Reads
multi-column text data from files and plots the first 2 columns, <a href="Documents/Images/plot-data-2d.png">screenshot</a>
shows the data from file.<br>
<br>
<a href="Documents/Examples/Efield-plot.py">Efield-plot.py</a> : Plots
the electric field produced by several point charges located in a plane. <a
href="Documents/Images/Efield-plot.png">screenshot</a><br>
<br>
<br>
Ajith Kumar B P<br>
bpajith at gmail.com<br>
<br>
</body>
</html>