Six years ago I was laid off from an engineering job, and I decided it was time, after 16 years in the field, to review some of the fundamentals that I had forgotten in the intervening time. One of my co-workers, before I left, had been working with his daughter on Algebra using the site Purple Math. I also read James Gleick’s book Chaos at that time, and that got me interested in doing a little exploring.
I started by reviewing geometry, algebra, calculus, and differential equations using the The Easy Way series. I checked them out of the library and this led me to reading some of the other books on the shelves there. I came to realize that there was a whole world of mathematics that I really had no idea existed, especially after I made the attempt to read a math paper from arXiv and realized that I had no idea what the first paragraph was saying. Hilbert Spaces? Riemannian Geometry? Topological forms? Rings? Lie Groups? What were these things? More importantly, why had we not studied those in school? They were interesting, much more interesting, than the calculations that I had to master in high school and college.
In any case, I’ve found that math is also important in programming, both for solving problems like the permutations program that I covered recently, as well as others. It’s also important for designing algorithms, and so on. Logic is a part of mathematics and is the basis for all computer programs.
So what I’d like to do in this occasional series is look at some of the concepts I come across in the course of learning to program. I figure the first couple will look at permutations, and some basic set theory. I will also look at the trials and tribulations I am having of learning to put math equations in LaTeX for my blog posts!
Today started out frustrating, although it wasn’t a bad day. It took me three hours to figure out the trapezoidal method of integration, because none of the descriptions I could find were very clear. I coded it up in Python – The annoying thing being, that I’m learning Python concurrently. This is all for a class in Nonlinear Dynamics, one of the big tools for complexity science. The next thing I need to do is learn to plot the results; for now, I am copy-pasting into Excel and letting it create a chart. Sadly, such tutorials as there are on the web do not allow me to get up and running quickly for plotting the graphs I need. I’ll just add it to the list…
I also read through a chapter of SQL (database language) on scripts. For our semester project, I have decided to create a fictitious library that will use my not-fictitious collection of books. For this week’s assignment, we need to create a script that is logical for our business; I’m pondering what that might be for my library.
Finally, reading. I’m working my way through Samantha Power‘s book on Genocide. It’s painful reading, mainly because of the inaction of the United States on the subject over the years. I don’t know what the answer is; I’m not a huge fan of R2P (Responsibility to Protect). But inaction doesn’t seem to be a good answer either.
That’s all for today. Below is the Python code I wrote for the Trapezoidal method for a Simple Harmonic Oscillator.
g = input(“Enter X Sub 0: “)
Xsub0 = float(g)
h = input(“Enter V sub 0: “)
Vsub0 = float(h)
B = input(“Enter Friction (B): “)
friction = float(B)
g = input(“Enter Gravity (g): “)
gravity = float(g)
m = input(“Enter Mass (m): “)
mass = float(m)
k = input(“Enter Spring Constant (K): “)
KConstant = int(k)
t = input(“Enter time step (del-t): “)
deltaT = float(t)
e = input(“Enter end time: “)
endTime = float(e)
i = 0.0
Xnow = Xsub0
Vnow = Vsub0
while i <= endTime:
vprime = gravity – ((friction/mass) * Vnow) – ((KConstant/mass) * Xnow)
vODE = vprime
xODE = Vnow
vectorX = deltaT * xODE
vectorV = deltaT * vODE
XNew = Xnow + vectorX
VNew = Vnow + vectorV
Xone = XNew
Vone = VNew
vprime = gravity – ((friction/mass) * VNew) – ((KConstant/mass) * XNew)
vODE2 = vprime
xODE2 = VNew
vectorX = (deltaT * .5) * (xODE + xODE2)
vectorV = (deltaT * .5) * (vODE + vODE2)
XNew = Xnow + vectorX
VNew = Vnow + vectorV
Xnow = XNew
Vnow = VNew
###print(“X at ” + str(i) + ” is ” + str(XNew) + “\t\t\t” + “V at ” + str(i) + ” is ” + str(VNew))
print(str(XNew) + “\t\t\t” + str(VNew))
i += deltaT
Been working much overtime at the moment, but here’s what I’ll be posting on as the year goes by…
I’ve always had an eclectic range of interests. I’m trained and have worked as a mechanical engineer, but also have an MBA and read widely in many fields. Lately, I’ve been consulting with the Matthew Ridgway Center for International Security Studies on tracking nuclear weapons smuggling.
So, some things I’ve been into in the past year:
1.) Mathematics. I’ve gone deeper into algebra, geometry and calculus. I’ve touched on abstract algebra and topology. I’ve even done some reading in chaos theory.
2.) Complexity theory – this applies across a wide range of disciplines such as social networks and physics. It may be applicable to terrorist networks.
3.) The future of work – outsourcing, of course, but also globalization, economics, and telecommuting.
4.) the future, period. Bob Kaplan’s gated communities, Richard Florida’s creative class and Great Reset.
5.) Economics and the stock market – are we really in a recovery or just still sliding into Great Depression 2?
6.) Terrorists and nuclear smuggling – as part of my gig at Pitt.
7.) How do many of the above subjects tie into the future of Pittsburgh (which is where I live)? How does the concept of city states apply, and is it a viable model for the future for the region?
These are all subjects I hope to keep exploring, and I hope to write more about them here on my blog.