Announcement

Collapse
No announcement yet.

Online triangle calculator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Online triangle calculator

    Can you link my online triangle calculator in your page?
    http://triancal.esy.es (to calculate and draw triangles use chrome browser)
    thanks


  • #2
    Many people use Firefox and Opera browsers. I'm not sure it would be appropriate to link a page that excludes a not-insignificant portion of the web browser population.

    Comment


    • #3
      I use Firefox. The calculator part of the page seemed to work correctly for a few trivial triangles (where I knew the answer). The drawing part does not work. A tool that supports all the major browsers is preferable.

      I do like that it solves from (nearly) any three givens. Our triangle tools require the user to sort out what kind of a triangle problem it is and pick the right tool.

      Comment


      • #4
        If I put invalid data into the calculator part (i.e. sides of 1, 2, and 3 in A, B, and C) Firestorm locks up completely, and then displays some kind of javascript error that says
        ERROR:
        event = 500 Internal Server Error
        jqXHR = error
        ajaxSettings = Internal Server Error
        thrownError = undefined
        responseText = <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
        <html><head>
        <title>500 Internal Server Error</title>
        </head><body>
        <h1>Internal Server Error</h1>
        <p>The server encountered an internal error or
        misconfiguration and was unable to complete
        your request.</p>
        <p>Please contact the server administrator at
        [email protected] to inform them of the time this error occurred,
        and the actions you performed just before this error.</p>
        <p>More information about this error may be available
        in the server error log.</p>
        </body></html>

        Comment


        • #5
          Originally posted by gubment_cheez View Post
          If I put invalid data into the calculator part (i.e. sides of 1, 2, and 3 in A, B, and C) Firestorm locks up completely, and then displays some kind of javascript error that says
          I might dispute it being invalid. It is a degenerate triangle (line), with angles of 0, 0 and 180, at least in the limit as 3 is approached from the left. Now 1,2, and 3.01, that would be invalid.

          Our calculator for this triangle is http://www.onlineconversion.com/shap...e_triangle.htm
          It gives an error message that the three sides can't form a triangle, but doesn't hang up.
          Last edited by JohnS; 07-28-2015, 10:49 AM.

          Comment


          • #6
            I have a paper from an Introductory Numerical Analysis course at Berkeley titled "Miscalculating Area and Angles of a Needle-like Triangle. All the test cases included are moderately degenerate and strain classical formulas for triangle solutions. As Javascript is double precision floating point (~15 digit), I would expect less of a numerical problem than his examples which are intended to cause problems on a 10-digit calculator. This performs substantially worse on all that I tried. I have no problem leaving this here, but in its present state, I don't recommend listing it in our resource section.

            Comment


            • #7
              Borrowing JohnS' paper and using it to fuzz test the page gives a couple other errors, using data from Table 1:

              ERROR:
              event = 200 OK
              jqXHR = parsererror
              ajaxSettings = SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
              thrownError = undefined
              responseText = <br />
              <b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in <b>/home/u204436464/public_html/PHP/TrianCal.php</b> on line <b>39</b><br />

              ERROR:
              event = 200 OK
              jqXHR = parsererror
              ajaxSettings = SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
              thrownError = undefined
              responseText = <br />
              <b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in <b>/home/u204436464/public_html/PHP/TrianCal.php</b> on line <b>120</b><br />

              ERROR:
              event = 200 OK
              jqXHR = parsererror
              ajaxSettings = SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
              thrownError = undefined
              responseText = <br />
              <b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in <b>/home/u204436464/public_html/PHP/TrianCal.php</b> on line <b>246</b><br />
              Also, trying to feed from Table 2, Row 2, A ̊ 10.16424862 is turned into 10.16424862172
              Table 2, Row 5 A ̊ 29.99999999 is turned into 29.99999999338

              If you can resolve the crashes, the infinite loops, and the clamping issues I think there would be much more positive response for your request.

              Comment


              • #8
                Originally posted by gubment_cheez View Post
                Borrowing JohnS' paper and using it to fuzz test the page gives a couple other errors, using data from Table 1:

                I'm glad you mentioned finding this paper. He describes it as "not the final word," but the version now on the web is newer than what I have. All the old content is still there, but he has added some material.


                Comment


                • #9
                  For reference, the paper JohnS and I are referring to is http://www.cs.berkeley.edu/~wkahan/Triangle.pdf (mirrored as of this posting date here: http://ge.tt/4GXC4RL2/v/0?c )

                  Comment


                  • #10
                    I like this article, but it is very technical and oriented to programmers whose programs must always accommodate the pathological triangles. Solving triangles on a calculator, I need to know when the naive approach works and when it leads to trouble. As a result, a few thoughts which may help others:

                    Heron's formula: The naive approach to forming terms like (s-a) can lead to rounding problems. On a decimal oriented machine (HP15), imagine the sides with their decimal points aligned, ready for addition. IF the perimeter can be formed without rounding, the naive approach works. Kahan's examples involve 10-digit sides on a 10-digit machine, but the sides are chosen for the perimeter to require 11 digits without rounding. No joy. In floating point, decimal fractions are not expressed well in binary. Typically all bits are used and some rounding is always go on. Some dynamic range is wasted in the naive calculation. If the sides have been sorted and "not-a-triangle" tested, so c ≤ b ≤ a < (b+c), then (b+c+a)/(b+c-a) is the dynamic range lost. If 2n is the first binary power which exceeds this, about n bits are lost. Double precision floating point has 53 bit significands. If you are happy with remaining precision, naive approach is fine. Otherwise, use the Kahan approach of sensibly forming each term by order of addition/subtraction. Note: The same terms used in Heron's formula also appear in formulas for r, the radius of the inscribed circle, and in tangent half angle formulas. If used, the same considerations apply.

                    Note: Using the dynamic range formulation above, Kahan's examples of naive Heron, which generally fail on HP15, should get at least 5 or 6 digits right in double precision floating point (Excel or tablet calculator simulators).

                    Law of Cosines: Mathematically true, but computationally problematic, due to subtraction of near equal terms and performance of cosine near 0. It is very bad near 0, fair near 90, and bad near 180. The alternative given in section 7 is MUCH better:
                    c = (a-b) + 4*a*b*sin(C/2) should always be used over the law of cosines.
                    For very large angles, it has poor resolution near 180, where it may be transformed into:
                    c = (a+b) -4*a*b*sin((180-C)/2) Note: This should not be used for C<150, because of the subtraction of terms.
                    While normally used to find either c or C if the others known, it can be solved for a or b leading to a quadratic. These are known as haversine formulas; if the proper form is used, depending on angle, it gives a "no worries" result.

                    Law of Sines: Normally reliable, can have rounding problems when solving for a angle near, but not exactly, 90. Depending on accuracy needed, results in the range 85 - 95 may be suspect and another approach should be considered. Computationally, it is cheap to calculate and only resort to other methods for a result in this range. For the case of angle, included side, opposite side that Kahan demonstrates in table 2, it is better to calculate third side, c, (law of cosines is OK, because we found an angle near 90 by law of sines and are seeking alternate method), first and then B and/or C by haversine formula.

                    x - y: Terms like this develop in many of the formulas. Always evaluate as (x-y)*(x+y).

                    Other trig identities may be helpful in transforming classical formulas. A copy of CRC Math Tables or similar reference should be in your trunk of trigonometric trickery.
                    Last edited by JohnS; 08-02-2015, 04:30 AM.

                    Comment


                    • #11
                      If you need a versatile triangle calculator you can use this one. It's easy to use with intuitive interface and dynamically forming triangle image. This online calculator covers all possible forms of triangles and allows you to calculate all missing triangle parameters given any three known parameters of a triangle.

                      Comment

                      Working...
                      X