Showing posts with label polynomials. Show all posts
Showing posts with label polynomials. Show all posts

Saturday, April 26, 2025

Casio fx-991CW: The Inequalities Mode

Casio fx-991CW: The Inequalities Mode



Solving Inequalities


The Casio fx-991CW, along with other high-end scientific calculators from Casio has an Inequalities mode.


The inequalities mode solves quadratic, cubic, and quartic polynomials. The mode works similar to Equation-Polynomial module. Below is an example (all screenshots were created in Casio’s classpad.net website):


Casio fx-991CW: Introduction to the Inequality Mode


The Inequalities mode can assist in calculus and geometry problems.



Circle Problem


Task: Find valid points (x, y) that fit in the circle:


x^2 / 3 + y^2 / 6 = 1


Step 1: We can use the Inequalities mode to find the allowed x values.


Start by solving for y:

x^2 / 3 + y^2 / 6 = 1

6 × (x^2 / 3 + y^2 / 6) = 1 × 6

2 × x^2 + y^2 = 6

y^2 = 6 – 2 × x^2

y = √(6 – 2 × x^2)


For the equation to be “valid”, or to not return complex numbers, find all x where 6 – 2 × x^2 is not negative.


6 – 2 × x^2 ≥ 0


We find that the allow range is -√3 ≤ x ≤ √3.


Step 2: Store the Equations


We can do define f(x) in any mode. To do this, press [ f(x) ], select Define f(x). Press [ OK ] to store the function. The fx-991CW allows for two functions, f(x) and g(x).


In this example, we defined f(x) and g(x) as follows:


f(x) = √(6 – 2 × x^2)

g(x) = -f(x)


Step 3: Use the Table mode to find values in the appropriate range.


Set the Table Type as f(x)/g(x). Set the Table Range as Start: -√(3), End: √(3), Step: 2×√(3)÷5


Table:


x ≈

f(x) ≈

g(x) ≈

1

-1.732

0

0

2

-1.0392

1.9595

-1.9595

3

-0.3464

2.4

-2.4

4

0.3464

2.4

-2.4

5

1.0392

1.9595

-1.9595

6

1.732


0

0






The Area Between f(x) and x ≥ 0


Find the area between the curves:

f(x) = -x^4 + 2 × x^3 + 25 × x^2 – 26 × x – 120 and x ≥ 0.


Step 1: Find the boundaries.


With the Inequalities mode, we can find the boundaries and intersection points where f(x) ≥ 0. We find that: -4 ≤ x ≤ -2 and 3 ≤ x ≤ 5. Write down these results. The area will be in the intervals [-4, -2] and [3, 5].


Confession: I ultimately chose this function because of its integer roots. Unfortunately we are not able to store coefficients or roots in variables directly on the fx-991CW to variables.


Step 2: Store the Equations


Store -x^4 + 2 × x^3 + 25 × x^2 – 26 × x – 120 to f(x). This will allow us to save keystrokes while calculating the area.


Step 3: Calculate the Area in the Calculate Mode


Use the integral function from the Catalog - Func Analysis menu.


∫( f(x), -4, -2) + ∫( f(x), 3, 5)


The area is: 1928/15 ≈ 128.5333333

Hint: To always get a decimal approximation (skipping the exact result), press [SHIFT] [ = ] ( ≈ ).




Another example:

Find the area between the curves:

f(x) = x^3 + 8 × x^2 – 3 and x ≥ 0.


The boundaries are: -7.952564217 ≤ x ≤ -0.63837179, 0.5909359176 ≤ x


Which means the intervals are: [ -7.952564217, -0.63837179] and [ 0.5909359176, ∞). We can see that the area given these boundaries, the area will approach infinity.  


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.


Sunday, September 29, 2024

TI-30Xa Algorithm: Synthetic Division

TI-30Xa Algorithm:  Synthetic Division



Introduction


Synthetic division is a fairly simple division algorithm that divides a polynomial by the nominal (x-a):


p(x) / (x  - c) where


p(x) = a_n * x^n + a_n-1 * x^(n-1) + a_n-2 * x^(n - 2) + … + a_1 * x + a_0

c = a numerical constant


the result, q(x), is a polynomial of order n-1:


q(x) = b_n-1 * x^(n-1) + b_n-2 * x^(n - 2) + … + b_1 * x + b_0 + b_r / (x - c)

b_r = remainder term


where 


b_n-1 = a_n

b_i-1 = b_i  * c + a_i for i = n-2 down to r (“-1”, see the example below)  


For example, for the polynomial:


p(x) = a3 * x^3 + a2 * x^2 + a1 * x + a0


q(x) = p(x) / (x - c) 


p(x) has the order n = 3, so q(x) will have the order n = 3 - 1 = 2:


q(x) = b2 * x^2 + b1 * x + b0 + br / (x - c)


b2 = a3

b1 = b2 * c + a2

b0 = b1 * c + a1

br = b0 * c + a0  (the algorithm stops, this is the remainder term)


If br = 0, the x - c divides p(x) evenly, and x = c is a root of p(x).  


Note: for any “missing” terms, fill the term with 0.   

Example:  x^3 + 4 * x - 5 becomes x^3 + 0 * x^2 + 4 * x - 5.



Calculator Algorithm


  1. Store c in one of the memory registers 1, 2, or 3.   We’ll call this memory register m for the purpose of the blog.

  2. Note the first coefficient of q(x):  a_n

  3. Compute the rest of the coefficients as follows:  [ × ] [ RCL ] m [ + ] a_ni [ = ]



Examples


Remember:  m is memory register 1, 2, or 3, your choice.  


Example 1:  (21 * x^2 + 42 * x + 144) / (x - 12) 


c = 12

a2 = 21

a1 = 42

a0 = 144


b1 = a2 = 21


12 [ STO ] m

Enter 21


b0:

[ × ] [ RCL ] m [ + ] 42 [ = ]

Result:  294


br:

[ × ] [ RCL ] m [ + ] 144 [ = ]

Result:  3672

Stop.


q(x) = 21 * x + 294 + 3672 / (x - 12)



Example 2:  (2 * x^3 + x - 3) / (x - 3) = (2 * x^3 + 0 * x^2 + x - 3) / (x - 3)


c = 3

a3 = 2

a2 = 0

a1 = 1

a0 = -3


b2 = a3 = 2

3 [ STO ] m

Enter 2


b1:

[ × ] [ RCL ] m [ + ] 0 [ = ]

Result:  6


b0:

[ × ] [ RCL ] m [ + ] 1 [ = ]

Result:  19


br:

[ × ] [ RCL ] m [ + ] 3 [ +/- ]  [ = ]

Result:  54


q(x) = 2 * x^2 + 6 * x + 19 + 54 / (x - 3)


Example 3:  (4 * x^3 + 8 * x^2 - 5 * x + 3) / (x + 2)


c = -2

a3 = 4

a2 = 8

a1 = -5

a0 = 3


b2 = a3 = 4


2 [ +/- ] [ STO ] m 

Enter 4


b2:

[ × ] [ RCL ] m [ + ] 8 [ = ]

Result:  0


b3:

[ × ] [ RCL ] m [ + ] 5 [+/-] [ = ]

Result:  -5


br:

[ × ] [ RCL ] m [ + ] 3 [ = ]

Result:  13


q(x) = 4 * x^2 - 5 + 13 / (x + 2)


I think this is a fundamental algorithm for students and math enthusiasts to learn, and it’s fairly simple to get a hang of it. 


Until next time,


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.


  

Sunday, February 25, 2024

Casio Graphing Calculators: Equation Variables

Casio Graphing Calculators: Equation Variables



Introduction





Most modern Casio graphing calculators have an Equation solver mode that solves linear systems (Simultaneous), polynomials (Polynomial), and general equations.


To find run Equation mode, press [ MENU ] { A }*.


(*Equation mode is currently option A (fx-9750GIII, fx-CG 50, fx-CG 10/20, fx-9860 Slim))



Simultaneous Equations: SimRes and SimCoef




The simultaneous equation mode solves linear systems up to 6 x 6. The coefficients of the equations are stored in the variable Sim Coef (labeled SimCoef in VARS-EQUATION menu) while the results are stored in the variable Sim Result (labeled SimRes).



Polynomials: PlyRes and PlyCoef




The polynomial equation mode solves polynomials with real coefficients up to degree 6 (3 in early graphing models). The coefficients of the polynomial are stored in the variable Poly Coef (labeled PolyCoef in the VARS-EQUATION menu) while the results are stored in the variable Poly Result (labeled PolyRes).



Accessing Equation Variables Outside of Equation Mode





The four equation variables can be recalled by pressing [ VARS ], [ F6 ] { > }, [ EQUA ] { F3 }.


F1: SimRes (S·Rlt on older models)

F2: SimCoef (S·Cof on older models)

F3: PlyRes (P·Rlt on older models)

F4: PlyCof (P·Cof on older models)


The four variables are read-only matrices. We can not store values or information to read-only variables.


If we want to extract specific values from the equations variables, we must store them into a Matrix variable (A – Z, θ). For example, to retrieve the number from the 1st row and column of Sim Coef:


Sim Coef → Mat A

Mat A[1,1]


We can execute operations on equation variables. An interesting check is to run the simultaneous solver of the variable by typing:


Rref Sim Coef


and reading the last column.


Until next time,


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.




Saturday, July 29, 2023

DM41 and HP 41C: Lagrangian Interpolation

DM41 and HP 41C:  Lagrangian Interpolation



Introduction


The program LARG estimates a point (x, y) using the Lagrangian interpolating polynomial below:


y =

  y0 * (x - x1) * (x - x2) ÷ ((x0 - x1) * (x0 - x2))

  + y1 * (x - x0) * (x - x2) ÷ ((x1 - x0) * (x1 - x2))

  + y2 * (x - x0) * (x - x1) ÷ ((x2 - x0) * (x2 - x1))


The polynomial has three set points that defined points (x0, y0), (x1, y1), and (x2, y2).  


This program is based off the Interpolations program for the HP 67 and HP 97 calculators.  (see source below)



Swiss Micros DM41/HP41C Program LARG


01  LBL áµ€ LARG

02  SF 27

03  CF 00

04  STOP


05  LBL A

06  STO 01

07  x<>y

08  STO 04

09  RTN


10  LBL B

11  STO 02 

12  x<>y

13  STO 05

14  RTN


15  LBL C

16  STO 03

17  x<>y

18  STO 06

19  CF 00

20  RTN


21  LBL D

22  STO 00

23  FS? 00

24  GTO 15

25  RCL 04

26  RCL 05

27  -

28  RCL 04

29  RCL 06

30  -

31  *

32  ST/ 01  

33  RCL 05

34  RCL 04

35  -

36  RCL 05

37  RCL 06

38  -

39  *

40  ST/ 02

41  RCL 06

42  RCL 04

43  -

44  RCL 06

45  RCL 05

46  - 

47  *

48  ST/ 03

49  SF 00


50  LBL 15

51  RCL 00

52  RCL 05

53  -

54  STO 07

55  RCL 00

56  RCL 06

57  -

58  STO 08

59  *

60  RCL 01

61  *

62  RCL 00

63  RCL 04

64  -

65  STO 09

66  RCL 08

67  *

68  RCL 02

69  *

70  +

71  RCL 09

72  RCL 07

73  *

74  RCL 03

75  *

76  +

77  STOP


78  LBL E

79  CF 27

80  CF 00

81  END



Memory Registers Used:


R01 = y0

R02 = y1

R03 = y2


R04 = x0

R05 = x1

R06 = x2


R07, R08, R09


Flag 0 is used to allow for multiple calculations.


Flag 27 is the User keyboard flag.   


Label 15 is a local label.  Any labels 15-99 are local labels that can be placed anywhere in the program.  


ST/ is STO÷.


STOP is the R/S key.  



Instructions


The program LARG is set up to use the USER keyboard as follows:


Key A ([Σ+]):  Enter the point (x0, y0).  Type x0, press [ENTER], type y0, press [Σ+].


Key B ([1/x]):  Enter the point (x1, y1).  Type x1, press [ENTER], type y1, press [1/x].


Key C ([√]):  Enter the point (x2, y2).  Type x2, press [ENTER], type y2, press [√].


Key D ([LOG]):  Calculate y.   


Key E ([LN]):  Exits the program and turns off the user keyboard.




Example



An estimated polynomial runs through the points (1, 7), (3, 9), and (5, 4).   Estimate the point at x = 2 and x = 6.


XEQ LARG


1 ENTER 7 [Σ+] (A)

3 ENTER 9 [1/x] (B)

5 ENTER 4 [√] (C)


2 [LOG] (D) returns about 8.8750


6 [LOG] (D) returns about -1.1250


When done, press [LN] (E) to exit or turn off the user keyboard.



Source


HP 67/97 Math Pac I.  Hewlett Packard.  Corvallis, OR.  1976



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. 


Sunday, March 5, 2023

Radio Shack EC-4000 (equiv. of TI-57): Program Library

Radio Shack EC-4000 (equiv. of TI-57):   Program Library





Radio Shack EC-4000/TI-57:  Horner's Method


Let's start with a demonstration of Horner's Method, which allows a quick evaluation of polynomials.   For a quadratic polynomial:


p(x) = a * x^2 + b * x + c = x * (a * x + b) + c



The program demonstrates an example polynomial:


p(x) = 3 * x^2 - 4 * x + 9 = x * (3 * x -  4) + 9



Step:  Key Code [ Key ]

00: 32, 1 [ STO 1 ]

01:  55 [ × ]

02:  03  [ 3 ]

03:  65  [ - ]

04:  04 [ 4 ]

05:  85  [ = ]

06:  55 [ × ]

07:  33, 1 [ RCL 1 ]

08:  75  [ + ]

09:  09  [ 9 ]

10:  85 [ = ]

11:  81  [ R/S ]

12:  71  [ RST ]


Examples:

p(0) = 9

p(5) = 64

p(9) = 216


Horner's Method can apply to higher order polynomials.  




Radio Shack EC-4000/TI-57:  Permutation and Factorial



This is to add two of the common probability functions that are missing with on the calculator.  


nPr = n! / (n - r)!


If n = r, then nPn = n!


Store n in R0 (register 0), r in R1 (register 1), then run the program (RST, R/S).


Other registers used:  R2:  nPr,  R7:  n-r+1 


Note that R7 is also the t-register.  


Step:  Key Code [ Key ]

00:  01  [ 1 ]

01:  32, 2  [ STO 2 ]

02:  33, 0  [ RCL 0 ]

03:  65   [ - ]

04:  33, 1  [ RCL 1 ]

05:  75  [ + ]

06:  01  [ 1 ]

07:  85  [ = ]

08:  32, 7 [ STO 7 ]

09:  86, 5 [ LBL 5 ]

10:  33, 0 [ RCL 0 ]

11:  39, 2  [ Prd 2 ]

12:  01  [ 1 ]

13:  -34, 0 [ INV SUM 0 ]

14:  33, 0 [ RCL 0 ]

15:  76  [ x≥t ]

16:  51, 5 [ GTO 5 ]

17:  33, 2 [ RCL 2 ]

18:  81  [ R/S ]

19:  71  [ RST ]



Examples:

n = 6, r = 6:  6P6 = 6! = 720

n = 5, r = 3:  5P3 = 60

n = 11, r = 6:  11P6 = 332,640

n = 52, r = 5:  52P5 = 3.118752 * 10^8



Radio Shack EC-4000/TI-57:  Snell's Law


There are two subroutines in this program listing.  Subroutines accessed by the [ SBR ] key.  


Snell's Law describes, among other things, the relationship between index of refraction of a medium (n) and refraction angle of the direction of light (Θ) is stated by:


n1 * sin(Θ1) = n2 * sin(Θ2)



Subroutine 1:  Solve for n2.  n2 = (n1 * sin(Θ1)) / sin(Θ2)


Subroutine 2:  Solve for Θ2.  Θ2 = arcsin( n1 * sin(Θ1) / n2 )


The registers used are:  R1 = n1, R2 = n2,  R3 = Θ1, R4 = Θ2


Step:  Key Code [ Key ]


// Solve for n2

00:  86, 1  [ LBL 1 ]

01:  50  [ DEG ]

02:  33, 1 [ RCL 1 ]

03:  55  [ × ]

04:  33, 3  [ RCL 3 ]

05:  28  [ SIN ]

06:  45  [ ÷ ]

07:  33, 4 [ RCL 4 ]

08:  28  [ SIN ]

09:  85  [ = ]

10:  32, 2 [ STO 2 ]

11:  81  [ R/S ]


// Solve for Θ2

12:  86, 2  [ LBL 2 ]

13:  50  [ DEG ]

14:  33, 1 [ RCL 1 ]

15:  55  [ × ]

16:  33, 3 [ RCL 3 ]

17:  28  [ SIN ]

18:  45  [ ÷ ]

19:  33, 2 [ RCL 2 ]

20:  85 [ = ]

21:  -28  [ INV SIN ]

22:  32, 4 [ STO 4 ]

23:  81 [ R/S ]


Examples:


Solve for n2:  n1 = 1.000293 (air), Θ1 = 30°, Θ2 = 19°

1.000293 STO 1

30 STO 3

19 STO 4

GSB 1

Result:  n2:  1.5362267


Solve for Θ2:  n1 = 1.000293 (air), Θ1 = 30°, n2 = 1.333 (water)

1.000293 STO 1

30 STO 3

1.333 STO 2

GSB 2

Result:  Θ2:  22.036902



Radio Shack EC-4000/TI-57:  Pseudorandom Number Generation


This program attempts to generate random numbers using the generator:


x_n+1 = frac(997 * x_n + π)


The random numbers are between 0 and 1.  An initial seed will be required 


The calculator does not have fraction and integer parts, so they have to be simulated:


int(x) ≈ x + 1E10 - 1E10

frac(x) = x - int(x), will require a register 


See steps 10 to 23.  


Due to the internal 10 digits and the simulations, expect possible roundoff errors as random numbers are continuously generated.  


Step:  Key Code [ Key ]

00:  55 [ × ]

01:  09  [ 9 ]

02:  09  [ 9 ]

03:  07 [ 7 ]

04:  75  [ + ]

05:  30  [ Ï€ ]

06:  85  [ = ]

07:  32, 6 [ STO 6 ]

08:  75  [ + ]

09:  01  [ 1 ]

10:  42  [ EE ]

11:  01  [ 1 ] 

12:  00 [ 0 ]

13:  65  [ - ]

14:  01  [ 1 ]

15:  42  [ EE ]

16:  01  [ 1 ] 

17:  00 [ 0 ]

18:  85 [ = ]

19:  -42  [  INV EE ]

20:  -34,6  [ INV SUM 6 ]

21:  33, 6 [ RCL 6 ]

22:  81  [ R/S ]

23:  71  [ RST ]



Example:


Seed:  0.98

Generation:

0.2015927

0.1294647

0.2178986

0.3864470

0.4292517



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. 


Casio fx-991CW: Editing Variables

Casio fx-991CW: Editing Variables Introduction The newer set of Casio scientific calculators, better known as the Classwiz series, rev...