Be Excellent To Each Other

And, you know, party on. Dude.

All times are UTC [ DST ]




Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Maths question
PostPosted: Wed Sep 29, 2010 14:19 
User avatar
Excellent Member

Joined: 30th Mar, 2008
Posts: 5924
Location: Stockport - The Jewel in the Ring
OK, I have to write some code that does some calculations. Basic trig.

Formula I have been given is (Vu) = u x sinA

Where u is the launch velocity and A is the launch angle.

The example I have been given is u=200, A=30, so

Vu = 200 x sin30 = 100

When I do 200 * Math.sin(30) in Java, it gives me -0.988. When I do the same in Excel (=SIN(30)) I get same value.

Same for the next formula (Hu) + u x cosA Example given:

Hu = 200 x cos(30) = 173.2

Except 200 * Math.cos(30) = 30.85 (And same again in Excel.)

Am I missing something here? Does sinA mean something other that Sine of A? Does cosA mean something other than Cosine of A?

_________________
Mint To Be Stationery - Looking for a Secret Santa gift? Try our online shops at Mint To Be.

Book me in the Face | Tweet me. Tweet me like a British nanny.


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:22 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
cos(30) is 0.867 so
Quote:
Except 200 * Math.cos(30) = 30.85 (And same again in Excel.)
makes no sense at all.

Ah -- cos(30) in radians is 0.154. That's your problem. Inconsistent units.


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:24 
User avatar
What's this bit for exactly?

Joined: 6th Dec, 2008
Posts: 880
Location: Caerdydd
30 is in degrees.
sin/cos in programming stuff takes radians, so you need to do..

sin( angle * (3.151592 / 180) )
(thats PI / 180 as PI radians = 180 degrees)

:)


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:26 
User avatar

Joined: 27th Mar, 2008
Posts: 25885
I concur.


:shrug: :?:

_________________
Image


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:26 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49237
WTF. Why radians? Who in the world ever uses radians?

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:27 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69689
Location: Your Mum
Radiologists, DURR

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:27 
User avatar
Excellent Member

Joined: 30th Mar, 2008
Posts: 5924
Location: Stockport - The Jewel in the Ring
Ah.... hold a sec.

Math.cos(30) isn't the Cosine of 30 degrees is it? 30 must be something else.

*Googles*

Radians! I've got to convert degrees to radians...


Edit: You lot beat me to it...

_________________
Mint To Be Stationery - Looking for a Secret Santa gift? Try our online shops at Mint To Be.

Book me in the Face | Tweet me. Tweet me like a British nanny.


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:30 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Craster wrote:
Who in the world ever uses radians?
Serious people doing srs bsns.


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:31 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
The Police in Norn Irn?


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:32 
User avatar
Excellent Member

Joined: 30th Mar, 2008
Posts: 5924
Location: Stockport - The Jewel in the Ring
Cheers all, award yourself some bananas.

_________________
Mint To Be Stationery - Looking for a Secret Santa gift? Try our online shops at Mint To Be.

Book me in the Face | Tweet me. Tweet me like a British nanny.


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:33 
User avatar

Joined: 27th Mar, 2008
Posts: 25885
Thanks. Glad I helped.

_________________
Image


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:42 
User avatar
Excellent Member

Joined: 30th Mar, 2008
Posts: 5924
Location: Stockport - The Jewel in the Ring
You helped. In that I didn't feel so alone.

_________________
Mint To Be Stationery - Looking for a Secret Santa gift? Try our online shops at Mint To Be.

Book me in the Face | Tweet me. Tweet me like a British nanny.


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 14:55 
User avatar
Sleepyhead

Joined: 30th Mar, 2008
Posts: 27347
Location: Kidbrooke
Doctor Glyndwr wrote:
Craster wrote:
Who in the world ever uses radians?
Serious people doing srs bsns.

:this:

Degree level stuff is full of the bastards. They're useful for trig-style algebra and whatnots.

_________________
We are young despite the years
We are concern
We are hope, despite the times


Top
 Profile  
 
 Post subject: Re: Maths question
PostPosted: Wed Sep 29, 2010 15:00 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
The trig style algebra was pretty much the only part of the maths stuff I could manage in my degree. I have absolutely no idea what you'd apply to to in the real world, but it was handy to be able to be able to answer a few of the exam questions correctly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Majestic-12 [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search within this thread:
You are using the 'Ted' forum. Bill doesn't really exist any more. Bogus!
Want to help out with the hosting / advertising costs? That's very nice of you.
Are you on a mobile phone? Try http://beex.co.uk/m/
RIP, Owen. RIP, MrC. RIP, Dimmers.

Powered by a very Grim... version of phpBB © 2000, 2002, 2005, 2007 phpBB Group.