TI-BASIC:Arccos

From Learn @ Cemetech
Revision as of 18:34, 24 February 2016 by Maintenance script (talk | contribs) (Initial automated import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

COSINVERSE.GIF

Command Summary

Returns the inverse cosine (also called arccosine)

Command Syntax

cosֿ¹(number)

Menu Location

Press:

  1. [2nd]
  2. [cosֿ¹]

Calculator Compatibility

TI-83/84/+/SE

Token Size

1 byte

cosֿ¹( returns the arccosine of its argument. It is the inverse of Cos(, which means that cosֿ¹(n) produces an angle θ such that cos(θ)=n.

Like cos(, the result of cosֿ¹( depends on whether the calculator is in Radian or Degree mode. However, unlike cosine, the result is in degrees or radians, not the argument. A full rotation around a circle is 2π radians, which is equal to 360°. The conversion of θ=cosֿ¹(n) from radians to degrees is θ*180/π and from degrees to radians is θ*π/180. The cosֿ¹( command also works on a list.

The cosֿ¹( function can be defined for all real and complex numbers, but assumes real values only in the closed interval [-1,1]. Because Z80 calculators have their trigonometric functions and inverses restricted only to real values, the calculator will throw ERR:DOMAIN if the argument is outside of this interval, no matter what the mode setting may be.

In radians:

:cosֿ¹(-1)
    3.141592654

In degrees:

:cosֿ¹(-1)
    180

Advanced Uses

Since the function cosine itself doesn't have the restrictions that arccosine does, and since arccosine is the inverse of cosine, you can use cosֿ¹(cos( to keep a variable within a certain range (most useful for the home screen). Here is an example for a game like Pong. The ball travels between 0 and 12.

You could use a flag like this:

:If X=12 or not(X 	\\ X is the position
:-D→D		\\ D is the direction
:X+D→X		\\ new position
:Output(8,X,"=


An easier way to do this, without needing a flag or even an If statement, is using cosֿ¹(cos(

:X+1→X		\\ Note: the calculator is in Degree mode
:Output(8,cosֿ¹(cos(15X))/15,"=")	\\ I used 15 because cosֿ¹ ranges from [0,180]
										and X from [0,12],  so 180/12=15


Error Conditions

  • ERR:DOMAIN is thrown if you supplied an argument outside the interval [-1,1]
  • ERR:DATA TYPE is thrown if you input a complex value or a matrix.

Related Commands