Showing posts with label perimeter. Show all posts
Showing posts with label perimeter. Show all posts

Saturday, May 25, 2024

Swiss Micros DM32: Spherical Triangle ft. Law of Cosines

Swiss Micros DM32: Spherical Triangle ft. Law of Cosines



Introduction


The state file spheretri.d32 is about solving triangles on the spherical space.





The programs solve spherical triangles in two common problems: SSS (side-side-side, really arc lengths) and SAS (side-angle-side). All the inputs are in decimal degrees.


Also calculated are the surface area and perimeter, both in radians. The radius is assumed to be 1.


Surface Area = ( A° + B° + C° ) * π / 180 – π = A + B + C – π


Perimeter = ( X° + Y° + Z°) * π / 180 = X + Y + Z


The sum of the angles (A, B, C) must be greater than 180° (π radians). Due to this requirement, in solving for angles and sides, the Law of Cosines will be used in each instance. The Law of Sines is only advised to check ratios.



Equation listing


Law of Sines – can be used as a check on triangles:

SIN(A)÷SIN(X)=SIN(B)÷SIN(Y)


Law of Cosines – two equations:

COS(Z)=COS(X)×COS(Y)+SIN(X)×SIN(Y)×COS(C)

COS(C)=-COS(A)×COS(B)+SIN(A)×SIN(B)×COS(Z)


Here the variables are general place holders.



Program Listing


Labels:

Label H: help program

Label I: Initialization routine. Sets the angles mode to degrees and clears the variables.

Label C: Starts the solve spherical triangle routine: given the three arc lengths X, Y, and Z.

Label Z: Starts the solve spherical triangle routine: given the arc lengths X and Y and and the angle between the arcs, angle C

Label F: Routine to solve for angles A and B, perimeter, and area



General Instructions


  1. To start a new problem, execute program I.

  2. To solve a spherical triangle given the sides (arc lengths), execute program C. (SSS)

  3. To solve a spherical triangle given two sides and the internal angle, execute program Z. (SAS)


This program also solves for the surface area, assuming a radius of 1, and perimeter of the triangle.


Program Code



H01 LBL H

H02 SF 10

H03 EQN: A N G L E _ A _ B _ C

H04 EQN: S I D E S _ X _ Y _ Z

H05 EQN: X E Q _ C _ S S S

H06 EQN: X E Q _ Z _ S A S

H07 EQN: E Q N S _ A R E _ S I N E

H08 EQN: A N D _ C O S I N E _ L A W S

H09 CF 10

H10 RTN


I01 LBL I

I02 DEG

I03 CLVARS

I04 CLx

I05 RTN


C01 LBL C

C02 INPUT X

C03 INPUT Y

C04 INPUT Z

C05 RCL Z

C06 COS

C07 RCL X

C08 COS

C09 RCL Y

C10 COS

C11 ×

C12 -

C13 RCL X

C14 SIN

C15 RCL Y

C16 SIN

C17 ×

C18 ÷

C19 ACOS

C20 STO C

C21 VIEW C

C22 XEQ F

C23 RTN


Z01 LBL Z

Z02 INPUT X

Z03 INPUT Y

Z04 INPUT C

Z05 RCL X

Z06 COS

Z07 RCL Y

Z08 COS

Z09 ×

Z10 RCL X

Z11 SIN

Z12 RCL Y

Z13 SIN

Z14 ×

Z15 RCL C

Z16 COS

Z17 ×

Z18 +

Z19 ACOS

Z20 STO Z

Z21 VIEW Z

Z22 XEQ F

Z23 RTN


F01 LBL F

F02 RCL X

F03 COS

F04 RCL Z

F05 COS

F06 RCL Y

F07 COS

F08 ×

F09 -

F10 RCL Z

F11 SIN

F12 RCL Y

F13 SIN

F14 ×

F15 ÷

F16 ACOS

F17 STO A

F18 RCL Y

F19 COS

F20 RCL X

F21 COS

F22 RCL Z

F23 COS

F24 ×

F25 -

F26 RCL X

F27 SIN

F28 RCL Z

F29 SIN

F30 ×

F31 ÷

F32 ACOS

F33 STO B

F34 RCL A

F35 RCL+ B

F36 RCL+ C

F37 →RAD

F38 π

F39 -

F40 STO R

F41 RCL X

F42 RCL+ Y

F43 RCL+ Z

F44 →RAD

F45 STO P

F46 VIEW A

F47 VIEW B

F48 VIEW R

F49 VIEW P

F50 RTN


You can download the DM32 state file here:


https://drive.google.com/file/d/1qX-y2G5sCOmm4ktmZbnGoPI3uzrx6IfF/view?usp=sharing



Examples  (FIX 5)


SSS Problem (LBL C)


X = 18.66°

Y = 20.49°

Z = 19.95°


Results:

C = 62.04726°

A = 55.92702°

B = 64.98954°

R = 0.05173 radians (surface area)

P = 1.03149 radians (perimeter)


SAS Problem (LBL Z)


X = 17.00 °

Y = 23.32°

C = 64.55°


Results:

Z = 21.88733°

A = 45.08768°

B = 73.51096 °

R = 0.05495 radians (surface area)

P = 1.08572 radians (perimeter)



Sources


Wikipedia. “Spherical Triangle” Updated April 9, 2024. Retrieved April 11, 2024.

https://en.wikipedia.org/wiki/Spherical_trigonometry#:~:text=Spherical%20trigonometry%20is%20the%20branch,sphere%2C%20geodesics%20are%20great%20circles.


Gray, Glen. “Spherical Trigonometry – An Introduction and Basic Theorems” Video. February 12, 2023. Retrieved April 11, 2024. https://www.youtube.com/watch?v=McWv9bcvMYg



Note: The blog will be posted on Saturdays only on June and July 2024.


Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Saturday, April 6, 2024

Radius and Apothem of Regular Polygons

Radius and Apothem of Regular Polygons


On this blog, let’s calculate the lengths of a regular polygon’s radius, apothem, and area knowing only the side length and internal angle.



A regular polygon is a polygon in which every side has an equal length, and every internal angle is equal.


Let x be the length of one side of the regular polygon, and θ be the internal angle of the polygon where:


θ = (n – 2) / n × 180°




The radius (r) of the regular polygon is a line segment from a vertex to the center of the polygon. The radius bisects the vertex, therefore cutting the internal angle in half.

The apothem (a) is a line segment from the center of the polygon to the center of the polygon’s line segment. If we extend the apothem beyond the border, the apothem splits the length of the side segment in half.

Zooming in, a right triangle is formed between the radius, apothem, and half of the polygon line segment.


By trigonometry:


tan (θ / 2) = a / (x / 2)

a = (x / 2) × tan (θ / 2)


and


cos (θ / 2) = (x / 2) ÷ r

r = x / (2 × cos (θ / 2))


Knowing the apothem, the area of the regular polygon is:


area = perimeter × a / 2


where the perimeter = n × x


Then:


area = (n × x) × a / 2

= 1 / 2 × n × x × a

= 1 / 2 × n × x × (x / 2 × tan(θ / 2))

= 1 / 4 × n × x^2 × tan(θ / 2)



Another Formula for an Area’s Regular Polygons


The area of a regular polygon is often stated as:


area = 1 / 4 × n × x^2 / (tan (180° / n)) = 1 / 4 × n × x^2 × cot (180° / n))


We can show that the two formulas for area are equivalent:


Note that:

θ = (n – 2) / n × 180°

θ = 180° - 360° / n

Divide both sides by 2:

θ / 2 = 90° - 180° / n

180° / n = 90° - θ / 2 [ I ]




Observe that the trigonometric identity, for any angle α:

tan(90° - α) = 1 / tan(α) = cot(α)

and

cot(90° - α) = 1 / cot(α) = tan(α) [ II ]


Then:

area = 1 / 4 × n × x^2 × tan(θ / 2)

= 1 / 4 × n × x^2 × cot(90° - θ / 2) [ II ]

= 1 / 4 × n × x^2 × cot(180° / n) [ I ]

= 1 / 4 × n × x^2 / tan(180° / n) [ I ]


In Summary:

Internal Angle: θ = (n – 2) / 2 × 180°

Apothem: a = (x / 2) × tan (θ / 2)

Radius: r = x / (2 × cos (θ / 2))

Area = 1 / 4 × n × x^2 × tan(θ / 2) = 1 / 4 × n × x^2 / tan(180° / n)

(Note: 180° = π radians)



Table of Apothem and Radius, with side length of 1


n

θ (in degrees)

θ / 2 (in degrees)

a (to 5 decimal places)

r (to 5 decimal places)

3

60

30

0.28868

0.57735

4

90

45

0.5

0.70711

6

120

60

0.86603

1

8

135

67.5

1.20711

1.30656

12

150

75

1.86603

1.93185


Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Saturday, June 15, 2019

HP 42S and TI-60: Dimensions of a Race Track

HP 42S and TI-60:  Dimensions of a Race Track



We have a race track that consists of two rectangular tracks connected by a circular ring that is cut in half.  A half ring attaches to each end. 

Let the variables define the following measurements:

R0 = radius from the center of the circular ring to the outside of the track
RI = radius from the center of the circular ring to the inside of the track
C = length of the rectangular potion of the track
R0 - RI = width of the rectangular portion of the track

I am taking an imaginary line in the middle of the track (see the pink dotted line on the right side of the illustration).  The radius from the center of the ring to the pink dotted line is:
 RI + (R0 - RI)/2.

Area: 

Area
= area of the circular ring + area of the top rectangular portion + area of the bottom rectangular portion
= (π * RO^2 - π * RI^2) + C * (RO - RI) + C * (RO -RI)
= π * (RO^2 - RI^2) + 2 * C * (RO - RI)

Perimeter:

Perimeter
= circumference of the circle at the half way point between the outside and inside radius + length of the top rectangular portion + length of the bottom rectangular potion
= 2 * π * (RI + (RO - RI)/2) + C + C
= 2 * π * (RI + (RO - RI)/2) + 2 * C
= 2 * π * 1/2 * (2 *RI + RO - RI) + 2 * C
= π * (RO - RI) + 2 * C

Now that we have the calculations, let's put them to practice.

Input Variables (see above):

R0 = RO
R1 = RI
R2 = C

Ouput Variables:

R3 = area
R4 = perimeters

HP 42S/DM42/Free42 Program RACETRK

00  {68-Byte Prgm}
01  LBL "RACETRK"
02  RCL 00
03  X ↑ 2
04  RCL 01
05 X ↑ 2
06  -
07  PI
08  *
09  2 
10  RCL * 02
11  RCL 00
12  RCL - 01
13  *
14  +
15  STO 03
16  "AREA="
17  AVIEW
18  STOP
19  2
20  RCL * 02
21  RCL 01
22  RCL + 00 
23  PI
24  *
25  +
26  STO 04
27  "MID PERIMETER="
28  AVIEW
29  RTN
30  END

TI-60 Program Race Track

Format:   line number :  key code : key

00 :  91  :  π
01  :  65  :  *
02  :  53  :  (
03  : 71  : RCL
04  :  00 :  0
05  :  96  : x^2
06  :  75  :  -
07  :  71  :  RCL
08  :  01  :  1
09  :  96  :  x^2
10  :  54  :  )
11  :  85  :   +
12  :  02  :  2
13  :  65 :  *
14  :  71  :  RCL
15  :  02 :  2
16  :  65  :  *
17  :  53  :  (
18  :  71   :  RCL
19  :  00  :  0
20  :  75  :  -
21  :  71  :  RCL
22  :  01  :  1
23  :  54   :  )
24 :  95  :  =
25  :  61  :  STO
26  :  03  :  3
27  :  13   : R/S
28  :  02  :  2
29  :  65  :  *
30  :  71   :  RCL
31   :  02 :  2
32  :  85  :  +
33  :  91  :  π
34  :  65  :  *
35  :  53  :  (
36  :  71  : RCL
37  :  00  :  0
38 :  85  :  +
39  :  71  :  RCL
40  :  01 :  1
41  :  54  :  )
42  :  95  :  =
43  :  61  :  STO
44  :  04  :  4
45  :  13  : R/S
46  :  22  :  RST

Example

R0 = radius to outside ring = 12 ft
R1 = radius to inside ring = 8 ft
R2 = length of the rectangular portion of the trace = 45 ft

Results:

Area (R3) = 611.3274123 ft^2
Perimeter of the mid-line (R4) = 152.8318531 ft

Eddie

All original content copyright, © 2011-2019.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Wednesday, March 22, 2017

HP 15C: Regular Polygon: Internal Angle, Area, Perimeter



Hope you all like the new background and style changes!  Thank you for the success of this blog - less than a month to the blog's sixth birthday (4/11/2017).  


HP 15C:  Regular Polygon: Internal Angle, Area, Perimeter

Inputs (Store values before running the program):
R0:  n, number of sides
R1:  s, length of each side

Outputs:
R2:  θ, Internal Angle
R3:  A, Area
R4:  P, Perimeter

Formulas Used (Degrees Mode Used):

Internal Angle:  θ = 180° - 360°/n
Area:  A = (s^2 * n)/(4 * tan (180°/n))
Perimeter:  P = s * n

Step
Key
Code
001
LBL C
42, 21, 13
002
DEG
43, 7
003
1
1
004
8
8
005
0
0
006
ENTER
36
007
ENTER
36
008
2
2
009
*
20
010
RCL÷ 0
45, 10, 0
011
-
30
012
STO 2
44, 2
013
R/S
31
014
RCL 1
45, 1
015
X^2
43, 11
016
RCL* 0
45, 20, 0
017
1
1
018
8
8
019
0
0
020
RCL÷ 0
45, 10, 0
021
TAN
25
022
4
4
023
*
20
024
÷
10
025
STO 3
44, 3
026
R/S
31
027
RCL 0
45, 0
028
RCL* 1
45, 20, 1
029
STO 4
44, 4
030
RTN
43, 32

Example:  R0 = n = 5, R1 = s = 4.  Output:  θ = 108°, A ≈ 27.5276, P = 20

This blog is property of Edward Shore,  2017.

Symmetric Quartic Equation - Python

Symmetric Quartic Equation - Python Note: The code is programmed with a TI-84 Evo. No modules are used, so the scripts should be adopt...