Showing posts with label sum. Show all posts
Showing posts with label sum. Show all posts

Sunday, February 15, 2026

Casio fx-3650P vs. Casio fx-3650P II: Programs


Here are four programs that are done with both the fx-3650P and fx-3650P II to illustrate some programming similarities and differences.


When we start a new program with the fx-3650P II, we are prompted to the choose the appropriate mode at the beginning:


COMP (main calculation with real numbers)

CMPLX (complex numbers, primarily complex number arithmetic)

SD (single-derivation mode, single-variable statistics)

REG (regression mode, two-variable statistics)

BASE (base conversions and Boolean logic)


Left:  Casio fx-3650P (2002), Right:  fx-3650P II (2013)


Program 1: Exponential Distribution


This program calculates:


PDF: e^(-X ÷ A)

CDF (lower tail): 1 - e^(-X ÷ A)


where:

A = 1/λ parameter (i.e. average waiting time, time for an event to occur/fail/succeed)

X = time parameter


fx-3650P, 25 bytes:


? → A : ? → X :

e(-X ÷ A) ÷ A ◢

1 – e(-X ÷ A)


fx-3650P II, 25 bytes:


? → A : ? → X :

e^(-X ÷ A) ÷ A ◢

1 – e^(-X ÷ A)


Example 1:

Inputs: A = 100, X = 50

Outputs: 6.065306597E-3 (*10^-3), 0.39346934


Example 2:

Inputs: A = 50, X = 3

Outputs: 0.01883529, 0.058235466


Program 2: Using Newton’s Method to get the real root of the cubic equation that is closest to zero:


x^3 + A * x^2 + B * x + C = 0


Using Newton’s Method:


x1 = x0 – f(x0) / f’(x0) [ let y = f(x0) / f’(x0) ]


x1 = x0 - (x^3 + A * x^2 + B * x + C) / (3 * x^2 + 2 * A * x + B)



fx-3650P, 72 bytes:


? → A : ? → B : ? → C : 0 → X :

Lbl 0 :

(X³ + AX² + BX + C) ÷ (3X² + 2AX + B) → Y :

√(Y²) → D :

X – Y → X :

D ≥ 1E-8 ⇒ Goto 0 : X


√(Y²) returns Abs(Y) in Comp mode.

D is set up to be the control variable, where

D = abs((x^3 + A * x^2 + B * x + C) / (3 * x^2 + 2 * A * x + B))



fx-3650PII, 67 bytes:


? → A : ? → B : ? → C : 0 → X : 1 → Y :

While Abs(Y) ≥ 1E-8 :

(X³ + AX² + BX + C) ÷ (3X² + 2AX + B) → Y :

X – Y → X :

WhileEnd: X


We could have used the derivative function (d/dx) but typing out the derivative took less room.


Example 1: X³ + 2X² – 5X + 4 = 0

Inputs: A = 2, B = -5, C = 4

Output: -3.663076827


Example 2: X³ – 3X² + 9X + 6 = 0

Inputs: A = -3, B = 9, C = 6

Output: -0.5481911635



Program 3: Sum of the polynomial: Σ((AX + B)^C, X = 1 to Y)


fx-3650P, 57 bytes:


0 → M : ? → A : ? → B : ? → C : ? → Y : 1 → X :

Lbl 0 :

(AX + B)^C M+ : X + 1 → X : X > Y ⇒ Goto 1 : Goto 0 :

Lbl 1 : M



fx-3650PII, 41 bytes:


0 → M : ? → A : ? → B : ? → C : ? → Y : 1 → X :

For 1 → X To Y : (AX + B)^(C) M+ : Next : M



Example 1: Σ((5X – 3)^2, X = 1 to 8)

Inputs: A = 5, B = -3, C = 2, Y = 8

Output: 4092



Example 2: Σ((2X + 1)^3, X = 1 to 10)

Inputs: A = 2, B = 1, C = 3, Y = 10

Output: 29160


Program 4: Complex Roots of Unity


x^n = 1


where:

x = cos(2 * m * π / n) + i * sin(2 * m * π / n) = r * e^(2 * m * i / n)

m = 0 to n – 1, i = j = √-1


fx-3650P, 47 bytes:


Switch to complex mode. The CMPLX indicator will be displayed but not shown as a step.


Rad : ? → A : 0 → B :

Lbl 0 :

cos(2 B π ÷ A) + i × sin(2 B π ÷ A) ◢

1 + B → B : A > B ⇒ Goto 0 : 1


We must have an else condition when the jump command is used, that is why the second one is there. Also, that one “indicates” the end.


fx-3650PII, 34 bytes:


Rad : ? → A :

For 0 → B To A :

cos(2 B π ÷ A) + i × sin(2 B π ÷ A) ◢

Next : 1


The second one “indicates” the end and can be omitted.


In complex mode, the real and imaginary parts are displayed on part at a time. A settle R←→I indicator displays at the right hand side of the screen. Switch between seeing the parts by pressing [ SHIFT ] [ EXE ].


Example 1: x^3 = 1

Input: A = 3

Outputs:

1 + 0 i

-0.5 + 0.866025403 i

-0.5 - 0.866025403 i


Example 2: x^5 = 1

Input: A = 5

Outputs:

1 + 0 i

0.309016994 + 0.951056516 i

-0.809016994 + 0.587785252 i

-0.809016994 - 0.587785252 i

0.309016994 - 0.951056516 i


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, January 25, 2025

Casio fx-991CW: The Spreadsheet

Casio fx-991CW: The Spreadsheet



Welcome to the Casio fx-991CW segment, which is planned to be every last Saturday of the month for 2025!



Spreadsheet


Screenshots are used the classpad.net website which contains the fx-991CW emulator.


The Casio fx-991CW has a Spreadsheet mode. The spreadsheet is 45 rows and 5 columns. The spreadsheet has a memory capacity of 2,380 bytes. The spreadsheet has basic spreadsheet functions. Data is saved as long as the calculator is in the Spreadsheet mode. Individual results can be stored in the calculator’s memory registers A, B, C, D, E, F, x, y, and z.


The spreadsheet of the fx-991CW can only contain numerical data. There are no labels.


Auto Calc is assumed to be on.


fx-991CW:  Selection of the Spreadsheet mode



Sum, Mean, and Count of a Range of Cells


The sum of a range: = Sum( α# : β# )

The arithmetic mean of all the numbers in a range: = Mean( α# : β# )

The count of all cells that have a value stored: = Sum( α# : β# ) ÷ Mean( α# : β# )


The count has to be constructed because there is no count function in the fx-991CW. Since Sum is Σx and Mean is Σx / n. Hence count, or n, is: Count = Sum / Mean = Σx / (Σx / n) = Σx * (n / Σx) = n.


The Sum, Count, and the colon character ( : ) are found in the Catalog.


The Catalog key in the Spreadsheet mode

Example:



A

B

1

45

88

2

25

76

3

93

39


fx-991CW:  Sum, Mean, and Count – Spreadsheet


Min, Max, and Statistical Range of a Range of Cells


The minimum value of a range of cells: = Min( α# : β# )

The maximum value of a range of cells: = Max( α# : β# )

The statistical range of a range of cells: = Max( α# : β# ) - Min( α# : β# )


Example:



A

B

1

45

88

2

25

76

3

93

39


fx-991CW:  Min, Max, and Range - Spreadsheet




Multiply a Range of Cells with a Constant Rate



We can apply a formula to a range of cells through the Tools menu. The Fill Formula dialogue:

Fill Formula

Fill = (start the formula with the cell you are currently at)

Range : α# : β#

> Confirm


To make a cell absolute, attack a dollar sign, to both the column letter and row number. The dollar sign ( $ ) is in the Catalog.


Example:



A

B

1


0.85

2

59.95


3

42.75


4

73.95



fx-991CW:  multiplying a range with a constant



Storing a Cell’s Value


Exiting the Spreadsheet mode or turning the calculator off will erase the contents of the Spreadsheet. A way to store values permanently is to store the cell’s contents in one of the variables (A – F, x, y, z). To store a value:


1. Go to the cell.

2. Press the [ VARIABLE ] button.

3. Select a variable and press [ EXE ].

4. Select Store.


The value is now stored in the variable, which can be used in other modes. Unlike the spreadsheet, values stored in values are kept until a reset.


fx-991CW:  storing a value in a variable



I hope you find this helpful.


Until next time,


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.

Saturday, September 28, 2024

TI-84 CE and TI-86: Matrix Row Statistics

TI-84 CE and TI-86: Matrix Row Statistics


Introduction


The program MROWST will take a matrix and a desired row and calculate three statistics points:


* Sum of the row

* Mean of the row

* Difference Vector: row – mean for each element


TI-84 CE Program MROWST


Matrices used: [ J ] (entry matrix), [ I ] (difference vector)


Input “MATRIX? “, [ J ]

Input “ROW? “, R

dim([ J ])

Ans(2) → D

0 → S

For(I, 1, D)

S + [ J ](R, I) → S

End

S / D → M

{1, D} → dim([ I ])

For(I, 1, D)

[ J ](R, I) – M → [ I ](1, I)

End

ClrHome

Disp “SUM: “ + toString(S)

Disp “MEAN: “ + toString(M)

Disp “DIFF VECTOR:”

Pause [ I ]


TI-86 Program MROWST


Matrices used: MJ (entry matrix), MD (difference vector), mone (vector of ones)


Input “Matrix? “, MJ

Input “Row? “, R

dim MJ

Ans(2) → D

D → dim mone

Fill(1, mone)

dot(mone, MJ(R)) → S

S / dim mone → M

MJ(R) - (M * mone) → MD

ClLCD

Disp “Sum:”, S

Disp “Mean:”, M

Disp “Diff Vector:”

Pause MD


Example


Matrix:

[ [ -9, -4, -1, -9, 4 ]

[ -9, -7, -4, -4, 9 ]

[ 7, 1, -9, -7, 8 ] ]


Row 1:

Sum: -1

Mean: -0.2

Difference Vector: [ 9.2, -3.8, -0.8, -8.8, 4.2 ]


Row 2:

Sum: -15

Mean: -3

Difference Vector: [ -6, -4, -1, -1, 12 ]


Row 3:

Sum: 0

Mean: 0

Difference Vector: [ 7, 1, -9, -7, 8 ]



Source:

Stuerke, Cecil. “Demonstration of Principal Component Analysis on TI-86” IEEE 2008



Eddie


Quick update: Starting October 5, 2024, my schedule will allow me to blog once a week. Regular posts will go live every Saturday. Thank you for your support and compliments. I wish you all well.



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, February 11, 2023

Sum and Product Problem with the Casio fx-4000P

Sum and Product Problem with the Casio fx-4000P



The Sum and Product Problem


For the numbers a and b with the sum s, and product p:


a + b = s

a * b = p


Let's find a solution for a and b:


a + b = s

b = s - a


a * b = p

a * (s - a) = p

a * s - a^2 = p

0 = a^2 - a * s + p


a = (s ± √(s^2 - 4 * p))/2


Then:


b = s - a

= s -  (s ± √(s^2 - 4 * p))/2

= (2*s)/2 -  (s ± √(s^2 - 4 * p))/2

= (2*s -s ±√(s^2 - 4 * p))/2

=  (s ± √(s^2 - 4 * p))/2


Note that addition and multiplication are communitive.  


Without loss of generality, let:


a = (s + √(s^2 - 4 * p))/2


b = (s - √(s^2 - 4 * p))/2


Verification:


a + b 

= (s + √(s^2 - 4*p))/2 + (s - √(s^2 - 4*p))/2

= (s + √(s^2 - 4*p) + s - √(s^2 - 4*p))/2

= (2 * s)/2

= s


a * b

= (s + √(s^2 - 4 * p))/2 * (s + √(s^2 - 4 * p))/2

= (s/2)^2 - (√(s^2 - 4 * p)/2)^2

= s^2/4 - (s^2 - 4 *p)/4 

= (s^2 - s^2 + 4 * p)/4

= (4 * p)/4

= p



Casio fx-4000P Program:  Sum and Product Problem


This program can be adopted to many programming and graphing calculators. 


Program:


"A+B=":?→S:

"AB=":?→P:

(S+√(S²-4P))÷2→A◢

S-A→B



Examples


S:  Sum

P:  Product


Example 1:

S = 12, P =32;

Results: 8, 4


Example 2:

S = 8, P = 15;

Results: 5, 3



Enjoy!  Until next time,


Eddie


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

Lists in Numworks - Version 19.2

Lists in Numworks - Version 19.2


Introduction


In Version 19,  lists were added as an object in the Numworks calculator.  We can define and name lists with any values that we want. Lists are designated by the brackets { }. 


*   The values can be real number, complex numbers, numbers with units, scientific constants, and combinations of those types.   What is not allowed in lists are strings and matrices.


*  The indexing of lists starts with 1.   We can call a list's elements by the parenthesis after the list name.  For example,  xlist(10) recalls the 10th element of the list xlist.


*  { f(k) }_k≤value generates a list of f(k) from k=1 to value, step 1.   The variable can be almost any variable you want, except e and i.  e is designated as the exponential constant (about 2.71828...) and i is designated as the imaginary number √-1.   The limits are strictly from 1 to value.


*  Once a user defined list is created, the individual values cannot be changed.   Furthermore, there are no augment or delete commands.  In this sense, user defined lists acts like tuples in Python.


*  Lists can be recalled in the Statistics and Regression apps.   The system named lists V#, X#, and Y# are updated accordingly.


* Defining a list of random values will always change the randomized values every time a user defined list is recalled.  


Please note that this is for Version 19.2.  


Screenshots are captured using the Numworks Emulator on July 10, 2022:  www.numworks.com/emulator
















Note:  Casio fx-991EX Week - September 5, 2022 to September 9, 2022 


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, November 6, 2021

TI-92 Plus and TI-Nspire CX II: List Filters

TI-92 Plus and TI-Nspire CX II:  List Filters




For this particular post, I also have a TI-Nspire CX II CAS document which can be downloaded here:  https://drive.google.com/file/d/1Rm5vIWdUMg5OEyXi4VecNfuIGdiGRtan/view?usp=sharing


The functions are public and are available in the catalog.  Examples and syntax are included.  


The Filters


filters(list, criteria): filters out a list 

sumfilt(list, criteria): sum of selected elements of a list

avgfilt(list, criteria): arithmetic average of elements of a list

prdlist(list, criteria): product of selected elements of a list

dimfilt(list, criteria): returns a count of list elements that fit a criteria


This is similar to Excel functions filter, sumifs, averagefits, and countifs; there is no productifs in Excel.  


The criteria is a string, using x as a variable.  Examples:

"x<10": select elements less than 10

"x≥20": select elements greater than or equal to 20

"10<x and x<20": select elements between 10 and 20, not including 10 or 20

"10≤x and x≤20": select elements between 10 and 20, including 10 or 20


TI-92 Plus Functions: Filters


Note:  I am using the symbol [| for comment; in the program editor, select F2, option 9.  


TI-92 Plus Function:  filters


filters(list1,cr) 

Func

[| list, criteria string with x

[| EWS 2021-08-13

[| filter function

Local list2,d,i,t,x

{}→list2

dim(list1)→d

For i,1,d

expr(cr)|x=list1[i]→t

If t Then

augment(list2,{list1[i]})→list2

EndIf

EndFor

Return list2

EndFunc


TI-92 Plus Function: sumfilt


sumfilt(list1,cr) 

Func

[| list, criteria string with x

[| EWS 2021-08-14

[| sum-if filter function

Local list2,d,i,t,x

{}→list2

dim(list1)→d

For i,1,d

expr(cr)|x=list1[i]→t

If t Then

augment(list2,{list1[i]})→list2

EndIf

EndFor

Return sum(list2)

EndFunc


TI-92 Plus Function: avgfilt


avgfilt(list1,cr) 

Func

[| list, criteria string with x

[| EWS 2021-08-14

[| average-if filter function

Local list2,d,i,t,x

{}→list2

dim(list1)→d

For i,1,d

expr(cr)|x=list1[i]→t

If t Then

augment(list2,{list1[i]})→list2

EndIf

EndFor

Return sum(list2)/(dim(list2))

EndFunc


TI-92 Plus Function:  prdfilt


prdfilt(list1,cr) 

Func

[| list, criteria string with x

[| EWS 2021-08-14

[| product-if filter function

Local list2,d,i,t,x

{}→list2

dim(list1)→d

For i,1,d

expr(cr)|x=list1[i]→t

If t Then

augment(list2,{list1[i]})→list2

EndIf

EndFor

Return product(list2)

EndFunc


TI-92 Plus Function:  dimfilt


dimflt(list1,cr) 

Func

[| list, criteria string with x

[| EWS 2021-08-13

[| count-if filter function

Local list2,d,i,t,x

{}→list2

dim(list1)→d

For i,1,d

expr(cr)|x=list1[i]→t

If t Then

augment(list2,{list1[i]})→list2

EndIf

EndFor

Return dim(list2)

EndFunc


Examples:


list0 = {2,4,5,6,9,10,11,13,14,15,18}


filters(list0,"x≤10"):  {2,4,5,6,9}

filters(list0,"5≤x and x≤15"):  {5,6,9,10,11,13,14,15}


sumfilt(list0,"x≤10"):  36

sumfilt(list0,"5≤x and x≤15"):  83


avgfilt(list0,"x≤10"):  6

avgfilt(list0,"5≤x and x≤15"):  83/8


prdfilt(list0,"x≤10"):  21600

prdfilt(list0,"5≤x and x≤15"):  2700


dimfilt(list0,"x≤10"):  6

dimfilt(list0,"5≤x and x≤15"):  8


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. 


Earth's Radius by Latitude

Earth's Radius by Latitude Introduction: Calculating the Earth’s Radius In quick, general calculations, we assume that the...