Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > Math help!!!
Pages (3): « 1 [2] 3 »   Last Thread   Next Thread
Share
Author
Thread    Post A Reply
Joss Weatherby
Banned



Registered: May 2008
Location: The Pacific Northwest, of course

all this -5 stuff is great but where do i start making them negatives, this is an arbitrary list of values, not something i have defined.

Winston I tried that but I keep getting fucked up values, should they be radians when getting there sine and cosine values?

Old Post Sep-29-2009 16:34 
Click Here to See the Profile for Joss Weatherby Click here to Send Joss Weatherby a Private Message Visit Joss Weatherby's homepage! Add Joss Weatherby to your buddy list Report this Post Reply w/Quote Edit/Delete Message
TranceOwnsLol
Hi mom!!!



Registered: Nov 2007
Location: Singapore

use constructors? this is in java.

public class AvgAngles{

int a;
int b;
int....etc;

public AvgAngles (int x, int y....etc)
{
a=x;
b=y;
)

void run()
{
System.out.println(a+b+..../5)
}

public static void main (String[] args)
{
AvgAngles calc=new AvgAngles(first value, second value) //these parameters are to be passed to the constructor
calc.run();
}
}

you can change all the ints to float or double if you want

Old Post Sep-29-2009 16:42  Philippines
Click Here to See the Profile for TranceOwnsLol Click here to Send TranceOwnsLol a Private Message Add TranceOwnsLol to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Joss Weatherby
Banned



Registered: May 2008
Location: The Pacific Northwest, of course

quote:
Originally posted by TranceOwnsLol
use constructors? this is in java.

public class AvgAngles{

int a;
int b;
int....etc;

public AvgAngles (int x, int y....etc)
{
a=x;
b=y;
)

void run()
{
System.out.println(a+b+..../5)
}

public static void main (String[] args)
{
AvgAngles calc=new AvgAngles(first value, second value) //these parameters are to be passed to the constructor
calc.run();
}
}

you can change all the ints to float or double if you want


Thanks, but I am not having trouble with how to do it programmatically, just that I am getting what looks like incorrect numbers when I do it.

Also, just to help you a bit, you could simplify that easy with arrays.

Old Post Sep-29-2009 16:57 
Click Here to See the Profile for Joss Weatherby Click here to Send Joss Weatherby a Private Message Visit Joss Weatherby's homepage! Add Joss Weatherby to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Omega_M
Nostalgia



Registered: Jun 2005
Location: Ether

quote:
Originally posted by Joss Weatherby
I need to get the average of a set of angles...


angles = [355, 358, 0, 5, 351];

So I basically convert those numbers into radians.

Then I go through the radians and I convert them to their sine and cosine values and add those up.

I then get the average (totalSine/5) and (totalCosine/5)...

I then use atan2 to convert the averages back into an angle...

It doesn't work. I have mixed and matched values all over the place...

I get weird ass fucking numbers, like I give it two or three of the same number and I get back like 6.124125 or some really odd number.

I looked at this post: http://www.bio.net/bionet/mm/molmod...ary/000853.html

and...

this one I started off with and got those numbers to test: http://positivelyglorious.com/softw...es-of-azimuths/

Any ideas?


You should not average the sine and cosine values. Just sum all sines, sum all cosines. Calculate sum(sine)/sum(cos) and then take inverse tan of the number. Convert it back to degrees, and you will get about -2.2. Don't ignore zero. Cosine(0) = 1 !

quote:
Originally posted by Joss Weatherby
all this -5 stuff is great but where do i start making them negatives, this is an arbitrary list of values, not something i have defined.

Winston I tried that but I keep getting fucked up values, should they be radians when getting there sine and cosine values?


Because the list is arbitrary, you need to use the sine and cosine method. That takes care of the arbitrariness. And yes, they should all be in radians. By using sines and cosines you are using vectors to solve the problem.

So you represent 355 (in rad) as i*cos(355*pi/180) + j*sin(355*pi/180), where i and j are unit vectors along 2 perpendicular lines X and Y, forming a plane, where you are measuring the angles from the X axis in the counter clockwise direction. You represent all numbers in this way. Then you add up all cosines, you add up all the sines, and you end up with a vector, i*A + j*B, where A, B are the sums of the cosine and sine terms. The angle of this vector is ATAN(B/A). Multiply by 180/pi and convert it back to degrees. This is your average angle.


___________________

Download and review ! Omega_M - In the Mix (Beta Version)

Originally posted by twilightki : It feels like something you'd listen to at 4 in the morning, or listen to in your car while you're going in a tunnel.

Old Post Sep-29-2009 18:57  India
Click Here to See the Profile for Omega_M Click here to Send Omega_M a Private Message Add Omega_M to your buddy list Report this Post Reply w/Quote Edit/Delete Message
winston
ultraviolet catastrophe



Registered: Nov 2005
Location: Yggdrasill

galileo galilei

Old Post Sep-29-2009 19:10 
Click Here to See the Profile for winston Click here to Send winston a Private Message Add winston to your buddy list Report this Post Reply w/Quote Edit/Delete Message
tachobg
Junior tranceaddict



Registered: Jan 2006
Location: Cambridge, MA / NYC

Are you sure you're converting the output angle back to degrees?
Check that -- if that's not what's up, then post code.

Old Post Sep-29-2009 21:26  Bulgaria
Click Here to See the Profile for tachobg Click here to Send tachobg a Private Message Add tachobg to your buddy list Report this Post Reply w/Quote Edit/Delete Message
bananas
baby i got your money



Registered: Oct 2004
Location: Mordor

wolframalpha?

Old Post Sep-29-2009 22:16 
Click Here to See the Profile for bananas Click here to Send bananas a Private Message Visit bananas's homepage! Add bananas to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Joss Weatherby
Banned



Registered: May 2008
Location: The Pacific Northwest, of course

Hey guys thanks for the help so far, I havent had a chance to test it yet, I have to write some stupid manual shit, but I plan to look at it ASAP.

Old Post Sep-29-2009 23:55 
Click Here to See the Profile for Joss Weatherby Click here to Send Joss Weatherby a Private Message Visit Joss Weatherby's homepage! Add Joss Weatherby to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Dervish
Your opinion matters.



Registered: Dec 2003
Location:

Just use complex numbers surely? Been aggggeees since I've done this pish though.


___________________
If you can read this, I'm seriously fucking bored.

Old Post Sep-29-2009 23:57 
Click Here to See the Profile for Dervish Click here to Send Dervish a Private Message Add Dervish to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Reza
Supreme tranceaddict



Registered: Jan 2005
Location: Richmond Hill

dude who would come to the c0r for a math advice...

Old Post Sep-30-2009 00:02  Canada
Click Here to See the Profile for Reza Click here to Send Reza a Private Message Add Reza to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Dervish
Your opinion matters.



Registered: Dec 2003
Location:

>Xplians<

Think if you have them in as engineers would call j notation (as above) you can pretty much just add them. Well like real + real, imaginary + imaginary.


___________________
If you can read this, I'm seriously fucking bored.

Old Post Sep-30-2009 00:08 
Click Here to See the Profile for Dervish Click here to Send Dervish a Private Message Add Dervish to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Zild
Ten City



Registered: Jun 2004
Location: San Antonio, US : TXTA #156

I would help you but I don't feel like it.


___________________
I've never been able to eat a whole baby.
Kill the women. Eat the children.
It's just one of those days where you want to bend over everyone you know and kiss their ass goodbye with a big sideways boot.

Latest Mix

Old Post Sep-30-2009 00:39  United States
Click Here to See the Profile for Zild Click here to Send Zild a Private Message Add Zild to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > Math help!!!
Post New Thread    Post A Reply

Pages (3): « 1 [2] 3 »  
Last Thread   Next Thread
Click here to listen to the sample!Pause playbackPopular electronic song from ~2000, should be easy [2011] [2]

Click here to listen to the sample!Pause playbackYoji Biomehanika - "Seduction" [2002]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 06:17.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2025, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!