Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Trig Functions
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
blaster009




PostPosted: Sun Oct 30, 2005 2:57 pm   Post subject: Trig Functions

I can't seem to figure out how to use negative sin in Turing. I need to find the angle of a certain area of pixels, and that requires me to turn the sin equation from [sin angle = opp/hyp] into [angle = sin^-1 (opp/hyp)]. Turing does not seem to have a built-in sin^-1 feature though. Any idea how to get around this (mathematically perhaps)?
Sponsor
Sponsor
Sponsor
sponsor
beard0




PostPosted: Sun Oct 30, 2005 4:02 pm   Post subject: (No subject)

sin^-1 is actually only a shorthand for the real name of the function: arcsin, which works in Turing.
blaster009




PostPosted: Mon Oct 31, 2005 11:15 pm   Post subject: (No subject)

Haha...Yeah, I smacked myself when I found that out today. I was proving Cosine law, and I was like...Arcsin...Oh, my, God.
md




PostPosted: Tue Nov 01, 2005 1:35 am   Post subject: (No subject)

beard0 wrote:
sin^-1 is actually only a shorthand for the real name of the function: arcsin, which works in Turing.


In fact arcsin is the language equivalent to sin^-1, which is just a written notation for the inverse sin function. Mathematical symbols unfortunately generally don't transefer well to computers, so we have to use other names to define things. Yeah it doesn't really help to answer the question, but it's small things like wording that end up throwing people off.
beard0




PostPosted: Tue Nov 01, 2005 9:56 am   Post subject: (No subject)

Cornflake wrote:
beard0 wrote:
sin^-1 is actually only a shorthand for the real name of the function: arcsin, which works in Turing.


In fact arcsin is the language equivalent to sin^-1, which is just a written notation for the inverse sin function. Mathematical symbols unfortunately generally don't transefer well to computers, so we have to use other names to define things. Yeah it doesn't really help to answer the question, but it's small things like wording that end up throwing people off.


No, arcsine is the real function. sin^-1(x) is simply a shorthand - and a bad and confusing one at that. Does it mean the inverse function of sin(x)? Or maybe is it like sin^2(x)=(sin(x))^2, and it is supposed to be (sin(x))^-1, or 1/(sin(x)). sin^-1 has been defined to be equivalent to arcsine, not the other way around. A subtle but important point.
codemage




PostPosted: Tue Nov 01, 2005 12:59 pm   Post subject: (No subject)

arcsin is the same as the function most calculators show (in shorhand) as sin^-1.
evildaddy911




PostPosted: Wed Dec 21, 2011 10:20 am   Post subject: RE:Trig Functions

so would tan^-1() be arctan()?
chipanpriest




PostPosted: Wed Dec 21, 2011 12:28 pm   Post subject: Re: RE:Trig Functions

evildaddy911 @ Wed Dec 21, 2011 10:20 am wrote:
so would tan^-1() be arctan()?

yes Razz
Sponsor
Sponsor
Sponsor
sponsor
Alex C.




PostPosted: Wed Jan 11, 2012 9:52 pm   Post subject: RE:Trig Functions

um, i'm not entirely sure but can you use trigonometry to create bullet paths? :/
Dreadnought




PostPosted: Thu Jan 12, 2012 4:08 pm   Post subject: Re: Trig Functions

Alex C. wrote:

um, i'm not entirely sure but can you use trigonometry to create bullet paths? /

Depending on how you want this bullet path to be created, sure. If there's some sort of angle at which you want this path it's likely that trig will be involved.
Raknarg




PostPosted: Thu Jan 12, 2012 8:46 pm   Post subject: RE:Trig Functions

If you have the angle of the bullet, then this would give you the velocities of the x and y coordinates:

Turing:

var bulletAngle : int := 0 %this is the angle you'd use
var vbx, vby : real %velocities of bullet
var speed : real := 5 %the distance you want the bullet to travel each iteration

vbx := speed * cosd (bulletAngle)
vby := speed * sind (bulletAngle)


There are more ways to do it, but thats how I do it.

NOTE: If you use degrees, put d at the end of the function (such as sind, arctand). Otherwise, you're calculating things in radians
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 11 Posts ]
Jump to:   


Style:  
Search: