Overlord Drakow
Banned
- 3,655
- Posts
- 16
- Years
- Down Under
- Seen Nov 6, 2019
I don't know computing languages, but I know coding for mathematical software if that counts? One is called LaTeX and it's basically used to write up mathematics (it's much better than Microsoft Word for documents which has lots of maths involved). I'll spoiler an example of the coding for it.
The other one I know is for an engineering software called MATLAB.
Spoiler:
\subsubsection{Third Law: The square of the orbital period of a planet is directly proportional to the cube of the semi-major axis of its orbit.}
The special case of a circular orbit shall be considered first. Then the more generalized elliptical orbit case will be tackled.
\subsubsection{Circular orbit case}
Start off with equation 5 from the polar coordinate example in the previous section.
\[
v = \sqrt{\frac{K}{r}} \Rightarrow v^2 \propto \frac{1}{r} \Leftrightarrow r \propto \frac{1}{v^2}
\]
Consider the period of the orbit;
\[
T=\frac{2\pi r}{v}
\]
Squaring both sides and then substituting $r \propto \frac{1}{v^2}$ gives;
\[
\frac{r^2}{v^2} \propto T^2 \Leftrightarrow r^3 \propto T^2
\]
The special case of a circular orbit shall be considered first. Then the more generalized elliptical orbit case will be tackled.
\subsubsection{Circular orbit case}
Start off with equation 5 from the polar coordinate example in the previous section.
\[
v = \sqrt{\frac{K}{r}} \Rightarrow v^2 \propto \frac{1}{r} \Leftrightarrow r \propto \frac{1}{v^2}
\]
Consider the period of the orbit;
\[
T=\frac{2\pi r}{v}
\]
Squaring both sides and then substituting $r \propto \frac{1}{v^2}$ gives;
\[
\frac{r^2}{v^2} \propto T^2 \Leftrightarrow r^3 \propto T^2
\]
The other one I know is for an engineering software called MATLAB.
Spoiler:
%This calculates the potential of a galactic disk and gives the velocity as
%a vector.
R=1;
for n=1:100;
r=n/100;
P=@(x) ((r*cos(x).^2 - cos(x).*(R^2 + r^2*cos(x).^2 - r^2).^(1/2)).^2 + (sin(x).*(R^2 + r^2*cos(x).^2 - r^2).^(1/2) - r*cos(x).*sin(x)).^2).^(1/2);
V=2*quad(P,0,pi);
%This is a numerical integration method known as quadrature.
end
r=0.01:0.01:1;
plot(r,V)
xlabel('r')
ylabel('Gravitational Potential')
title('Plot of Potential against distance from point P to centre')
F=V(1:99)-V(2:100);
%This calculates the centripetal force by taking the gradient of the
%potential
r=0.01:0.01:0.99;
v=(F.*r).^(1/2);
%This gives the velocity as a vector.
%a vector.
R=1;
for n=1:100;
r=n/100;
P=@(x) ((r*cos(x).^2 - cos(x).*(R^2 + r^2*cos(x).^2 - r^2).^(1/2)).^2 + (sin(x).*(R^2 + r^2*cos(x).^2 - r^2).^(1/2) - r*cos(x).*sin(x)).^2).^(1/2);
V=2*quad(P,0,pi);
%This is a numerical integration method known as quadrature.
end
r=0.01:0.01:1;
plot(r,V)
xlabel('r')
ylabel('Gravitational Potential')
title('Plot of Potential against distance from point P to centre')
F=V(1:99)-V(2:100);
%This calculates the centripetal force by taking the gradient of the
%potential
r=0.01:0.01:0.99;
v=(F.*r).^(1/2);
%This gives the velocity as a vector.