+ Reply to Thread
Results 1 to 8 of 8

COS not working and strange results

  1. #1
    Registered User
    Join Date
    10-22-2015
    Location
    Blaker, Norway
    MS-Off Ver
    360
    Posts
    6

    COS not working and strange results

    Hi,

    I'm doing a bigger trigonometric calculation in excel and my answers are very strange in some cells.
    I'm double checking them with my calculator and they do answers differently...

    Let me try to sum it up,
    Triangle: a=7, b=6, c=8, A=75,52', B=46,57', C=57,91'

    I want to calculate the "a" on each side of the center line of angle C.
    This gives me a easy calculation to give me a right triangle. C1=180-(90+75,52) = 14,48' & C2=180-(90+46,57) = 43,43'. checksum = 14,48+43,43 = C57,91
    then to do pytagoras to calculate the new "a", i need to find the height of the new b/c: b = COS(14,48)*6 = 5,80 & c = COS(43,43)*8 = 5,80.
    BUT in excel this gives me two different results on the same calculation.

    =COS(DEGREES(H2))*B2 (gives me the correct result)
    =COS(DEGREES(J2))*C2 (gives me wrong result)

    excel file is attached pyta.xlsx

    What am i doing wrong?

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: COS not working and strange results

    It's not a right triangle.

    You can't use Pythagoras' theorem, you need to use the Law of Cosines.


    EDIT:

    Wait are you drawing an interior height perpendicular from one line to the opposite angle?
    Last edited by ben_hensel; 10-22-2015 at 10:27 AM.
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: COS not working and strange results

    I think your error is in the use of the DEGREES() function (help files for the different math and trig functions: https://support.office.com/en-us/art...__toc309306715 ). You use the DEGREES function to convert an angle measure in radians into an angle measure in degrees. So, when you Excel performs the DEGREES(14.5) part of the one COS() function, it returns a very large number. You can see this occur using the Evaluate formula tool on the Formulas Group.

    I think what you really want here is to convert those angles in degrees into radians using the RADIANS() function instead of the DEGREES() function.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    10-22-2015
    Location
    Blaker, Norway
    MS-Off Ver
    360
    Posts
    6

    Re: COS not working and strange results

    If i should use RADIANS(), why is then the first answer correct? the formulas are the same, just the values that are changed.
    Doing this on the calculator on my desk gives the correct result.

    Originally the triangle is not straight, but after i broke it up and used the new angles that makes angle A/B=90', then i have a straight triangle.

    Check out the file attached in the original file. The calculations in cell M2 and N2 should give the same result, that is 5,956934 as i get on my calculator in both cases using the same formulas.

    This is somehow confusing.

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: COS not working and strange results

    The calculations in cell M2 and N2 should give the same result, that is 5,956934 as i get on my calculator in both cases using the same formulas.
    Interesting, when I do those calculations on my hand calculator (set to degrees mode, so I don't have to worry about the degrees to radians conversion), I get 5.8095, not 5.957.

    If I take 5.957 and try to back calculate the angle -- 5.957=6*cos(x)
    x=arccos(5.957/6), x=6.864 degrees, not 14.5.

    I would suggest that you double check your trig analysis and make sure you are getting the correct answer.

  6. #6
    Registered User
    Join Date
    10-22-2015
    Location
    Blaker, Norway
    MS-Off Ver
    360
    Posts
    6

    Re: COS not working and strange results

    This is where the good part comes, i drawed the triangle in Autocad, and measured the angles and lengths, and they all match out. All the values are taken from a example of the equations. The calculations do match everywhere except when i move on to find the splitted parts of the triangle. The difference in values from excel and calculator i found being the difference in number of numbers after the comma.
    As you see in my excel sheet, i have checksums for selveral calculations to make sure everything is correct. At the end the check in Q2 should be equal to A2.

    The arccos calculation is also strange, yes. but if you sum the arccos with the 2 other angles, they do not result in 180'. therefore there is something wrong here to. I drawed this in autocad too, and measured the angle to 14,5, when drawing a straight line from angle C in 0'(orthocenter). this gives A=75,5, B=90, C=14,5. Only value to change when doing so is angle B and C, no change in lengths of the legs.

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: COS not working and strange results

    As near as I can tell, all your check sums and such look right. The only thing in your Excel file that looks wrong to me is the necessary conversion from degrees to radians in the M2 and N2 formulas.

    Would it, perhaps, be easier to perform the entire calculation in radians? Instead of converting the results in D2:D6 to degrees, leave them in radians. Where you have 180 in your check functions, enter pi(), where you have 90, enter pi()/2. Then you won't need to worry about the conversion between angle measures, which is what I believe is causing the confusion.

  8. #8
    Registered User
    Join Date
    10-22-2015
    Location
    Blaker, Norway
    MS-Off Ver
    360
    Posts
    6

    Re: COS not working and strange results

    I must be honest to say that i have never worked with radians, and i somehow lose control if to start using radians instead of degrees. Anyhow, based on your conclution, this means excel does it's calculations with consistency. Due to all my answers are correct, and cross checked on the calculator except for the N2 calculation. And later on the O2:Q2 is wrong, but thats on my end for now!

    I would guess the fault is on my side, since excel just handles it's input and retrieves an answer, but two formulas with the "same" input retrieves different result, this is to me odd.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Strange problem with formula results-
    By excelaron in forum Excel General
    Replies: 6
    Last Post: 07-17-2012, 07:51 PM
  2. Strange RAND results
    By tangent1 in forum Excel General
    Replies: 3
    Last Post: 05-08-2010, 11:23 AM
  3. VLOOKUP - Strange results
    By paulwelburn in forum Excel General
    Replies: 6
    Last Post: 05-31-2007, 05:41 PM
  4. [SOLVED] Strange vlookup results
    By Mary-Lou in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-01-2006, 10:50 PM
  5. [SOLVED] Strange results...
    By Jim May in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2006, 05:30 PM
  6. Strange IF results
    By MWE in forum Excel General
    Replies: 0
    Last Post: 03-25-2005, 08:14 PM
  7. [SOLVED] Strange Log base 10 results
    By Chip Hankley in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-04-2005, 11:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1