Showing posts with label derivative. Show all posts
Showing posts with label derivative. Show all posts

Saturday, December 20, 2025

Basic vs. Python: Helix Curve (with Casio fx-CG 50)

Basic vs. Python: Helix Curve (with Casio fx-CG 50)



Calculators Used: Casio fx-CG100, Casio fx-CG50



The Helix Curve



The helix space curve can be defined with the following set of parametric equations:



x(t) = r × cos(t)

y(t) = r × sin(t)

z(t) = c × t

where r = radius, c = spacing between the coils of the helix



We can use any measurement of length we want, such as meters, feet, or inches, as long as our measurements are consistent.



Graphing the Helix Equation



Regarding calculators, 3D parametric equations can be graphed with the Casio fx-CG 50, fx-CG 100 (independent variables s and t), and the TI-Nspire (independent variables t and u). The screenshots below is a graph of a helix with the use of the fx-CG 100 emulator (classpad.workspace.com):






Curvature, Torsion, and Arc Length of a Helix



For the formulas, let

x = r × cos(t), x’ = -r × sin(t), x’’ = -r × cos(t), x’’’ = r × sin(t)

y = r × sin(t), y’ = r × cos(t), y’’ = -r × sin(t), y’’’ = -r × cos(t)

z = c × t, z’ = c, z’’ = 0, z’’’ = 0



The variable t is the independent variable of x(t), y(t), and z(t).



Curvature



The general formula for curvature:

k² = ((x’² + y’² + z’²) × (x’’² + y’’² + z’’²) – (x’ × x’’ + y’ × y’’ + z’ × z’’)) ÷ (x’² + y’² + z’²)³



Applying to the helix:

k² = ((r² sin² t + r² cos² t + c²) × (r² cos² t + r² sin² t + 0) – (r² sin t cos t – r² sin t cos t + 0)) ÷ (r² sin² t + r² cos² t + c²)³

Note: r² sin² t + r² cos² t = r² × (sin² t + cos² t) = r²

k² = ((r² + c²) × r²) ÷ (r² + c²)³

k² = r² ÷ (r² + c²)²

k = r ÷ (r² + c²)

Note: curvature is assumed to be a positive value





Torsion



The general formula for torsion:

τ =

(x’’’ × (y’ × z’’ – y’’ × z’) + y’’’ × (x’’’ × z’ – x’ × z’’’) + z’’’ × (x’ × y’’ – x’’ × y’))

÷ ((y’ × z’’ – y’’ × z’)² + (x’’ × z’ – x’ × z’’)² + (x’ × y’’ – x’’ × y’)²)



Breaking it down into parts:



x’’’ × (y’ × z’’ – y’’ × z’) = r × sin t × (0 - -r × sin t × c) = r² × c × sin² t

y’’’ × (x’’’ × z’ – x’ × z’’’) = -r × cos t × (-r × cos t × c – 0) = r² × c × cos² t

z’’’ × (x’ × y’’ – x’’ × y’) = 0

x’’’ × (y’ × z’’ – y’’ × z’) + y’’’ × (x’’’ × z’ – x’ × z’’’) + z’’’ × (x’ × y’’ – x’’ × y’)

= r² × c × sin² t + r² × c × cos² t + 0 = r² × c



(y’ × z’’ – y’’ × z’)² = (0 - -r × sin t × c)² = r² × c² × sin² t

(x’’ × z’ – x’ × z’’)² = (-r × cos t × c – 0)² = r² × c² × cos² t

(x’ × y’’ – x’’ × y’)² = (r² sin² t + r² cos² t)² = r^4

(y’ × z’’ – y’’ × z’)² + (x’’ × z’ – x’ × z’’)² + (x’ × y’’ – x’’ × y’)²

= r² × c² × sin² t + r² × c² × cos² t + r^4 = r² × c² + r^4 = r² × (c² + r²)



Then:

τ = (r² × c) ÷ (r² × (c² + r²)) = c ÷ (r² + c²)





Arc Tangent from t = 0 to t = x



s = ∫ √(x’² + y’² + z’²) dt from t = 0 to t = x



Since:

x’² + y’² + z’² = r² sin² t + r² cos² t + c² = r² + c²



Then:

s = ∫ √(x’² + y’² + z’²) dt from t = 0 to t = x

= ∫ √(r² + c²) dt from t = 0 to t = x

= x × √(r² + c²)



To summarize, for the helix curve:

Curvature: k = r ÷ (r² + c²)

Torsion: τ = c ÷ (r² + c²)

Arc Length to x: s = x × √(r² + c²)



The code below calculates the following:

* curvature

* torsion

* arc length to 2π



Casio fx-CG50 Program HELIXFX



"HELIX: CASIO BASIC"

"RADIUS"?→R

"SPACING"?→c

"CURVATURE="

R÷(R²+C²)→K ◢

"TORISON="

C÷(R²+C²)→T ◢

"ARC LENGTH TO 2π="

2×π×√(R²+C²)→S



Python Script: helixp.py



from math import *

print("Helix: Parameters")

print("math module imported\n")

r=eval(input("radius? "))

c=eval(input("spacing? "))

k=r/(r**2+c**2)

t=c/(r**2+c**2)

print("curvature=\n",str(k))

print("torsion=\n",str(t))

print("arc length to 2pi=\n",str(s))



Example



Radius: r = 2.75

Spacing: c = 0.89



Outputs:

Curvature: 0.3291599837

Torsion: 0.1065281402

Arc length to 2π: 18.16112298



Sources



Harris, John W. and Horst Stocker. Handbook of Mathematics and Computational Science Springer: New York, NY. 2006. ISBN 978-0-387-94746-4

Lee, Sarah. “Curvature and Torsion of 3D Parametric Curves.” Number Analytics // Super Easy Data Analysis Tool for Research, May 17, 2015, www.numberanalytics.com/blog/curvature-torsion-3d-parametric-curves . Accessed 02 July 2025.

Weisstein, Eric W. "Helix." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Helix.html Accessed July 2, 2025.

Wikimedia Foundation. “Torsion of a curve.” Wikipedia. Lasted Edited January 2, 2023, https://en.wikipedia.org/wiki/Torsion_of_a_curve Accessed July 2, 2025.


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, 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, September 17, 2022

Logit and Sigmoid Functions and its Calculus

Logit and Sigmoid Functions and its Calculus



Definitions


The sigmoid function is defined as:


sigmoid(x) = 1 ÷ (1 + e^(-x))


The logit function is defined as:  


logit(p) = ln (p ÷ (1 - p))


For logit(p) to have a real number answer, 0 ≤ p < 1



Transform from the Sigmoid Function to the Logit Function


We can easily transform from the sigmoid function to the logit function.  


Let s = sigmoid(x). Then:


s = 1 ÷ (1 + e^(-x))

s * (1 + e^(-x)) = 1

s + s * e^(-x) = 1

s * e^(-x) = 1 - s

e^(-x) = (1 - s) ÷ s

e^x = s ÷ (1 - s)

x = ln(s ÷ (1 - s)) = logit(s)


To transform from the logit function to the sigmoid function, just go backwards.  



Sigmoid Function:  Derivative and Integral


Derivative


s = sigmoid(x)

s = 1 ÷ (1 + e^(-x))


Using the quotient rule of derivatives:

ds/dx = [(1 + e^(-x)) * 0 - 1 * -e^(-x)] ÷ (1 + e^(-x))^2

= -(-e^(-x)) ÷ (1 + e^(-x))^2

= -e^(-x) ÷ (1 + e^(-x))^2



Integral


s = sigmoid(x)

s = 1 ÷ (1 + e^(-x))


Multiply both sides by e^x ÷ e^x:


s * (e^x ÷ e^x) = (e^x ÷ e^x) * (1 ÷ (1 + e^(-x)))

s = e^x ÷ (e^x + 1)


Integral:

∫ e^x ÷ (e^x + 1) dx


Let u = e^x + 1.  Then du = e^x dx 

= ∫  du ÷ (u + 1) 

= ln (u + 1) + C

= ln (e^x + 1) + C


Summary:

d/dx sigmoid(x) = -e^(-x) ÷ (1 + e^(-x))^2

∫ sigmoid(x) dx = ln (e^x + 1) + C



Logit Function:  Derivative and Integral


Derivative


logit(p) = ln (p ÷ (1 - p))

L = ln (p ÷ (1 - p))


Derivative:

dL/dp =  [(1 - p) ÷ p] * d/dp ln (p ÷ (1 - p))

=  [(1 - p) ÷ p] * [(1 - p) * 1 - p * (-1)] ÷ [(1 - p)^2] 

=  [(1 - p) ÷ p] * [1 - p + p] ÷ [(1 - p)^2]

=  [(1 - p) ÷ p] * 1 ÷ (1 - p)^2

= 1 ÷ [p * (1 - p)]


Integral:

∫ ln (p ÷ (1 - p)) dp


By integration by parts:

u = ln (p ÷ (1 - p)) 

du = 1 ÷ [p * (1 - p)] dp


v = dp

v = p


Then:

∫u dv

= p * ln ( p ÷ (1 - p)) - ∫ p ÷ (1 - p) dp

= p * ln ( p ÷ (1 - p)) + ∫ -p ÷ (1 - p) dp

= p * ln ( p ÷ (1 - p)) + ln(1 - p) + C


In Summary:

d/dp logit(p) = 1 ÷ [p * (1 - p)]

∫ logit(p) dp = p * ln ( p ÷ (1 - p)) + ln(1 - p) + C


Eddie


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

Python - Lambda Week: Derivatives and Newton's Method

Python - Lambda Week: Derivatives and Newton's Method



Welcome to Python Week!  This we we're going to cover calculus and the keyword lambda.


Note:  All Python scripts presented this week were created using a TI-NSpire CX II CAS.   As of June 2022, the lambda keyword is available on all calculators (in the United States) that have Python.   If you are not sure, please check your calculator manual. 


Derivative


The Five Stencil Method is used.  Due to the approximate nature, results are rounded to 5 digits.


f'(x) ≈ (-f(x+2*h) + 8*f(x+h) - 8*f(x-h) + f(x-2*h)) / (12 * h)


h is set to 0.0001 to allow for a wide range of functions and to hopefully prevent float point overflows or underflows.  You can modify h or have the user input a value if you so wish.  


derivlam.py:  Derivative Using the Five Stencil Method


# Math Calculations

#================================

from math import *

#================================


print("The math module is imported.")

f=eval("lambda x:"+input("f(x)? "))


# input x0

x=eval(input("d/dx at x0: "))

h=.0001


# derivative, 5 stencil

d=(-f(x+2*h)+8*f(x+h)-8*f(x-h)+f(x-2*h))/(12*h)

print("round to 5 decimal points")

print("d/dx = "+str(round(d,5)))


Newton's Method


The next script finds the root of f(x) (solve f(x) = 0) with a guess.  


x_n+1 = x_n - f(x_n) / f'(x_n)


The derivative is calculated using the Five Stencil Method.   


I put a limit of 100 iterations because Newton's Method is not always perfect nor this script finds solutions in the complex plane, just the real numbers.  


newtonlam.py


# Math Calculations

#================================

from math import *

#================================

print("The math module is imported.")

print("Solve f(x)=0 to 6 places")

f=eval("lambda x:"+input("f(x)? "))


# input x0

x=eval(input("Guess? "))

h=.0001


w=1

n=1

while fabs(w)>10**(-7):

  d=(-f(x+2*h)+8*f(x+h)-8*f(x-h)+f(x-2*h))/(12*h)

  w=f(x)/d

  x-=w

  n+=1

  if n>100:

    print("iterations exceeded")

    break


if n<101:

  print("x = "+str(round(x,6)))

  print("iterations used: "+str(n))



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

TI-58/TI-59 Week: Numerical Derivative

TI-58/TI-59 Week:  Numerical Derivative


Introduction


The program estimates the numeric derivative:


d/dx f(x) = (f(x + h) - f(x)) / h


Registers used:

R01:  x

R02:  h

R03:  d/dx


Labels:

[ A ]:  store x

[ B ]:  store h

[ C ]:  calculate derivative


LBL E:  store f(x), assume x is in the display.  You can use registers R00 and R06 and above for registers.  Use Rad  ( [ 2nd ] [ - ] ) if f(x) contains trigonometric functions.  End each function with the steps =, INV SBR (RTN)


Function Listings


(step number, key code, key)


000 76 LBL

001 11 A

002 42 STO

003 01 01

004 92 INV SBR (RTN)


005 76 LBL

006 12 B

007 42 STO

008 02 02

009 92 INV SBR (RTN)


010 76 LBL

011 13 C

012 43 RCL

013 01 01

014 85 +

016 43 RCL

017 02 02

018 71 SBR

019 15 E

020 42 STO

021 03 03

022 43 RCL

023 01 01

024 71 SBR

025 15 E

026 94 +/-

027 85 +

028 43 RCL

029 03 03

030 95 =

031 55 ÷

032 43 RCL

033 02 02

034 95 =

035 42 STO

036 03 03

037 92 INV SBR (RTN)


038 76 LBL

039 15 E

...      .... ....

n-1 95 =

nnn 92 INV SBR (RTN)


Examples


f(x) = sin x;    Rad, sin


x = 0.5, h = 0.1, [ C ] returns 0.8521693479

x = 0.5, h = 1E-8, [ C ] returns 0.87755


f(x) = (1 + cos x)^1.5;   Rad, cos, +, 1, =, y^x, 1.5


x = 2, h = 0.01, [ C ] returns -1.035743295

x = 2, h = 1E-8, [ C ] returns -1.04206


f(x) = x * e^(x);   STO, 00, e^x * RCL, 00


x = 3, h = 0.01, [ C ] returns 80.84630054

x = 3, h = 1E-5, [ C ] returns 80.342648


Eddie


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


Sunday, March 20, 2022

March Calculus Madness Sweet Sixteen - Day 5: x^n ∙ √(1 + x)

 ------------


Welcome to March Calculus Madness!


------------


d/dx x^n ∙ √(1 + x)


Here we can make use the multiplication rule:

d/dx f(x) ∙ g(x) = f(x) ∙ g'(x) + f'(x) ∙ g(x)


In this case:

f(x) = x^n

g(x) = √(1 + x) = (1 + x)^(1/2)


Then:

f'(x) = n ∙ x^(n-1)

g'(x) = 1/2 ∙ (1 + x)^(-1/2)


And: 

d/dx x^n ∙ √(1 + x) 

= x^n ∙ 1/2 ∙ (1 + x)^(-1/2) + n ∙ x^(n-1) ∙ (1 + x)^(1/2)


For indefinite integrals, I will do two specific cases of n.


∫ x ∙ √(1 + x) dx   (n = 1)


Using integration by parts:


u = x,  dv = (1 + x)^(1/2) dx

du = dx,  v = 2/3 ∙ (1+x)^(3/2)



∫ x ∙ √(1 + x) dx

= 2/3 ∙ (1+x)^(3/2) ∙ x - ∫ (1 + x)^(1/2) dx

= 2/3 ∙ (1+x)^(3/2) ∙ x - 2/3 ∙ (1 + x)^(3/2) + C

= 2/3 ∙ (1 + x)^(3/2) ∙ (x - 1) + C


∫ x^2 ∙ √(1 + x) dx   (n = 2)


Let z = (1 + x)^(1/2)

dz = 1/2 ∙ (1+ x)^(-1/2) dx

2 ∙ (1+x)^(1/2) dz = dx

2 ∙ z  dz = dx


z^2 = 1 + x

z^2 - 1 = x

z^4 - 2 ∙ z^2 + 1 = x^2


∫ x^2 ∙ √(1 + x) dx   

= ∫ (z^4 - 2 ∙ z^2 + 1) ∙ z ∙ 2 ∙ z dz

= ∫ (z^4 - 2 ∙ z^2 + 1) ∙ 2 ∙ z^2 dz

= ∫ 2 ∙ z^6 - 4 ∙ z^4 + 2 ∙ z^2 dz

= 2/7 ∙ z^7 - 4/5 ∙ z^5 + 2/3 ∙ z^3 + C

= 2/7 ∙ (1 + x)^(7/2) - 4/5 ∙ (1 + x)^(5/2) + 2/3 ∙ (1 + x)^(3/2) + C

(z = (1 + x)^(1/2))


Eddie


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


Friday, March 18, 2022

March Calculus Madness Sweet Sixteen - Day 3: Derivative and Integral of x^n∙(1+x)^2

 ------------


Welcome to March Calculus Madness!


------------


x^n ∙ (1 + x)^2

= x^n ∙ (1 + 2 ∙ x + x^2)

= x^n + 2 ∙x^(n+1) + x^(n+2)


d/dx x^n ∙ (1 + x)^2 

= d/dx x^n + 2 ∙x^(n+1) + x^(n+2)

= n ∙ x^(n-1) + 2 ∙ (n+1) ∙ x^n + (n+2) ∙ x^(n+1)


∫ x^n ∙ (1 + x)^2 dx

= ∫ x^n + 2 ∙x^(n+1) + x^(n+2) dx

= x^(n+1)/(n+1) + (2 ∙ x^(n+2))/(n+2) + x^(n+3)/(n+3) + C


Eddie


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

March Calculus Madness Sweet Sixteen - Day 2: Derivative and Integral of the Absolute Value Function

 ------------


Welcome to March Calculus Madness!


------------


What is the derivative and the indefinite integral of the absolute value?


By defintion:


| x | = x when x ≥ 0, -x when x < 0


Hence:


d/dx | x | =   1 when x ≥ 0, and -1 when x < 0


and 


∫ | x | dx = x^/2 + C when x ≥ 0, abnd -x^2/2 + C when x < 0




What about |a∙x + b|?


The function |a∙x + b| hits the x-axis when:


a∙x + b = 0

a∙x = -b

x = -b/a


|a∙x + b| = 

(a∙x + b) when x ≥ (-b/a), 

and -(a∙x + b) when < (-b/a)


d/dx |a∙x + b| = 

a when x ≥ (-b/a),

and -A when < (-b/a)


∫ |a∙x + b| dx = 

A ∙ x^2/2 + C  when x ≥ (-b/a), 

and -A ∙ x^2/2 + C  when < (-b/a)



Eddie  


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

7000G Retro Month - June 26 Edition

7000G Retro Month - June 26 Edition





Introduction


Welcome to the 7000G Retro Month, which features programming for the classic Casio calculators from the mid/late 1980s:  primarily fx-7000G and fx-7500G.  Since the programming language stays similar throughout the years, programs can be translated to the fx-6300G and later graphing calculators with little to no adjustments.  Non graphic programs should be ported to the fx-4000P, fx-4500P (A), fx-3650p (II), fx-50F Plus (II), and fx-5800P with little to no adjustments.  


7000G Retro Month takes place every Saturday during June 2021.


To make text easier to type, I can going to use the following text friendly symbols for the following:


->  for →


/I for ⊿


=> for ⇒


What do you think?   Unicode or simple text equivalents?  


- - - - - - -- - -- - -


Today's subject revolves around Calculus.  Enjoy!


- - - -- - - -- - -- -- -


The three programs listed here call another program as a subroutine.  I use Prog 0 as a subroutine.  


Prog 0 


[insert f(x) here]



Example:  Prog 0 contains X^2+4.   The results gets stored in in Ans.  


Sum


S = ∑( f(x), X = A to B)


"A"? -> A

"B"? -> B

A -> X

0 -> S

Lbl 1

Prog 0

Ans + S -> S

X + 1 -> X

X≤B => Goto 1

S


Numeric Derivative - Simple Approximation


f'(x) ≈ (f(x+h) - f(x-h))/(2h),  h = tolerance (default to 10^-5)


The derivative is stored in the variable D. 


"X0"? -> Z

Z+10^-5 -> X : Prog 0 : Ans -> A

Z-10^-5 -> X : Prog 0 : Ans -> B

(A-B)÷(2 10^-5) -> D


Definite Integral - Simpson's Rule


∫ f(x) dx ≈ h/3 * (y_a + ∑(4*y_odd + 2*y_even) + y_b)

where h=(b-a)/n   (n is even)


The integral is stored in the variable I.


"A"? -> A 

"B"? -> B

"N"? -> N

A -> X

Prog 0

Ans -> I

(B-A)÷N -> D

N÷2 -> K

Lbl 2

X+D -> X : Prog 0 : I + 4 Ans -> I

X+D -> X : Prog 0 : I + 2 Ans -> I

K - 1-> K

K≠0 => Goto 2

B -> X : Prog 0 : (I - Ans)D÷3 -> I



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. 


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. 


Sunday, December 6, 2020

Calculus of the Sinc Function

Calculus of the Sinc Function


Introduction and Setup


The unnormalized Sinc function is defined as:


unsinc(x) = sin x / x


And the normalized Sinc function is defined as:


sinc(x) = sin( π x ) / ( π x )


Two things to assume about the sinc function:


1.  The function is not defined at x = 0, and


2.  The function uses radian angle measure.  


(x ≠ 0, and assume radians measure)



Let α be a real constant and define f(x) as:


f(x) = sin( α x ) / (α x)


When α = 1, f(x) becomes unsinc(x).  Likewise, when α = π, f(x) becomes sinc(x).  I am going to analyze this function f(x).


Limit


Limit of sin( α x ) / ( α x )


lim x → 0 ( sin( α x ) / ( α x ) ) → sin 0 / 0 → 0 / 0


This form of improper limit allows us to use L'Hôspital's Rule, which allows us to take the derivative of both the numerator function and denominator function:


lim x → 0 ( α * cos ( α x ) / α ) → lim x → 0 ( cos ( α x ) ) →  cos ( 0 ) → 1


Hence  lim x → 0 ( sin( α x ) / ( α x ) ) → 1


Derivative


Taking the derivative will call for use to use the quotient rule:


d/dx [n(x) / d(x)] = ( n '(x) * d(x) - n(x) * d '(x)) / (d^2(x))


Then:


d/dx [ sin( α x ) / ( α x ) ]:


n(x) = sin ( α x )

n'(x) = α * cos( α x )

d(x) = α * x 

d^2(x) = (α * x)^2

d'(x) = α



d/dx [ sin( α x ) / ( α x ) ]

= [ α * cos( α x ) * α * x - sin( α x ) * α ] / [ α^2 * x^2 ]

= [ α^2 * cos( α x ) * x - sin( α x ) * α ] / [ α^2 * x^2 ]

= [ α * cos( α x ) * x - sin( α x ) ] / [ α * x^2 ]

= cos( α x ) / x^2 - sin( α x ) / (α * x^2)


Integral


The integral of 


∫ sin( α x ) / ( α x ) dx


does not look like it can easily integrated.


Let's use the Taylor Series approach:


sin x = x - x^3 / 3! + x^5 / 5! - x^7 / 7! + x^9 / 9! + . . . 


sin( α x ) =  ( α x ) - ( α x )^3 / 3! + ( α x )^5 / 5! - ( α x )^7 / 7! + ( α x )^9 / 9! + ...


With x≠0


sin( α x ) / ( α x ) 

=  1 - ( α x )^2 / 3! + ( α x )^4 / 5! - ( α x )^6 / 7! + ( α x )^8 / 9! + ...

=  1 -  α^2 * x^2 / 3! + α^4 * x^4 / 5! - α^6 * x^6 / 7! + α^8 * x^8 / 9! + ...



Now integrate the series:


∫ sin( α x ) / ( α x ) dx

=  x - ( α^2 * x^3 ) / (3 * 3!) + ( α^4 * x^5 ) / (5 * 5!) - ( α^6 * x^7 ) / (7 * 7!) +  ( α^8 * x^9 ) / (9 * 9!) + ... + C

 =  x - ( α^2 * x^3 ) / 18 + ( α^4 * x^5 ) / 600 - ( α^6 * x^7 ) / 35280 +  ( α^8 * x^9 ) / 3265920 + ... + C


Eddie


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


Sunday, November 1, 2020

Book Review: Calculus for Middle Schoolers by Serena Swegle

 Book Review: Calculus for Middle Schoolers by Serena Swegle


Just The Facts


Calculus for Middle Schoolers


Author:  Serena Swegle


Publisher:  Sunhut Publishing


Cost:  $26.50 for Paperback, $9.99 for Kindle (as of 10/23/2020)


Link:  https://www.amazon.com/Calculus-Middle-Schoolers-Serena-Swegle/dp/057871275X/ref=sr_1_3?dchild=1&keywords=Calculus+for+Middle+Schoolers&qid=1603471676&sr=8-3


Topics Covered


The number e (2.718281828...)


The common logarithm  (base 10)


The natural logarithm (base e)


Trig Functions (sine, cosine, tangent)


Sums 


Limits


Derivative - the derivative of a polynomial


Integral - the integral of a polynomial


The Derivative and Integral of e^x


An Introduction to Calculus 


The target audience is middle school students.  However, book serves as a great introduction to calculus for high school and college students who are taking calculus for the first time.  The book gives a simple, concrete introduction to various subjects, in an easy-to-read narrative.  Calculus is a complex subject, and this book allows readers, who may be intimidated about the subject, to develop a understanding.   


I would recommend this book to be read prior to the student's first calculus class.   The book can be read in one or two days, but I feel it was meant to read as one chapter a time per day or week.   


Verdict


Swegle's book is well written, in a concise language.  The chapter covers one concept at the time, which serves as a great introduction to a rich subject.   The examples are simple and apply closely to the text.   I wish Swegle put a summary of all the topics covered at the end of the book as a wrap up.  Otherwise, I recommend this book for educators and parents.   For those who have the Kindle app, $9.99 is a good price point.  Recommended.


Thank you, Serena for recommending this book for me to review.  


Eddie


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


HP 48G Collection

 HP 48G Collection  Contents:  Intensity of Spherical Light Source  Speed of Light in Dry Air  Pressure of Air  Earth's Gravity a...