Showing posts with label radians. Show all posts
Showing posts with label radians. Show all posts

Saturday, March 21, 2026

TI-83 Premium CE Edition Python and Casio fx-92 Collège: Graphing Roses

TI-83 Premium CE Edition Python and Casio fx-92 Collège: Graphing Roses


Introduction


The scripts presented today will draw a rose with the following polar equation:


r = a * cos(n * Θ)


If n is odd, then the rose will have n petals, but if n is even, then the rose will have double the petals (2*n petals).



TI-83 Premium CE Edition Python (and TI-84 Plus CE Python): ROSE84.PY


from math import *

from turtle import *

t=Turtle()

t.clear()

t.hidegrid()

t.hideturtle()

t.pencolor(255,0,0)


# set pedal length

a=100

t.penup()

t.goto(a,0)


# ask for pedals

print(“** rose **”)

print(“odd n: n pedals”)

print(“even n: 2*n pedals”)

n=eval(input(“n? “))

t.clear()


# draw

t.pendown()

for i in range(129):

  # theta

  m=i/128*2*pi

  # r

  r=a*cos(n*m)

  t.goto(r*cos(m),r*sin(m))

t.done()






Casio fx-92 Collège: Graphing a Rose


Note: The instructions are in French.


INSTRUCTION

DETAIL

ENGLISH TRANSLATION

Style Criox


Cross Cursor Style

? → B

Demander valuer B

Input B

20 → A

Metrire var á 20 → A

Set A = 20

Aller á x = A; y = 0


Goto (A, 0)

Stylo écrit


Pen down

Répéter 128


Repeat 128 times (loop):

C ÷ 128 × 2 × π → D

Metrire var á C ÷ 128 × 2 × π → D

Set D = C/128*2*π

A × cos((B × D)^r) → E

Metrire var á A × cos((B × D)^r) → E

Set E = A*(cos(B*D)), B*D is in radians.

Aller à x=E×cos(D^r); y=E×sin(D^r)


Goto (E * cos D, E * sin D). D is in radians.

C + 1 → C

Metrire var á C + 1 → C

Set C = C + 1


End of loop


Note: To designate a measure of an angle to be radians regardless of calculator setting, press [ CATALOG ] >> Angl/Coord/Sexag >> Radians.






Drawing roses on the first day of spring,



Eddie


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

Trigonometric Calculus when Angles are in Degrees

Trigonometric Calculus when Angles are in Degrees


Today’s blog is a quickie.


The preferred angle measure in calculus is the radian. However, a lot of applications, including geometry, astronomy, engineering, and construction, use degrees.


An approach is to convert everything to radians before proceeding. Another approach is to remember that x radians = x° * π / 180, and use the conversion factor.



Derivatives



d/dx sin( x° )


Now all calculus calculations must have radians.


d/dx sin( x * π / 180)

= π / 180 * cos (x * π / 180)

= π / 180 * cos(x°)


Similarly – remember the angle considered is in DEGREES:

d/dx sin(x°) = π / 180 * cos(x°)

d/dx csc(x°) = - π / 180 * csc(x°) * cot(x°)

d/dx cos(x°) = - π / 180 * sin(x°)

d/dx sec(x°) = π / 180 * tan(x°) * sec(x°)

d/dx tan(x°) = π / 180 * sec(x°)^2

d/dx cot(x°) = -π / 180 * csc(x°)



Integration


Now let’s try integration.


∫( sin(x°) dx)

= ∫( sin(x * π / 180)) dx

= 180 / π * ∫(π / 180 * sin(x * π / 180)) dx

= 180 / π * -cos(x * π / 180) + C

= -180 / π * cos(x°) + C


Similarly:

∫ sin(x°) dx = -180 / π * cos(x°) + C

∫ cos(x°) dx = 180 / π * sin(x°) + C

∫ tan(x°) dx = -180 / π * ln(cos(x°)) + C



Use caution when using calculators. A lot of calculators when using calculus in degree mode get it correct but its’ always good to verify.



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.

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.

Thursday, October 5, 2017

Adventures in Python: Trigonometric Tables

Adventures in Python: Trigonometric Tables

One of the many mathematical modules available for Python is the math module.  The math functions work with real numbers. 

The program highlighted today also features the for loop.  The for loop is structured differently from what I’m used to.  The for loop works with a range or a list instead of a count of values. 

The range function creates a list of integers, which varies with the syntax:

range(n):  creates a list of integers from 0 to n-1 (the n-1 will take getting used to)
range(a,b):  creates a list of integers from a to b-1

The default angle measurement in Python is radians.  The program builds a tables in increments of 10°, so I must use the math.radians function to convert angles to radians for the table to work properly.

# Program 003:  Trig tables
# Python works with radians
# If you want degrees, use the math.radians, math.degrees to convert

# Import the math library
import math

# Header
print("Angle","sin","cos","tan")

# Build a table with 0 to 180 degrees of trig (sin, cos, tan)
# range:  range(start, stop, step)
# range ends when stop is equalled or exceeded
# since I want 180, I will tip the upper limit to 181
# The for structure defaults to integers
# For structure is used

# rounded values
print("Rounded to 6 decimal places")
print("A list format is used")
print(["angle"," sin "," cos "," tan "])
for k in range(0,181,10):
    # round each compoment
    s = round(math.sin(math.radians(k)),6)
    c = round(math.cos(math.radians(k)),6)
    t = round(math.tan(math.radians(k)),6)
    print([k,s,c,t])

Output:

Angle sin cos tan
Rounded to 6 decimal places
A list format is used
['angle', ' sin ', ' cos ', ' tan ']
[0, 0.0, 1.0, 0.0]
[10, 0.173648, 0.984808, 0.176327]
[20, 0.34202, 0.939693, 0.36397]
[30, 0.5, 0.866025, 0.57735]
[40, 0.642788, 0.766044, 0.8391]
[50, 0.766044, 0.642788, 1.191754]
[60, 0.866025, 0.5, 1.732051]
[70, 0.939693, 0.34202, 2.747477]
[80, 0.984808, 0.173648, 5.671282]
[90, 1.0, 0.0, 1.633123935319537e+16]
[100, 0.984808, -0.173648, -5.671282]
[110, 0.939693, -0.34202, -2.747477]
[120, 0.866025, -0.5, -1.732051]
[130, 0.766044, -0.642788, -1.191754]
[140, 0.642788, -0.766044, -0.8391]
[150, 0.5, -0.866025, -0.57735]
[160, 0.34202, -0.939693, -0.36397]
[170, 0.173648, -0.984808, -0.176327]
[180, 0.0, -1.0, -0.0]

Eddie


This blog is property of Edward Shore, 2017.

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues The programs are listed for the Swiss Micros DM42 an...