Showing posts with label coding. Show all posts
Showing posts with label coding. Show all posts

Wednesday, December 23, 2020

MathJax Test

I've been struggling to include Mathjax in Blogger properly to write proper mathematical equations. A lot of people saying "paste this here", but this is the only one that worked:

http://holdenweb.blogspot.com/2011/11/blogging-mathematics.html

So here's a little test:

$x^2$

The Fourier Transform is given as:

$F(k) = \int^{\infty}_{-\infty} f(t) e^{-2 \pi k t} dt$

 ...and I happy.

For Blogger, you need to open the Theme, then Cutomize->Edit HTML 

Then copy and paste the code kindly provided in the link above, which I have copied below. Use Ctrl-F to find < /head >. You need to paste it before the < /head >

Kosh: Who Are You?

 I am a... well, mainly a physicist. 

What does a physicist do? That's the question isn't it? What do we do? 

I am, mainly, a physicist. I can code.

I like to model and simulate physical systems. Oscillating springs, solar system animations. I use Vpython for that. In this example, I simulated a problem in Orbital Mechanics. Suppose you want to travel from one planet to another? Your flight will not be in a straight line because of the Sun's gravitational pull. It will follow an elliptical path, which in this case is called the Hohmann Transfer.

https://www.glowscript.org/#/user/zorniy/folder/Public/program/newhohmann

 

 

 

 

 

 

I also am interested in machine learning. How a computer can tell the difference between several images, for example. Below, I show some things I did for fun. The first is a brute-force hand-coded Nearest Neighbor Classifier. Slow, but I'm proud of it. I know there's a library in Python that can implement Nearest Neighbour faster, but let me have my moment. Imagine how proud the caveman was who invented the wheel!


KNN is a form of unsupervised learning used for clustering elements (in this case, clustering pixels of similar colour). The pixels are assigned to the "centroids" closest to them. Then the average of the pixels associated with a centroid is calculated and used to update the centroid, so the centroid shifts a bit, and the process is repeated for several iterations or until the cetroids more or less stop moving.

Support Vector Machine (SVM) is a supervised classifier method, where a "machine" is taught to associate training data, which are subsets of a main data set, with certain targets. This trained machine can then be used to classify the main data set. 

Imagine you have two flocks of sheep, black and white. You want to build a fence that is an optimal straight line between them. So you pick out some black and some white sheep and use their positions to determine the best fence position and orientation. When you build the fence, hopefully it will separate the two flocks completely! 

What if you have three flocks, A, B and C? Then you need to determine the fences of A vs (B,C), B vs (A,C), and C vs (A,B).

SVM using Python scikit-learn or sklearn This is a program to illustrate how Python can be used for machine learning. sklearn is a Python library which can implement machine learning. There are others such as the more famous tensorflow and keras and PyTorch. I found Jupyter Notebook and Jupyter Lab to "excellente" for this kind of project.



I have also performed wavelet analysis of signals, optimizing the wavelet denoising parameters using the signal's noise statistics. A lot of computer-heavy stuff.

So... am I a programmer, or "merely" a physicist who can code? Am I human, or am I dancer?


Bab 2