
-----------------------------------
blaster009
Sun Oct 30, 2005 2:57 pm

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)?

-----------------------------------
beard0
Sun Oct 30, 2005 4:02 pm


-----------------------------------
sin^-1 is actually only a shorthand for the real name of the function: arcsin, which works in Turing.

-----------------------------------
blaster009
Mon Oct 31, 2005 11:15 pm


-----------------------------------
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
Tue Nov 01, 2005 1:35 am


-----------------------------------
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
Tue Nov 01, 2005 9:56 am


-----------------------------------
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
Tue Nov 01, 2005 12:59 pm


-----------------------------------
arcsin is the same as the function most calculators show (in shorhand) as sin^-1.

-----------------------------------
evildaddy911
Wed Dec 21, 2011 10:20 am

RE:Trig Functions
-----------------------------------
so would tan^-1() be arctan()?

-----------------------------------
chipanpriest
Wed Dec 21, 2011 12:28 pm

Re: RE:Trig Functions
-----------------------------------
so would tan^-1() be arctan()?
yes :P

-----------------------------------
Alex C.
Wed Jan 11, 2012 9:52 pm

RE:Trig Functions
-----------------------------------
um, i'm not entirely sure but can you use trigonometry to create bullet paths? :/

-----------------------------------
Dreadnought
Thu Jan 12, 2012 4:08 pm

Re: Trig Functions
-----------------------------------

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
Thu Jan 12, 2012 8:46 pm

RE:Trig Functions
-----------------------------------
If you have the angle of the bullet, then this would give you the velocities of the x and y coordinates:


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
