Sunday, September 7, 2025

Basic vs. Python: Circle Inscribed in Circle [HP 71B, Casio fx-CG 100]

Basic vs. Python: Circle Inscribed in Circle



Calculators Used:

Basic: HP 71B

Python: Casio fx-CG 100


Introduction






Let a rectangle with sides A and B be inscribed in a circle. The circle has a radius R. Let the line segments with the length A have a corresponding angle Θ. If we are given R and Θ, we can use the chord length formula to calculate A and B.


The angle corresponding with side B can be determined as:

φ: angle corresponding with side B


φ + Θ + φ + Θ = 360°

2 × (φ + Θ) = 360°

φ + Θ = 180°

φ = 180° - Θ


Chord length:


A = 2 × R × sin(Θ/2)

B = 2 × R × sin(φ/2) = 2 × R × sin((180° - Θ)/2)


Knowing A and B, we can calculate the following:


Area of the rectangle = A × B

Area of the shaded area (circle – rectangle) = π × R^2 – A × B



Basic: HP 71B – INSCRECT


10 DESTROY R,A,B,C,D,T

15 DEGREES @ FIX 5

20 DISP “RECT. INSCR. CIRCLE” @ PAUSED

25 DISP “DEGREES MODE” @ WAIT 0.5

30 INPUT “RADIUS? “; R

35 INPUT “ANGLE-SIDE A? “; A


50 A = 2 * R * SIN(T/2)

55 B = 2 * R * SIN((180 – T)/2)

60 C = A * B

65 D = R^2 * PI – C


80 DISP “SIDE A = “, A @ PAUSE

85 DISP “SIDE B = “, B @ PAUSE

90 DISP “RECT ANGLE = “, C @ PAUSE

95 DISP “CIRC-RECT = “, D @ PAUSE

98 STD



Notes:

* FIX 5: Fix 5 display

* STD: Standard mode, floating point display

* DEGREES: Sets the HP 71B in degrees mode



Python: Casio fx-CG 100, insecrect.py



from math import *

print(“Rectangle Inscribed in a Circle”)

print(“Math module imported”)

r=eval(input(“Radius? “))

print(“Enter angle in degrees”)

t=eval(input(“Angle- A? “))

u=t*pi/180

a=2*r*sin(u/2)

b=2*r*sin((pi-u)/2)

c=a*b

d=r**2*pi-c

print(“A: {0.5f}”.format(a))

print(“B: {0.5f}”.format(b))

print(“Rect. Area: {0.5f}”.format(c))

print(“CIRC-AREA: {0:.5f}”.format(d))



Notes:

* Since the math module is used, this script can be used in any calculator with Python.

* Python’s angle mode is always in radians.



Examples



Example 1:

Inputs:

r = 10

Θ = 30°

Outputs:

a ≈ 5.17638

b ≈ 19.31852

c = 100

d ≈ 214.15927



Example 2:

Inputs:

r = 20

Θ = 80°

Outputs:

a ≈ 25.71150

b ≈ 30.64178

c ≈ 787.84620

d ≈ 468.79086



Example 3:

Inputs:

r = 20

Θ = 90°

Outputs:

a ≈ 35.35534

b ≈ 35.35534

c = 1250

d ≈ 713.49541



Eddie


All original content copyright, © 2011-2025. 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.


The author does not use AI engines and never will.

Basic vs. Python: Circle Inscribed in Circle [HP 71B, Casio fx-CG 100]

Basic vs. Python: Circle Inscribed in Circle Calculators Used: Basic: HP 71B Python: Casio fx-CG 100 Introduction ...