Showing posts with label polar. Show all posts
Showing posts with label polar. Show all posts

Sunday, March 7, 2021

Fun with the TI-73 Part II: Rolling Two Dice, Numerical Derivative, Rectangular/Polar Conversions

Fun with the TI-73 Part II: Rolling Two Dice, Numerical Derivative, Rectangular/Polar Conversions


TI-73 Program:  TWODICE - Rolling Two Dice


Introduction:


The program TWODICE will roll two regular dice and give the sum of those dice in three lists:


L_1: die 1

L_2: die 2

L_3: total


If there are seven rolls or less, the program displays the rolls.  In any case, the results are stored in the above lists.


Access L_1 by pressing [ 2nd ] [ STAT ] (LIST), 1

Access L_2 by pressing [ 2nd ] [ STAT ] (LIST), 2

Access L_3 by pressing [ 2nd ] [ STAT ] (LIST), 3


Program:


"EWS 2021"

Disp "ROLL THE DICE"

Input "ROLLS? ",X

dice(X)→L_1

dice(X)→L_2

L_1+L_2→L_3

If X≤7

Then

ClrScreen

For(A,1,X)

Output(A,1,L_1(A))

Output(A,3,L_2(A))

Output(A,6,L_3(A))

End

Pause

End

ClrScreen

Disp "L_1 = DIE 1","L_2 = DIE 2","L_3 = TOTAL"

Pause


Your results will vary.


TI-73 Program:  DERIVY1 - Numerical Derivative of y1(x)


The simple program DERIVY1 calculates the numerical derivatives of the equation stored in Y_1.  


Access Y_1 by pressing [ 2nd ] [ APPS ] (VARS), 2, 1


Program:


"EWS 2021"

Disp "D/DX Y_1"

Prompt X

10^(-8)→H

(2*H)^-1*(Y_1(X+H)-Y_1(X-H))→D

Disp "APPROX D/DX"

Pause D


Example:


Y_1 = (X^2-3)^2 + 1

Derivative at x = 0.95, Result:  -7.9705

Derivative at x = 2, Result:  8


Y_1 = e^(X^3/4)

Derivative at x = 0.46, Result: 0.16261

Derivative at x = 1.55, Result:  4.571295


TI-73 Program: RECPOL - Rectangular/Polar Conversion


This program has two conversions:


1.  >RECT:  Polar (r, θ) to Rectangular (x, y)

2.  >POLAR:  Rectangular (x, y) to Polar (r, θ)


This program works in either Degree or Radian mode.


I take a different approach to calculate angle than the atan2 method.  Approached this as calculating the angle between the vectors [ x, 0 ] and [ x, y].  The angle between vectors v1 and v2 is:


θ = acos( dot(v1, v2) / ( norm(v1) * norm(v2) ) = acos( x / √(x^2 + y^2))


The angle is negative if y<0.   


Like the argument and angle conversions, the point (0,0) is defined to have an angle of 0.


Since there is no theta character (θ) on the TI-73, I use the variable A instead.


Program:


"EWS 2021"

Lbl 0

Menu("MENU",">RECT",1,">POLAR",2,"EXIT",3)

Lbl 1

Input "R? ",R

Input "ANG? ",A

R*cos(A)→X

R*sin(A)→Y

Disp "X= ",X,"Y= ",Y

Pause

Goto 0

Lbl 2

Input "X? ",X

Input "Y? ",Y

√(X^2+Y^2)→R

If X=0 and Y=0

Then

0→A

Else

cos^-1(X/√(X^2+Y^2))→A

If Y<0

-A→A

End

Disp "R=",R,"ANG=",A

Pause

Goto 0

Lbl 3


Examples:


Examples are in Degree mode.


R = 19, ANG = 87.3°

Result:  X = 0.8950225635, Y = 18.97890762


X = -11.5, Y = 2.4

Result:  R = 1.74776575, ANG = 168.2118167



Eddie


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


Tuesday, March 6, 2012

Spirals


All About Spirals

This blog will about spirals. Why? I thought it would be fun. And I like spirals.


Regular Spirals

Source: http://www.mathematische-basteleien.de/spiral.htm

Equations:
Rectangular
x^2 + y^2 = a^2 (arctan y/x)^2

Polar
r = a θ

Parametric
x = a t cos t
y = a t sin t


Finding the y-intercept and x-intercept, as shown above, of a spiral, assuming 0 ≤ θ ≤ 2 π

We can use the rectangular equation to find these points.

x^2 + y^2 = a^2 (arctan y/x)^2

Y-Intercept - Point (0, y)

y^2 = a^2 (arctan y/0)^2

Note:
1. y/0 is undefined
2. tan (π /2) is undefined. So is tan (n π / 2) where n is an integer.

Use π / 2 as a solution.

Then:

y^2 = a^2 * (π / 2)^2

Take the square root of both sides, since y>0, use the positive root.

y = a * π / 2

The y-intercept is (0, a * π / 2)

X-Intercept - Point (x, 0)

x^2 = a^2 (arctan 0)^2

Note tan(n π.)=0 where n is an integer. Let's use π. (n = 1)

x^2 = a^2 π^2

Since the x-intercept lies left of 0, select the negative square roof. Therefore:

x = -a π.

The x-intercept is (-a π, 0).

Area of a Spiral (0 ≤ θ ≤ 2 π)

Use the polar equation: r = a θ

Using the general polar integral:

A = ∫ (1/2 * r^2 d θ , lower limit, upper limit)

A = ∫ (1/2 * a^2 * θ^2 d θ , 0, 2 π)
= a^2 / 2 * (8 π^3 / 3 - 0)
= 4 a^2 π^3 / 3

Slope of a Spiral

Polar Form:

∂r/∂θ = a

Parametric Form:

∂x/∂t = ∂/∂t (a * t * cos t)
= ∂/∂t (a * t) * cos t + a * t * ∂/∂t (cos t)
= a * cos t - a * t * sin t
= a * (cos t - t * sin t)

∂y/∂t = ∂/∂t (a * t * sin t)
= ∂/∂t (a * t) * sin t + a * t * ∂/∂t (sin t)
= a * sin t + a * t * cos t
= a * (sin t + t * cos t)

Stretch Spirals

What if we can "stretch" spirals? We can if alter the parameters of the parametric form:

x(t) = a * t * cos t
y(t) = b * t * sin t

Where a ≠ b.

Two graphical examples are shown below.


Finding the Intercepts of a Stretched Spiral

I will assume that both a ≠ 0 and b ≠ 0.

Y-Intercept: Point (0, y)

0 = a * t * cos t
y = b * t * sin t

Working with the first equation:

0 = a * t * cos t
0 = t * cos t,

which implies that either t = 0 or cos t = 0

We know that cos (n π / 2) = 0 where n is an integer. Choose t = π / 2.

Then y = b * π / 2 * sin(π / 2) = b * π / 2

Then the y-intercept is (0, π / 2).

X-Intercept: Point (x, 0)

x = a * t * cos t
0 = b * t * sin t

Working with the second equation:
0 = b * t * sin t
0 = t * sin t

which implies that t = 0 or sin t = 0. We know that sin(n π) = 0 where n is an integer, let's choose n = 1 and then t = π.

Hence x = a * π * cos π = -a * π.

The x-intercept is (-a * π, 0)

Area of a Stretched Spiral

We can find the area using the following:

∫ y dx = ∫ y(t) d[x(t)]

Note that:
1. y(t) = b * t * sin t
2. d[x(t)] = a * (cos t - t * sin t) dt
3. y(t) d[x(t)] = a * b * (t * sin t * cos t - t^2 * sin^2 t)

Let Φ = (t * sin t * cos t - t^2 * sin^2 t)

The integration is split into two intervals: [0, π] and [π, 2 π]. Due to the direction of the spiral, the limits are switched.

Then the area is:
A = a * b * ( ∫ (Φ dt, π , 0 ) + ∫ ( Φ dt, 2 π , π ) )
(via Hewlett Packard HP 50g and TI nSpire CX CAS)
= a * b * (π^3 / 6 + 7 * π^3 / 6)
= a * b * (4 π / 3)

Slope of a Stretched Spiral

The derivation is similar to the slope of a regular spiral.

∂x / ∂t = a * ( cos t - t * sin t )
∂y / ∂t = b * ( sin t + t * cos t )


Until next time, Eddie.



This blog is property of Edward Shore. (c) 2012

My International Casio Collection (So Far)

 Pictured: Pic 1:  Casio fx-991CN X (China)  Pic 2:  Casio fx-570SPX II Iberia (Spain) Pic 3:  Casio fx-92 Collège (France) All original co...