1. Tan,Cos and Sin

Hi
How do I get Tan,Cos or Sin to the power of -1 in Euphoria? I mean that I
give the function a ratio and it gives me the angle. Arctan seems to give
tan to the -1 but how do I get the others?
Thanks :)
--PatRat (Thomas Parslow)
--               ()___()
--                (o o)
--                =\O/=
--             Rat Software
-- http://www3.mistral.co.uk/billparsl/

new topic     » topic index » view message » categorize

2. Re: Tan,Cos and Sin

>Hi
>How do I get Tan,Cos or Sin to the power of -1 in Euphoria? I mean that
I
>give the function a ratio and it gives me the angle. Arctan seems to
give
>tan to the -1 but how do I get the others?
>Thanks :)
>--PatRat (Thomas Parslow)

Isn't the inverse of a trig function just the function of the inverse of
the ratio
ex:  sin (1/3)
     sin^-1 (3/1)
Or is my math too rusty to be talking about it.

Lewis Towsend

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Tan,Cos and Sin

Lewis Townsend wrote:
>Isn't the inverse of a trig function just the
>function of the inverse of the ratio
> ex:  sin (1/3)
>      sin^-1 (3/1)
ummmm no.
sin(1/3)   = 0.0058
arcsin(3)  = *error*
sin(3)     = 0.0523
arcsin(1/3)= 19.471
however, arcsin, and arccos can be calculated with use
of the other functions we have available.


function arcsin(object x)
--returns the arccos expressed in *radians*
--here we know opp and hyp, and we need opp/adj
--we can assume hyp is 1, since we are given opp/hyp
--expressed as a ratio "over 1"
--object opp --we know this already, here for clarity
  object adj
   --opp=x                 --for clarity
   --adj=sqrt(1-opp*opp)   --for clarity
     adj=sqrt(1-x*x)
   --return arctan(opp/adj)--for clarity
     return arctan(x/adj)
end function

function arccos(object x)
--returns the arccos expressed in *radians*
--here we know adj and hyp and we need opp/adj,
--we can assume hyp is 1, since we are given opp/hyp
--expressed as a ratio "over 1"
  object opp
--object adj --we know this already, here for clarity
   --adj=x                 --for clarity
   --opp=sqrt(1-adj*adj)   --for clarity
     opp=sqrt(1-x*x)
   --return arctan(opp/adj)--for clarity
     return arctan(opp/x)
end function

you can test the above functions if you like :)
--Hawke'

new topic     » goto parent     » topic index » view message » categorize

4. Re: Tan,Cos and Sin

>>Hi
>>How do I get Tan,Cos or Sin to the power of -1 in Euphoria? I mean

>Isn't the inverse of a trig function just the function of the inverse
of
>the ratio
>ex:  sin (1/3)
>     sin^-1 (3/1)

Nonono!  The inverse of a trig function is actually another function:

tan^-1=arctan
sin^-1=arcsin
etc
When you write arctan(x), what you are really looking for is the angle
which has x as its tan.

The confusion here probably comes from looking at the inverse of a
number versus the inverse of a funcion:
Number: (1/3)^-1=(3/1)
Function: y=f(x), x=f^-1(y)

It's just important to remember that you're looking at trig *functions*,
whose inverses happen to be other trig functions.

Hope that clears up the difference. :)

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: Tan,Cos and Sin

Patrat said:

> How do I get Tan,Cos or Sin to the power of -1 in Euphoria? I mean that I
> give the function a ratio and it gives me the angle. Arctan seems to give
> tan to the -1 but how do I get the others?
> Thanks :)
> --PatRat (Thomas Parslow)

If you look on the official Euphoria Web page:

--Recent User Contributions--
   "Math Routines"

--Euphoria Archive--
   Mathematics Routines
      "Inverse Math Functions"

   Library Routines
      "Arcsin & Arccos"


Hope they help.
Larry

new topic     » goto parent     » topic index » view message » categorize

6. Re: Tan,Cos and Sin

On Wed, 7 Oct 1998, PatRat wrote:

> How do I get Tan,Cos or Sin to the power of -1 in Euphoria? I mean that I
> give the function a ratio and it gives me the angle. Arctan seems to give
> tan to the -1 but how do I get the others?

Like others have said, tan^-1(x) = arctan(x) [not 1/tan(x)].

There's my mathbag.e in PROJECTS.ZIP on my Euphoria Page. I'll put the
link up later today if I remember :)

Lee Woo Seob and I argued quite a bit about mathbag last year. Is Lee
still around? (I think he last posted in March)

--
Carl R White -- Final Year Computer Science at the University of Bradford
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
URL......: http://www.bigfoot.com/~cyrek/
Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr -- B.Q.Vgesa

new topic     » goto parent     » topic index » view message » categorize

7. Re: Tan,Cos and Sin

>How do I get Tan,Cos or Sin to the power of -1 in Euphoria? I mean that I
>give the function a ratio and it gives me the angle. Arctan seems to give
>tan to the -1 but how do I get the others?

Use of terminology in maths can be confusing, as in this case *Sin to the
power of -1*

The same set of symbols mean different ( but in some sense related ) things
depending on context.

For example
If y is a number:-
y^-1 = the reciprocal of y (the inverse of y)=1/y
if y is a function:-
y^-1 is the inverse FUNCTION of y e.g. the inverse function of x^2 is sqrt(x)
and the inverse FUNCTIONof sin is arcsin
if Y is a matrix:-
Y^-1 is the matrix inverse i.e ( Y^-1 )*( Y ) = I ( the unit matrix )

The symbols ^-1 mean different things in each case but they are similar as:-
for a number (y^-1)(y) = 1 ( the number one )
for a function ( y^-1( y(x) )  = x e.g. sqrt( (x*x) ) = x and arcsin( sin(x) )
= x
for a matrix ( Y^-1 )*( Y ) = I ( the unit matrix )

Hope this is helpful.

Also I agree with John Worthington's comments on *Issue of the week*

>no, No, NO!  ;')  Remember, you have these people like me who really
>enjoy reading these things and learn something.  I just don't have much
>to add in here.  But PLEASE don't drop threads like this.  What seems
>amazing to me is that I am learning, not just Euphoria coding, but about
>programming in general.  Anyways, nothing else to say at the moment, so
>keep up the good work.  ;')

Neil

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu