Cos Function

bjackson

Registered User.
Local time
, 02:03
Joined
Jan 3, 2003
Messages
404
I am trying to work out an angle in a triangle(non Right angle).Does anybody know how you multiply a number by Cos to the power of -1.Does access have any functions for mutliplying numbers to the power of x
thanks in advance
Bjackson
 
I believe it uses the same syntax as other computer languages:

45 ** 3
 
Thanks for the reply Pat
i get a syntax error using **
I had a look at excel and it has a Power() function,and it also shows that you can use 5^2, which when used in access does give the answer of 25.
However when a minus value its gives the wrong value ( well not the answer i was expecting anyway-maybe my formula is wrong)

the formula i am using is

given a=300
b=300
c=450


Cos(MyAngle)=(bxb)+(c*c)-(a*a) / (2*b*c)
MyAngle=Cos^-1 * (CosMyAngle)
MyAngle=180-(Myangle*2)


The answer should be 96.8 degrees as worked out on a scientific calculator,but when used in access you cant use the function call for cos on the lhs of the = sign

Hope this all makes sense,as my daughter is directing me, because i dont know trig.I left school before it was invented!!

Regards
Bjackson
 
Bjackson,

2 ^ -2 = 0.25

Which seems OK.

When using power:

Power(2, -2) = 0
Power(2.0, -2) = 0.125

Power takes the datatype of the first argument as the datatype.

Wayne
 
Thanks Wayne
So the power formula is right,but you cant use Power() in access,just excel

Any ideas on how i can get around using the cos function in access with out getting the compile error "Function call on left hand side of assignment must return variant or object".

Are there any maths genius's out there who know a formula i can use in access to work out the angle required ?

Regards
Bjackson
 
In ACCESS you have to conert angle to radians. One radian = 57.295827 degrees(approx). 180 degrees = pi radians.

If your angle = 45 degrees, convert that to radians.

angleinradians = 45/57.295827

result = cos(angleinradians)

You can use sin, tan functions like that.

Hope this is what you are looking for.
 
Thanks Jacob

I am not sure whether that helps,as i said my skills in maths are ordinary to say the least.I cant convert the angle to radians because i dont know the angle,thats the part i am trying to work out.I cant grasp how to apply the inverse part of the equation (I dont know what it even means).I can get to the -0.125 but thats it.This is the formula i got from a book,and when using a calculator it does give the right answer.

a,b,&c are 3 sides of a triangle with given lengths of

'a'=300,'b=300','c'=450

using the cosine rule to calculate the largest angle "C"

Cos C=((a^2)+(b^2)-(c^2))/(2*a*b)
=90,000+90,000-202500/180,0000
=-0.125

so "C" = inverse Cos of -0.125 , this part stumps me
= 97.1808

Thanks again
Bjackson
 
let a=300
let b=300
let c=450
let C=((a^2)+(b^2)-(c^2))/(2*a*b)
print C
-0.125
' Calculate inverse cosine
let answer=Atn(-C / Sqr(-C * C + 1)) + 2 * Atn(1)
print answer
1.69612415796296 (in radians)
let answer=answer*57.2957795
print answer
97.1808 (in degrees)

The difference in the answers is due to the number of decimal places used.
i.e.
let answer=1.69
let answer=answer*57.29
print answer
96.8201
 
Bjackson,

It's been too long for me too. Aren't we just looking for the ArcSin here?

Will go research this.

Aren't the kids supposed to be smarter than us?

Wayne
 
Thanks Ray and Wayne

I will test both and get back to you.It's creeping up to new year here so it will have to wait until
A.Tomorrow or B.When i sober up, whichever sober comes first

The trouble with kids is they give up to easily,or sometimes they think its not cool to ask for help.I know i'm not real bright at maths ,so i will accept all help offered

All the best for the new year to all

Regards
Bjackson
 
RayH
Worked like a charm,and was set out so even a dummy like me could follow it.The book i was working from layed out the formula ,but then at the crucial point assumed the reader knew what inverse cosine was.Why do they do these things?
Thank you for your help

Wayne
Maybe our kids are smarter.My daughter is out enjoying the new year celebrations with her friends.I am sitting in front of a computer!!!!

After digging around in the help files i came up with what you suggested
Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
To me its the same as the book.If access help files had just had
inverse of cos=Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1) i would have known what to do. Arccos(x) just confused me,i thought it must be another function that could be used.Perhaps i am even more simple minded than I thought i was.

Anyway thanks again for your help
Regards
Bjackson
 

Users who are viewing this thread

Back
Top Bottom