Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Standard view
Full view
of .
×
0 of .
Results for:
P. 1
Appendix A Java Code Pi-Space Theory

# Appendix A Java Code Pi-Space Theory

Ratings: (0)|Views: 28|Likes:
Java Code supporting Orbits And Also Code For The Advanced Formulas
Java Code supporting Orbits And Also Code For The Advanced Formulas

categoriesTypes, Research, Science

### Availability:

See More
See less

09/23/2012

pdf

text

original

Appendix A Java Code
Code for Trajectory Using Law of Sines and Law of Cosines and Pi Space Examples
package
com.physics.math;
import
java.util.HashMap;/***** Test program to demonstrate the Pi-Space Theory Trajectory.** Author : Martin Brady** 'ps' methods indicate Pi-Space****/
public class
PiSpaceTrajectory
extends
PiSpaceExamples {
public
PiSpaceTrajectory(
int
unit) {
super
(unit);}/*** return a distance**/
public double
lawOfCosines(
double
a,
double
b,
double
angle) {
double
rangle =
(angle);
double
d = Math.
sqrt
(Math.
pow
(a,2) + Math.
pow
((b),2) -2*a*b*Math.
cos
(rangle));System.
out
cos
(rangle)+" Value is "+d);
return
Math.
sqrt
(Math.
pow
(a,2) + Math.
pow
((b),2) -2*a*b*Math.
cos
(rangle));}/*** return an angle**/

public double
lawOfSinesAngle(
double
a,
double
aAngle,
double
b){
double
rangle =
(aAngle);System.
out
sin
asin
((Math.
sin
(rangle)/a)*b)));
return
asin
((Math.
sin
(rangle)/a)*b)) ;}
public static double
double
degrees){
double
PI
/ 180) * degrees;
return
public double
double
double
degrees = (180 / Math.
PI
return
(degrees);}/***
TODO
: return a length**/
public double
lawOfSinesLength(
double
a,
double
aAngle,
double
bAngle) {
return
0.0;//
TODO
}/*** Take the last position and apply it to the next one**/
public
HashMap calculateNextTrajectoryPosition(HashMap vals) {HashMap hm =
new
HashMap();
double
angleAxesOffset = (Double)vals.get("angleAxesOffset");
double
x1 = (Double) vals.get("x1");
double
y1 = (Double) vals.get("y1");
double
x1COG = (Double) vals.get("x1COG");
double
y1COG = (Double) vals.get("y1COG");
double

double
distanceFromCOGKilometers = (Double)vals.get("distanceFromCOG");
double
fieldAccelerationKMPerSecond = (Double)vals.get("fieldAcceleration");
double
velocityKiloMetresPerSecond = (Double)vals.get("velocity");
double
angleWRTGravity = (Double)vals.get("angleWRTGravity");
double
miliseconds = (Double) vals.get("miliseconds");hm = calculateNextTrajectoryPosition(angleAxesOffset,x1, y1, x1COG, y1COG,fieldAccelerationKMPerSecond,velocityKiloMetresPerSecond, angleWRTGravity,miliseconds,radius);
return
hm;}/*** get distance between points (x1,y1) (x2,y2)**/
public double
getDistance(
double
x1,
double
y1,
double
x2,
double
y2) {
double
xlen = x2 - x1;
double
ylen = y2 - y1;
return
Math.
sqrt
(Math.
pow
(xlen,2) + Math.
pow
(ylen,2));}/*** Calculate Gravity**/
public double
calcGravity(
double
mass1,
double
mass2,
double
distance) {
double
gravity = (ugc() * mass1 * mass2) /Math.
pow
(distance,2);System.
out
.println("(mass1/mass2/distance/gravity)"+mass1+"/"+mass2+"/"+distance+"/"+gravity);
return
gravity;}/***

## Activity (0)

### Showing

AllMost RecentReviewsAll NotesLikes