<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Physics with Python - Medium]]></title>
        <description><![CDATA[Learning Physics with Python Programming Language - Medium]]></description>
        <link>https://medium.com/physics-with-python?source=rss----8e4b4d2d2ca4---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Physics with Python - Medium</title>
            <link>https://medium.com/physics-with-python?source=rss----8e4b4d2d2ca4---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 18:38:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/physics-with-python" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Uniform linear motion]]></title>
            <link>https://medium.com/physics-with-python/uniform-linear-motion-64ba14e58233?source=rss----8e4b4d2d2ca4---4</link>
            <guid isPermaLink="false">https://medium.com/p/64ba14e58233</guid>
            <category><![CDATA[subplot]]></category>
            <category><![CDATA[uniform-linear-motion]]></category>
            <category><![CDATA[kinematics]]></category>
            <category><![CDATA[matplotlib-tutorial]]></category>
            <dc:creator><![CDATA[Sparisoma Viridi]]></dc:creator>
            <pubDate>Mon, 12 Feb 2024 11:51:12 GMT</pubDate>
            <atom:updated>2024-02-12T11:51:12.296Z</atom:updated>
            <content:encoded><![CDATA[<h4>Begin the journey in learning mechanics</h4><p>As the name implies, uniform linear motion is a motion in a straight line with constant velocity (<a href="https://www.yukimura-physics.com/en/uniform-linear-motion/">Yukimura, 2023</a>), which means that the instantaneous velocity does not change over time (<a href="https://www.phyley.com/uniform-linear-motion">Phyley, 2022</a>). This state of a system can be maintained when there is not net acting on the system according to Newton’s first law and the initial velocity of the system is not zero (<a href="https://www.britannica.com/science/linear-motion">Britannica, 2017</a>).</p><h4>Equation</h4><p>From four kinematic equations (<a href="https://www.albert.io/blog/kinematic-equations/">Albert, 2022</a>; <a href="https://www.physicsclassroom.com/class/1DKin/Lesson-6/Kinematic-Equations">Henderson, 2022</a>), there is only one equation for uniform linear motion</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/0*zdXbvX2jM_4kp25r" /></figure><p>since the acceleration is zero. Usually it is also chosen that initial time is zero or <em>t</em><a href="https://www.htmlsymbols.xyz/unicode/U+2080">₀</a> = 0, so that the previous equation becomes simply</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/151/0*MgT-9XgSLbA1dTCd" /></figure><p>the form that people are already familiar with.</p><h4>Graphs</h4><p>From last equation it can be seen that there are two parameters that can be varied, e.g. <em>x</em><a href="https://www.htmlsymbols.xyz/unicode/U+2080">₀</a> and <em>v</em>, which will give different relation between <em>x </em>— <em>t</em>, but always linear and, of course, constant when <em>v</em> = 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ayX6vemYuSRJkX-m40LcLA.png" /><figcaption>Position <em>x</em> as function of time <em>t</em> for various values of initial position <em>x</em>₀ and velocity <em>v</em>.</figcaption></figure><p>Above figures shows nine subplots of position x against time t for various values of initial positions <em>x</em>₀ and velocity <em>v</em>, where <em>x</em>₀ and <em>v</em> can be negative, zero, and positive. They should be sufficient to resemble all possibilities for uniform linear motion.</p><h4>Code</h4><p>In order to produce previous code datasets for each subplots are required to be generated. But before generate the datasets, parameters must be set first.</p><pre># parameters<br>x0 = [5, 0, -5]<br>v = [-1, 0, 1]<br>ti = 0<br>tf = 10<br>t = [*range(ti, tf+1)]</pre><p>Then using above parameters generate the datasets.</p><pre># datasets<br>xx = []<br>for i in x0:<br>    for j in v:<br>        x = []<br>        for k in t:<br>            l = i + j * k<br>            x.append(l)<br>        xx.append(x)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4UC2ssocUcVvdysZ4c-GBQ.png" /><figcaption>Time and positions datasets generated using previous code.</figcaption></figure><p>Datasets in xx matrix can be plotted effectively using pyplot.subplot() function as shown in previous story (<a href="https://medium.com/p/23de1e39d16e">Viridi, 2024</a>). Modified code is as follow</p><pre># graph with suplots<br>import matplotlib<br>import matplotlib.pyplot as plt<br><br>plt.figure(figsize=(9, 6))<br>for i, x in enumerate(xx):<br>    plt.subplot(len(x0), len(v), i+1)<br>    plt.xticks([*range(0, tf+1, 2)])<br>    plt.grid()<br>    j = i % len(v)<br>    k = i // len(v)<br>    text = f&#39;x₀={x0[k]}, v={v[j]}&#39;<br>    plt.plot(t, x, &#39;.--&#39;, label=text)<br>    if i==3:<br>        plt.ylabel(&#39;x&#39;)<br>    if i==7:<br>        plt.xlabel(&#39;t&#39;)<br>    plt.legend()<br><br>plt.show()</pre><p>Notice that the code is already flexible for other combination of initial position <em>x</em>₀ and velocity <em>v</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MVQyhJdmcBLbTysIfFCtHA.png" /><figcaption>Result for x0 = [10, 5, -5, -10] and v = [-1, 0, 1].</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nSf1rvf33oLNiq0sWQxSGA.png" /><figcaption>Results fo x0 = [2, 1, 0, -1, -2] and v = [-1, -2, 1, 2].</figcaption></figure><p>Well, the layout is not so good, but the results are already right. How to fix margin, xlabel, ylabel, and other layout setting will be discussed in other, future story.</p><h4>Summaries</h4><p>After reading this story you are able to</p><ul><li>use kinematics equation for uniform linear motion to calculate position <em>x</em> at any time <em>t</em> if velocity <em>v</em> and initial position <em>x</em>₀ is given,</li><li>draw a graph of <em>x</em> against <em>t</em> using Python Matplotlib,</li><li>create datasets for <em>x</em> and <em>t</em> for various value of <em>v</em> and <em>x</em>₀,</li><li>make a graph with artibrary subplots according to variation of parameters.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64ba14e58233" width="1" height="1" alt=""><hr><p><a href="https://medium.com/physics-with-python/uniform-linear-motion-64ba14e58233">Uniform linear motion</a> was originally published in <a href="https://medium.com/physics-with-python">Physics with Python</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Various ways in presenting two time series]]></title>
            <link>https://medium.com/physics-with-python/various-ways-in-presenting-two-time-series-fc10ecb55372?source=rss----8e4b4d2d2ca4---4</link>
            <guid isPermaLink="false">https://medium.com/p/fc10ecb55372</guid>
            <category><![CDATA[data-features]]></category>
            <category><![CDATA[fft]]></category>
            <category><![CDATA[time-series-analysis]]></category>
            <dc:creator><![CDATA[Sparisoma Viridi]]></dc:creator>
            <pubDate>Sat, 10 Feb 2024 14:29:49 GMT</pubDate>
            <atom:updated>2024-02-10T14:29:49.648Z</atom:updated>
            <content:encoded><![CDATA[<h4>With additional standard deviation for each series</h4><p>A time series is a series of sequence of numerical data points fixed at certain chronological time order, where in most cases the data points recorded at fixed interval points in time, which make easier to accurately forecast the necessities (<a href="https://medium.com/p/7006ea1c3326">Anish, 2020</a>). Time is often the independent variable in a time series and there are other aspects that come into play when dealing with the time series, which can be addressed whether it is stationary, seasonality, or autocorrelated, that might determine the characteristics of the time series (<a href="https://medium.com/p/70d476bfe775">Peixeiro, 2019</a>). Some simple methods, among the rich family of algorithms in forecasting time series, the basic ones are average method, moving average method, and naive method, which is simple to understand but unfortunately they will not give good prediction (<a href="https://medium.com/p/15e9490b2618">Encora, 2019</a>). Today there are many online services available for forecasting timeseries, e.g. Amazon Forecast, which offers some features that can adapt the predication by monitoring the accuracy based on newly available data (<a href="https://medium.com/p/539313c5d41d">Hoarau, 2022</a>). In this story there are five columns data for <em>t</em>, <em>x</em>₁, <em>x</em>₂, σ₁, σ₂ that stand for time, features and their standard deviations. Some attempts are reporting in presenting the data to find the hidden patterns.</p><h4>Data file</h4><p>Columns representing <em>t</em>, <em>x</em>₁, <em>x</em>₂, σ₁, σ₂ are in fixed width format, where it is also supported in Python using pandas with function read_fwf() (<a href="https://medium.com/p/f1db8f737276">Rask, 2021</a>). Here the function will be used to read content of fixed width text file and store it in Pandas dataframe.</p><h4>Standard presentation</h4><p>It is obvious to display time series in scatter plot <em>x</em>₁—<em>t</em>, <em>x</em>₂—<em>t</em>, and <em>x</em>₂—<em>x</em>₁.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KlhucYwpoHTWZUC-kpczvg.png" /></figure><p>Plot <em>x</em>₁ — <em>t</em> does not show any pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xyinFTh8KCwFBwprimvTA.png" /></figure><p>Plot <em>x</em>₂ — <em>t</em> also does not show any pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iGvWuRkbANFQOGnoyMMplg.png" /></figure><p>Plot <em>x</em>₂ — <em>x</em>₁ does not show any pattern. Following are plot using σ₁ and σ₂ data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36nAxKrruMWSUVj6agzC1g.png" /></figure><p>Plot σ₁ — <em>x</em>₁ also does not show any pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jtMY5bQRgtJ5UHHvE8lrEw.png" /></figure><p>Plot σ₂ — <em>x</em>₂ also does not show any pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*005SVpM4UXoVQmMXUoXNdQ.png" /></figure><p>Plot σ₂ — σ₁ also does not show any pattern. Until now there is any pattern can be obtained.</p><h4>Histogram</h4><p>In this part histogram of <em>x</em>₁, <em>x</em>₂, σ₁, and σ₂ are given.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9v7nq2ndMhiapEAGf7GRHA.png" /></figure><p>Distribution of <em>x</em>₁ is not symmetrical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tpEx9BzDzXgPO0PqoUBN2g.png" /></figure><p>Distribution of <em>x</em>₂ is not symmetrical and has different shape compared to of <em>x</em>₁.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C13T6Y_sP0Mw4MLFSjqJ1A.png" /></figure><p>Distribution of σ₁ shows maximum peak is not at minimum value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kWQ7CRB4ZgMYD8wK0HHu5w.png" /></figure><p>Distribution of σ₂ shows maximum peak is not at minimum value.</p><h4>Polar coordinates</h4><p>Assuming that <em>x</em>₁ and <em>x</em>₂ are related in radial direction, they can be transformed from Cartesian coordinates to polar coordinates. In this part presentation of <em>r</em> and θ.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iHXp3K307YYV5FfUSNQSxg.png" /></figure><p>Plot of <em>r</em> — θ does not show any patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GmGkt7J8lDLdK4VkZJ0Jag.png" /></figure><p>Plot of <em>r</em> — <em>t</em> also does not show any patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f5OuK-4Do5kZEq0ZNHvwJQ.png" /></figure><p>Plot of θ — <em>t</em> shows interesting, sort of periodic pattern for 54k ≤ <em>t</em> ≤ 59k. And following is the histograms of data in polar coordinates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Awo_4de-8aEy61u-gooeqg.png" /></figure><p>It seems that there is peak of favorable value of <em>r</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GJpf680xXlfes0ssi5TtqA.png" /></figure><p>But there is not any strong pattern for θ.</p><h4>FFT</h4><p>Due to periodic pattern in θ, Fast Fourier Transform of FFT is used to dig deeper the pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*66_phPOsSrnbHpUt7EM4Xg.png" /></figure><p>It seems that there are periodicity in <em>x</em>₁ time series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iKC2GLjQT3VEYbYQlwmmHQ.png" /></figure><p>It seems also that there are periodicity in <em>x</em>₂ time series with more peaks compared to <em>x</em>₁.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xSCngMmjQuJ_IpHGc9qxnw.png" /></figure><p>From above figure there is not any pattern in <em>r</em> time series and only DC component is pronounce.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uRMCwc_vNe654dGeQrIEgw.png" /></figure><p>Periodicity in θ is clear as in <em>x</em>₂.</p><h4>Summaries</h4><p>Form previous data presentations it can be summarized that</p><ul><li>Distribution of <em>x</em>₁ and <em>x</em>₂ are not symmetrical nor identical.</li><li>There are favorable values for <em>x</em>₁, <em>x</em>₂, and <em>r</em> but not for θ.</li><li>Periodicity in <em>x</em>₁, <em>x</em>₂ and θ are pronounce but not in <em>r</em>.</li><li>There might possibility that periodicity in <em>x</em>₁ and <em>x</em>₂ are due to periodicity in θ.</li></ul><p>Further analysis is required to assure understanding characteristics of data before choosing the prediction method.</p><p>Thanks to <a href="https://medium.com/u/a3b62ec099d4">Athul Anish</a>, <a href="https://medium.com/u/741c1c8fcfbd">Marco Peixeiro</a>, <a href="https://medium.com/u/8c0e9b072ae7">Encora</a>, <a href="https://medium.com/u/397bc5293f03">Michaël HOARAU</a>, <a href="https://medium.com/u/8010be06dec7">Amy Rask</a> for the inspiring stories.</p><ul><li>Anish A (2020) “Time Series Analysis”, The Startup — Medium, 24 Nov, url <a href="https://medium.com/p/7006ea1c3326">https://medium.com/p/7006ea1c3326</a> [20240208].</li><li>Hoarau M (2022) “”, Medium, 9 Mar 2022, url <a href="https://medium.com/p/539313c5d41d">https://medium.com/p/539313c5d41d</a> [20240208].</li><li>Encora (2019) “Fundamentals of Time Series Data and Forecasting”, Better Programming — Medium, 25 Jul, url <a href="https://medium.com/p/15e9490b2618">https://medium.com/p/15e9490b2618</a> [20240208].</li><li>Peixeiro M (2019) “”, Towards Data Science — Medium, 7 Aug, url <a href="https://medium.com/p/70d476bfe775">https://medium.com/p/70d476bfe775</a> [20240208].</li><li>Rask A (2021) “Parsing Fixed Width Text Files with Pandas”, Towards Data Science — Medium, 11 Aug, url <a href="https://medium.com/p/f1db8f737276">https://medium.com/p/f1db8f737276</a> [20240208].</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc10ecb55372" width="1" height="1" alt=""><hr><p><a href="https://medium.com/physics-with-python/various-ways-in-presenting-two-time-series-fc10ecb55372">Various ways in presenting two time series</a> was originally published in <a href="https://medium.com/physics-with-python">Physics with Python</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System of linear equations for two loops DC circuit]]></title>
            <link>https://medium.com/physics-with-python/system-of-linear-equations-for-two-loops-dc-circuit-6e952d0954af?source=rss----8e4b4d2d2ca4---4</link>
            <guid isPermaLink="false">https://medium.com/p/6e952d0954af</guid>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[kirchhoff]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sparisoma Viridi]]></dc:creator>
            <pubDate>Tue, 30 Jan 2024 23:00:45 GMT</pubDate>
            <atom:updated>2024-01-30T23:00:45.447Z</atom:updated>
            <content:encoded><![CDATA[<h4>Solving Kirchhoff laws using NumPy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TgkUJV9N6IryIOY0TNbHcg.png" /></figure><p>An example of solving system of linear equations obtained from Kirchhoff laws for two loops DC circuit numerically using NumPy is given here in brief.</p><h3>DC circuit</h3><p>A two loops DC circuit has following schematic.</p><pre>a            b            c<br>+-----R1-----+-----R2-----+<br>|            |            |<br>|            |            |<br>| +          |          + |<br>E1           R3           E2<br>| -          |          - |<br>|            | | I3       |<br>|            | v          |<br>+------------+------------+<br>f    &lt;-- I1  e  I2 --&gt;    d<br></pre><p>There are two batteries E1 and E2, three resistors R1, R2, R3.</p><h3>Kirchhoff laws</h3><p>From previous schematic following equations can be obtained</p><pre>E1 - I1 R1 - I3 R3 = 0<br>E2 - I2 R2 - I3 R3 = 0<br>I1 + I2 = I3<br></pre><p>or in matrix form</p><pre>| R1   0  R3 | | I1 |   | E1 |<br>|  0  R2  R3 | | I2 | = | E2 |<br>|  1   1  -1 | | I3 |   |  0 |<br></pre><p>with</p><pre>R I = E<br></pre><p>with</p><pre>I = R&#39; E</pre><p>is the solution, where R’is invers of R.</p><h3>Python code</h3><p>Previous equations can be solved in Python as follow, which is available on <a href="https://onecompiler.com/python/422xvrc26">https://onecompiler.com/python/422xvrc26</a>.</p><pre>import numpy as np<br><br>R1 = 2<br>R2 = 2<br>R3 = 1<br>E1 = 6<br>E2 = 6<br><br>E = np.array([[E1], [E2], [0]])<br>R = np.array([<br>  [R1,  0, R3],<br>  [ 0, R2, R3],<br>  [ 1,  1, -1]<br>])<br><br>D = np.linalg.det(R)<br><br>if D != 0:<br>  Rinv = np.linalg.inv(R)<br><br>  I = Rinv @ E<br>  print(&quot;I1 =&quot;, I[0][0])<br>  print(&quot;I2 =&quot;, I[1][0])<br>  print(&quot;I3 =&quot;, I[2][0])</pre><p>with</p><pre>I1 = 1.5<br>I2 = 1.5<br>I3 = 3.0</pre><p>as the results, which give I1 = 1.5 and I2 = 1.5, and it is proved that I3 = 11 + I2.</p><h4>Next to do</h4><p>Explore further system of linear equations, e.g.</p><ul><li>types of the solutions (<a href="https://medium.com/@tseek2021/6501cc51673c">Chitreddy, 2022</a>),</li><li>process of get the solution analytically (<a href="https://medium.com/@avinashsi.yadav/fdd09797f7d2">Yadav, 2023</a>),</li><li>geometrical representation in hyperplane (<a href="https://medium.com/@falgunimukherjee/2ebe4be2f98d">Mukherjee, 2018</a>).</li></ul><p>Thanks to <a href="https://medium.com/u/8fe490a2ba04">Sandeep Chitreddy</a>, <a href="https://medium.com/u/da15d018e497">Avinash Singh Yadav</a>, and <a href="https://medium.com/u/41e51b50a5d2">Falguni Mukherjee</a> for the inspiring stories.</p><ul><li>Chitreddy S (2022) “A quick summary of all types of solutions to system of linear equations”, Medium, 27 May, url <a href="https://medium.com/@tseek2021/6501cc51673c">https://medium.com/@tseek2021/6501cc51673c</a> [20240131].</li><li>Mukherjee F (2018) “Linear Algebra for Machine Learning Part 3 — System of Linear Equations”, Medium, 4 Jul, url <a href="https://medium.com/@falgunimukherjee/2ebe4be2f98d">https://medium.com/@falgunimukherjee/2ebe4be2f98d</a> [20240131].</li><li>Yadav A S (2023) “System of Linear Equation”, Medium, 9 Aug, url <a href="https://medium.com/@avinashsi.yadav/fdd09797f7d2">https://medium.com/@avinashsi.yadav/fdd09797f7d2</a> [20240131].</li></ul><p>This story begins while visiting Cirebon campus and on the way to Bandung, then it is finished in the next morning while at home in the neighbor regency of Bandung.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e952d0954af" width="1" height="1" alt=""><hr><p><a href="https://medium.com/physics-with-python/system-of-linear-equations-for-two-loops-dc-circuit-6e952d0954af">System of linear equations for two loops DC circuit</a> was originally published in <a href="https://medium.com/physics-with-python">Physics with Python</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One-dimension consecutive motion]]></title>
            <link>https://medium.com/physics-with-python/one-dimension-consecutive-motion-548a44f4c435?source=rss----8e4b4d2d2ca4---4</link>
            <guid isPermaLink="false">https://medium.com/p/548a44f4c435</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[physics]]></category>
            <dc:creator><![CDATA[Sparisoma Viridi]]></dc:creator>
            <pubDate>Tue, 30 Jan 2024 05:33:42 GMT</pubDate>
            <atom:updated>2024-01-30T23:40:58.607Z</atom:updated>
            <content:encoded><![CDATA[<h4>Simple kinematics and Python</h4><p>Kinematics is part of physics that should be simple, especially for uniform linear motion or ULM. In consecutive motion, where one ULM continues to other ULM, complexity is introduced to the system. Here a simple example accompanied with Python code is given.</p><h3>Consecutive motion</h3><p>A point mass particle performs a consecutive motion with initial time 0 s and initial position 5 m. There are fives time ranges 5, 1, 2, 3, 1 s with its own displacement 5, 2, -6, 3, -1 m.</p><p>Using available information, position and time at begin or end of each time ranges can be found.</p><h3>Python code</h3><p>Following code can be used to calculate position at certain time.</p><pre>x = 5<br>dx = [5, 2, -6, 3, -1]<br>t = 0<br>dt = [5, 1, 2, 3, 1]<br><br>N = min(len(dx), len(dt))<br><br>print(&#39;t\tx&#39;)<br>print(t, x, sep=&#39;\t&#39;)<br>for i in range(N):<br>  x += dx[i]<br>  t += dt[i]<br>  print(t, x, sep=&#39;\t&#39;)<br><br></pre><p>And following</p><pre>t	x<br>0	5<br>5	10<br>6	12<br>8	6<br>11	9<br>12	8</pre><p>are the results. You can try the code on <a href="https://onecompiler.com/python/422x8fzm6">https://onecompiler.com/python/422x8fzm6</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=548a44f4c435" width="1" height="1" alt=""><hr><p><a href="https://medium.com/physics-with-python/one-dimension-consecutive-motion-548a44f4c435">One-dimension consecutive motion</a> was originally published in <a href="https://medium.com/physics-with-python">Physics with Python</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Physics and Python]]></title>
            <link>https://medium.com/physics-with-python/physics-and-python-077ecd9d38d5?source=rss----8e4b4d2d2ca4---4</link>
            <guid isPermaLink="false">https://medium.com/p/077ecd9d38d5</guid>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Friendly Editor]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 20:49:36 GMT</pubDate>
            <atom:updated>2024-01-29T20:49:36.698Z</atom:updated>
            <content:encoded><![CDATA[<h4>Can we learn science using programming language?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*d0S7OVAiIjJlr8tb8gLfvA.png" /><figcaption><a href="https://www.pngkey.com/maxpic/u2t4e6w7q8o0t4u2/">https://www.pngkey.com/maxpic/u2t4e6w7q8o0t4u2/</a> and <a href="https://www.cleanpng.com/png-angle-text-symbol-brand-other-python-622381/">https://www.cleanpng.com/png-angle-text-symbol-brand-other-python-622381/</a></figcaption></figure><p>This is always bother me since it is easier for me to learn programming language than science due to its direct feed back while compiling the code. We get the information about what we learn, whether it is right or wrong. We correct our understanding when it is wrong or we keep that as the knowledge when it is right and this make us more confident, so we can step further.</p><p>Is there any way that we can learn science, especially physics in the way we learn programming? We can compile our current understanding about a topic and later make it as our knowledge.</p><p>This is actually purpose of this publication <a href="https://medium.com/physics-with-python">Physics and Python</a>. You can write about Physics with some Python code or you can write about Python and its implementation in Physics. And last but not the least, how we can in the near future develop a Python-based Physics Programming language, where we can learn Physics using a sort of programming language, numerically and also symbolically.</p><p>You are welcome to join. Comment to this story that you would like to join this publication.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=077ecd9d38d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/physics-with-python/physics-and-python-077ecd9d38d5">Physics and Python</a> was originally published in <a href="https://medium.com/physics-with-python">Physics with Python</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>