Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
0Activity
×
0 of .
Results for:
No results containing your search query
P. 1
Appendix A Java Code Pi-Space Theory

Appendix A Java Code Pi-Space Theory

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

More info:

categoriesTypes, Research, Science
Published by: martin_brady_1 on Sep 23, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
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 =
convertDegreesToRadians
(angle);
double
d = Math.
sqrt
(Math.
 pow 
(a,2) + Math.
 pow 
((b),2) -2*a*b*Math.
cos
(rangle));System.
out
.println("lawOfCosines (a/b/angle/radians/cos)"+a+"/"+b+"/"+angle+"/"+rangle+"/"+Math.
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 =
convertDegreesToRadians
(aAngle);System.
out
.println("lawOfSinesAngle(a/aAngle/b/radians/sin/angle)"+a+"/"+aAngle+"/"+b+"/"+rangle+"/"+Math.
sin
(rangle)+"/"+convertRadiansToDegrees(Math.
asin
((Math.
sin
(rangle)/a)*b)));
return
convertRadiansToDegrees(Math.
asin
((Math.
sin
(rangle)/a)*b)) ;}
 public static double
convertDegreesToRadians (
double
degrees){
double
radians = (Math.
PI
/ 180) * degrees;
return
(radians);}
 public double
convertRadiansToDegrees(
double
radians){
double
degrees = (180 / Math.
PI
) * radians;
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
radius = (Double) vals.get("radius");
 
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;}/***

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->