Apps and platforms
Code::Blocks
Project description
Code
Code snippet #4
text
1 Days to beginning of month 2 3 Month Normal year Leap year 4 Jan 0 0 5 Feb 31 31 6 Mar 59 60 7 Apr 90 91 8 May 120 121 9 Jun 151 152 10 Jul 181 182 11 Aug 212 213 12 Sep 243 244 13 Oct 273 274 14 Nov 304 305 15 Dec 334 335 16 17 Days since J2000 to beginning of each year 18 19 Days 20 1999 -366.5 21 2000 -1.5 22 2001 364.5 23 2002 729.5 24 2003 1094.5 25 2004 1459.5 26 2005 1825.5 27Similarly, 28 2013 4747.5 29 2016 5842.5
Code snippet #21
text
1 Xq = X' 2 Yq = Y' * cos(ec) - Z' * sin(ec) 3 Zq = Y' * sin(ec) + Z' * cos(ec) 4 5 Xq are the equatorial coordinates 6 X' are the geocentric ecliptic coordinates 7 ec is the obliquity of the ecliptic 8
Code snippet #11
text
1v = M + 180/pi * [ (2 * e - e^3/4) * sin(M) + 5/4 * e^2 * sin(2*M) 2 + 13/12 * e^3 * sin(3*M)........ n terms ] 3 4 v is true anomaly 5 M is mean anomaly 6 e is eccentricity 7 pi is 3.14159... 8 9 e^3 means the third power of e. Note how the third 10 power is involved the first term as well as the last. 11 12 13A more expanded series can give a better result so this is what i have used 14in my code : 15 16 17 v = m + (2 * e - 0.25 *pow(e,3) + 5/96 * pow(e,5)) * sin(m) + 18 (1.25 * pow(e,2) - 11/24 * pow(e,4)) * sin(2*m) + 19(13/12 * pow(e,3) - 43/64 * pow(e,5)) * sin(3*m) + 20103/96 * pow(e,4) * sin(4*m) + 1097/960 * pow(e,5) * sin(5*m); 21 22 23
Code snippet #15
text
1 2 X = r * [cos(o) * cos(v + p - o) - sin(o) * sin(v + p - o) * 3 cos(i)] 4 Y = r * [sin(o) * cos(v + p - o) + cos(o) * sin(v + p - o) * 5 cos(i)] 6 Z = r * [sin(v + p - o) * sin(i)] 7 8 r is radius vector 9 v is true anomaly 10 o is longitude of ascending node 11 p is longitude of perihelion 12 i is inclination of plane of orbit 13 14 the quantity v + p - o is the angle of the planet measured 15 in the plane of the orbit from the ascending node 16
Code snippet #23
text
1 alpha = arctan(Yq/Xq) 2 3 If Xq is negative then add 180 degrees to alpha 4 If Xq is positive and Yq is negative then add 360 degrees to 5 alpha 6 7 alpha is usually expressed in hours, so divide by 15 8 9 delta = arctan( Zq / SQRT(Xq^2 + Yq^2)) 10 11 distance = SQRT( Xq^2 + Yq^2 + Zq^2) 12
Code snippet #12
text
1 M = 232.910644 degrees or 4.065057601 radians 2 e = 0.093346 3Therefore, 4 v = 224.9688989 degrees or 3.926448 radians 5 6Note: In my code I have done all the calculations in Radians
Code snippet #14
text
1a = 1.523762 2e = 0.093346 3v =224.9688989 4 5r = 1.523762 * (1 - 0.093346^2) / [ 1 + 0.093346 * cos (224.9688989) ] 6 = 1.617293 a.u
Code snippet #10
text
1 n = 0.523998 2 d = 928 3 L = 82.9625 4 p = 336.322 5 6 M = 0.523998 * 928 + 82.9625 - 336.322 7 = 232.910644 8
Code snippet #13
text
1 r = a * (1 - e^2) / [1 + e * cos(v)] 2 3 a is the semi-major axis 4 e is the eccentricity 5 v is the true anomaly 6 7 the radius vector r will be in the same units as a 8 a.u. in this case. 9
Code snippet #16
text
1 r = 1.617293 2 v = 224.9688989 3 o = 49.668 4 p = 336.322 5 i = 1.8496 6 v + p - o = 511.6228989 - 360 = 151.6228989 7 8 and I get the following rectangular coordinates; 9 10 X = -1.506606 11 Y = -0.587503 12 Z = 0.024809 13 14 SQRT(X^2 + Y^2 + Z^2) should be same as r 15
Code snippet #4
text
1 Days to beginning of month 2 3 Month Normal year Leap year 4 Jan 0 0 5 Feb 31 31 6 Mar 59 60 7 Apr 90 91 8 May 120 121 9 Jun 151 152 10 Jul 181 182 11 Aug 212 213 12 Sep 243 244 13 Oct 273 274 14 Nov 304 305 15 Dec 334 335 16 17 Days since J2000 to beginning of each year 18 19 Days 20 1999 -366.5 21 2000 -1.5 22 2001 364.5 23 2002 729.5 24 2003 1094.5 25 2004 1459.5 26 2005 1825.5 27Similarly, 28 2013 4747.5 29 2016 5842.5
Code snippet #9
text
1 M = n * d + L - p 2 3 n is daily motion 4 d is the number of days since the date of the elements 5 L is the mean longitude 6 p is the longitude of perihelion 7 8 M should be in range 0 to 360 degrees, add or subtract 9 multiples of 360 to bring M into this range. 10
Alitude-Azimuth Calculator
It is a cpp code that calculates Ra and Declination of all the nine planets with proper data and time as an input and with the Location input it give azimuth and altitude.
Code snippet #1
text
1JD = 2450680.5 2Equinox and mean ecliptic of J2000.0 3 4 Earth Mars 5 6i 0.0 1.8496 7o 0.0 49.668 8p 103.147 336.322 9a 1.0000 1.523762 10n 0.985611 0.523998 11e 0.016679 0.093346 12L 324.5489 82.9625 13 14The values for the other planets can be found in 15the C program below. 16
Code snippet #17
text
1 Xe = r * cos(v + p) 2 Ye = r * sin(v + p) 3 Ze = 0 4 5 r is radius vector of Earth 6 v is true anomaly for Earth 7 p is longitude of perihelion for Earth 8
Code snippet #2
text
1Elements 2 3i - inclination 4o - longitude of ascending node at date of elements 5p - longitude of perihelion at date of elements 6a - mean distance (au) 7n - daily motion 8e - eccentricity of orbit 9l - mean longitude at date of elements 10 11Calculated quantities 12 13M - mean anomaly (degrees) 14V - True anomaly (degrees) 15r - radius vector (au) referred to current coordinate origin 16X - recangular coordinate (au) 17Y - recangular coordinate (au) 18Z - recangular coordinate (au) 19alpha - right ascension (hours or decimal degrees according to 20context) 21delta - declination (decimal degrees) 22
Code snippet #24
text
1 (right ascension) alpha = 15.440000 hrs 2 3 (declination) delta = -18.250000 degs 4 5 distance = 1.077971278 a.u. 6
Code snippet #24
text
1 (right ascension) alpha = 15.440000 hrs 2 3 (declination) 4 delta = -18.250000 degs 5 6 distance = 1.077971278 a.u. 7
Code snippet #13
text
1 r = a * (1 - e^2) / [1 + e * cos(v)] 2 3 a is the 4 semi-major axis 5 e is the eccentricity 6 v is the true anomaly 7 8 9 the radius vector r will be in the same units as a 10 a.u. in 11 this case. 12
Code snippet #12
text
1 M = 232.910644 degrees or 4.065057601 radians 2 e = 0.093346 3Therefore, 4 v = 224.9688989 degrees or 3.926448 radians 5 6Note: In my code I have done all the calculations in Radians
Code snippet #14
text
1a = 1.523762 2e = 0.093346 3v =224.9688989 4 5r = 1.523762 * (1 - 0.093346^2) / [ 1 + 0.093346 * cos (224.9688989) ] 6 = 1.617293 a.u
Alitude-Azimuth Calculator
It is a cpp code that calculates Ra and Declination of all the nine planets with proper data and time as an input and with the Location input it give azimuth and altitude.
Code snippet #17
text
1 Xe = r * cos(v + p) 2 Ye = r * sin(v + p) 3 Ze = 0 4 5 r is radius vector of Earth 6 v is true anomaly for Earth 7 p is longitude of perihelion for Earth 8
Code snippet #1
text
1JD = 2450680.5 2Equinox and mean ecliptic of J2000.0 3 4 Earth Mars 5 6i 0.0 1.8496 7o 0.0 49.668 8p 103.147 336.322 9a 1.0000 1.523762 10n 0.985611 0.523998 11e 0.016679 0.093346 12L 324.5489 82.9625 13 14The values for the other planets can be found in 15the C program below. 16
Code snippet #21
text
1 Xq = X' 2 Yq = Y' * cos(ec) - Z' * sin(ec) 3 Zq = Y' * sin(ec) 4 + Z' * cos(ec) 5 6 Xq are the equatorial coordinates 7 X' are the geocentric 8 ecliptic coordinates 9 ec is the obliquity of the ecliptic 10
Code snippet #23
text
1 alpha = arctan(Yq/Xq) 2 3 If Xq is negative then add 180 4 degrees to alpha 5 If Xq is positive and Yq is negative then add 360 degrees 6 to 7 alpha 8 9 alpha is usually expressed in hours, so divide by 15 10 11 12 delta = arctan( Zq / SQRT(Xq^2 + Yq^2)) 13 14 distance = SQRT( Xq^2 + 15 Yq^2 + Zq^2) 16
Code snippet #15
text
1 2 X = r * [cos(o) * cos(v + p - o) - sin(o) * sin(v + p - o) * 3 cos(i)] 4 Y = r * [sin(o) * cos(v + p - o) + cos(o) * sin(v + p - o) * 5 cos(i)] 6 Z = r * [sin(v + p - o) * sin(i)] 7 8 r is radius vector 9 v is true anomaly 10 o is longitude of ascending node 11 p is longitude of perihelion 12 i is inclination of plane of orbit 13 14 the quantity v + p - o is the angle of the planet measured 15 in the plane of the orbit from the ascending node 16
Code snippet #9
text
1 M = n * d + L - p 2 3 n is daily motion 4 d 5 is the number of days since the date of the elements 6 L is the mean longitude 7 8 p is the longitude of perihelion 9 10 M should be in range 0 11 to 360 degrees, add or subtract 12 multiples of 360 to bring M into this 13 range. 14
Code snippet #16
text
1 r = 1.617293 2 v = 224.9688989 3 o = 49.668 4 p = 336.322 5 6 i = 1.8496 7 v + p - o = 511.6228989 - 360 = 151.6228989 8 9 and 10 I get the following rectangular coordinates; 11 12 X = -1.506606 13 Y 14 = -0.587503 15 Z = 0.024809 16 17 SQRT(X^2 + Y^2 + Z^2) should be same 18 as r 19
Code snippet #10
text
1 n = 0.523998 2 d = 928 3 L = 82.9625 4 p 5 = 336.322 6 7 M = 0.523998 * 928 + 82.9625 - 336.322 8 = 232.910644 9
Code snippet #2
text
1Elements 2 3i - inclination 4o - longitude of ascending node at 5 date of elements 6p - longitude of perihelion at date of elements 7a - mean 8 distance (au) 9n - daily motion 10e - eccentricity of orbit 11l - mean longitude 12 at date of elements 13 14Calculated quantities 15 16M - mean anomaly (degrees) 17V 18 - True anomaly (degrees) 19r - radius vector (au) referred to current coordinate 20 origin 21X - recangular coordinate (au) 22Y - recangular coordinate (au) 23Z 24 - recangular coordinate (au) 25alpha - right ascension (hours or decimal degrees 26 according to 27context) 28delta - declination (decimal degrees) 29
Comments
Only logged in users can leave comments