Showing posts with label simplifying radicals. Show all posts
Showing posts with label simplifying radicals. Show all posts

Saturday, March 6, 2021

Fun with the TI-73 Part I: Logarithmic Regression, Percent, Square Root Simplification

 Fun with the TI-73 Part I: Logarithmic Regression, Percent, Square Root Simplification


TI-73 Program:  LNREG - Logarithmic Regression


Introduction:


The program LNREG fits the data to the equation:


y = a * ln x + b


The lists used are:

L_1:  x list  

L_2:  y list


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

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


You can edit lists by pressing [LIST].  


The lower case a and b are from the VARS, Statistics, EQ menu.


Program:


"EWS 2021"

Disp "FIT Y=A LN X +B","USES X=L1,Y=L2:

ln(L_1) → L_1

LinReg(ax+b) L_1,L_2

a → A

b → B

Output(4,1,"A=")

Output(4,5,A)

Output(5,1,"B=")

Output(5,5,B)

Output(6,5,r²)

e^(L_1) → L_1

Pause

Menu("PLOT?","YES",1,"NO",2)

Lbl 1

PlotsOff

FnOff

"A*ln(X)+B"→Y_1

Plot1(xyLine,L_1,L_2,□)

ZoomStat

Lbl 2


Example:


X:  L_1 = {1, 2, 3, 4, 5, 6}

Y:  L_2 = {-1.26, 2.1018, 4.0683, 5.4635, 6.5458, 7.43}


Results:

y = A ln x + B

A = -1.259978557

B = 4.849985251

r^2 ≈ 1


TI-73 Program: PERCENT - Percent Calculations


Introduction:


The program gives the users four options:


1.  Adding tax (plus percent)

2.  Subtracting tax (minus percent)

3.  Percent Change

4.  Percent Total


The percent key divides the amount by 100.  Example:  5% turns to 0.052.


Program:


"EWS 2021"

Menu("PERCENT","TAX+",1,"TAX-",2,"%CHG",3,"%TOT",4)

Lbl 1

Prompt N

Input "X% ",X

N*(1+X%)→Y

Pause Y

Stop

Lbl 2

Prompt N

Input "X% ",X

N*(1-X%)→Y

Pause Y

Stop

Lbl 3

Input "OLD=",O

Input "NEW=",N

(N-O)*100/O→Y

Pause Y

Stop

Lbl 4

Input "PART=",P

Input "WHOLE=",W

100*P/W→Y

Pause Y

Stop


Example:


TAX+:   Add 15% to 19.95

N: 19.95, X%:  15

Result:  22.9425


TAX-:  Subtract 15% from 19.95

N:  19.95, X%:  15

Result:  16.9575


%CHG:  Old (O):  11700, New (N):  15420

Result:  31.79487179


%TOT:  Part (P):  11700, Whole (W):  15420

Result:  75.7548638


TI-73 Program: SQROOT - Simplification Square Root


This program tries to factor √N to A√B.  N, A, and B are integers.


Program:


"EWS 2021"

Disp "√(N)->A√(B)"

Prompt N

iPart(√(N))→X

While X≠0

If fPart(N/X^2)=0

Then

X→A

N/X^2→B

Goto 1

Else

X-1→X

End

End

Lbl 1

Disp "A=",A,"B=",B

Pause


Examples:


N = 88;   √88 = 2√22


N = 1225;  √1225 = 35√1


Notes:


*  There is no ALPHA key for the TI-73 (family).   Text is entered by use of the [ 2nd ] [ MATH ] (TEXT) key sequence.  Letters are selected by using the arrow keys and selecting them with the ENTER key.


*  The underscore character ( _ ) acts like a space.


*  The TEXT has the letters A-Z, _, <, =, >, ≤, ≠, ≥, and the logic functions and, or.  For the question mark character, ?, press [ 2nd ] [ PRGM ] (CATALOG) [ ↑ ] [ ENTER ]. 


* The programming language of the TI-73 is the robust as the TI-83 family (TI-83, TI-83 Plus, TI-84 Plus family, TI-82).  


* The main difference is that results are shown on a separate screen for output.   When a program terminates, the TI-73 returns to the Home screen.  It is necessary to include a Pause at the end to keep the results on the screen.


Stay tuned tomorrow for more programs for the TI-73.  


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. 


Saturday, November 17, 2018

TI-84+ and Casio (fx-CG 50) Micropython: Simplifying Nested Radicals

TI-84+ and Casio (fx-CG 50) Micropython: Simplifying Nested Radicals

Introduction 

The following program will simplifying the following expression:

√(x + y) = √a + √b

The input is x and y, with output a and b.  The following conditions are implied:  x > y and x > 0.

To see the derivation of simplification and examples, please check out this blog entry:

https://edspi31415.blogspot.com/2018/11/simplifying-nested-radicals.html

TI 84 Plus Program:  DENEST

"EWS 2018-11-12"
Disp "√(X+Y)=√(A)+√(B)","X>Y","X>0"
Prompt X,Y
X/2+1/2*√(X^2-Y^2)→A
X/2-1/2*√(X^2-Y^2) →B
√(A)→Z
round(Z,9)→Z
Disp " "

If Y<0 font="">

Then
If fPart(Z)=0
Then 
Disp √(A),"- √(",B,")"
Else 
Disp "√(",A,")- √(",B,")"
End

Else
If fPart(Z)=0
Then 
Disp √(A),"+ √(",B,")"
Else 
Disp "√(",A,")+ √(",B,")"
End

End

Casio Micropython (fx-CG 50) Script denest.py

Input is the form of:

√(x1 * √x2 + y1 * √y2) = √a + √b

import math
print("sqrt(x+y)=")
print("sqrt(a)+sqrt(b)")
print("x>y","x>0")

print(" ")
print("x1*sqrt(x2)")
x1=float(input("x1:"))
x2=float(input("x2:"))
x=x1*math.sqrt(x2)

print(" ")
print("y1*sqrt(y2)")
y1=float(input("y1:"))
y2=float(input("y2:"))
y=y1*math.sqrt(y2)

a=x/2+math.sqrt(x**2-y**2)
b=x/2-math.sqrt(x**2-y**2)
z=math.sqrt(a)
z=round(z,10)
a=round(a,10)
b=round(b,10)

if y<0: font="">
  if z-int(z)==0:
    print(z,"-sqrt(")
    print(b,"?")
  else:
    print("sqrt(",a)
    print("-sqrt(")
    print(b,")")
else:
  if z-int(z)==0:
    print(z,"+sqrt(")
    print(b,")")
  else:
    print("sqrt(",a)
    print("+sqrt(")
    print(b,")")


Source:

Michael J. Wester, Editor.  Computer Algebra Systems: A Practical Guide John Wiley & Sons: Chichester 1999.  ISBN 978-0-471-983538

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Monday, November 5, 2018

Simplifying Nested Radicals

Simplifying Nested Radicals

Introduction

A nested radical is a radical of the form:

√(x_0 + √(x_1 + √(x_2 + .... + √(x_k) ... )))

A expression of radicals (not necessarily square roots) that contains radicals or surds (unresolved n th roots).  Example of a nested radicals include:

√(8 +  √3)

√(8 +  2 * √3)

√(√8 +  √3)

√(√8 -  √3)

This blog entry will deal with the denesting the following:

√(x + y) and √(x - y) where x and/or y is a radical.  Let's assume that x > y and only principal roots are calculated. We're looking into a neat process that is used in computer algebra systems.

Derivation

We want to obtain the following and determine a and b. 

(I) √(x + y) = √a + √b

and

(II) √(x - y) = √a - √b


Start by squaring both sides of (I):

(√(x + y))^2 = (√a + √b)^2

(III) x + y = a + 2 * √(a*b) + b

(IV)  Set:
x = a + b
y = 2 * √(a*b)

(V)  Determine  x - y:

x - y = a + -1*2 * √(a*b) + b  (see IV)
x - y = a - 2 * √(a*b) + b
√(x - y) = √a - √b

(VI)

√(x + y) * √(x - y) = (√a + √b) * (√a - √b)
√((x + y) * (x - y)) = (√a)^2 - (√b)^2
√(x^2 - y^2) = a - b


We have the following simultaneous equations set up:

(VII)
a + b = x     (from (IV))
a - b = √(x^2 - y^2)   (from (VI))

Solving the system in (VII) for both a and b yield:

(VIII)
a = x/2 + 1/2 * √(x^2 - y^2)
b = x/2 - 1/2 * √(x^2 - y^2)

Substituting a and b back in (I) and (II):

(IX)

√(x + y) = √(x/2 + 1/2 * √(x^2 - y^2)) + √(x/2 - 1/2 * √(x^2 - y^2))

√(x - y) = √(x/2 + 1/2 * √(x^2 - y^2)) - √(x/2 - 1/2 * √(x^2 - y^2))

Examples

Example 1:  Simplify  √(8 + 2 * √15)

x = 8
y = 2 * √15

x^2 - y^2
= 8^2 - (2 * √15)^2
= 64 -  4 * 15
= 4

Then: 

√(x/2 + 1/2 * √(x^2 - y^2))
= √(4 + 1/2 * √4)
= √(4 + 1/2 * 2)
= √5    // √a

And:

√(x/2 - 1/2 * √(x^2 - y^2))
= √(4 - 1/2 * √4)
= √(4 - 1/2 * 2)
= √3     // √b

Hence:

√(8 + 2 * √15) = √5 + √3

Example 2:  Simplify  √(88 + 2 * √567)

x = 88
y = 2 * √567

x^2 - y^2
= 88^2 - (2 * √567)^2
= 7744 - 2268
= 5476

Note √5476 = 74

Then: 

√(x/2 + 1/2 * √(x^2 - y^2))
= √(44 + 1/2 * 74)
= √81
= 9        // √a

And:

√(x/2 + 1/2 * √(x^2 - y^2))
= √(44  - 1/2 * 74)
= √7      // √b

√(88 + 2 * √567) = 9 + √7


Example 3:  Simplify √(19 - 4 * √22))  (note the subtraction)

x = 19
y = 4 * √22

x^2 - y^2
= 19^2 - (4 * √22)^2
= 9

√(x/2 + 1/2 * √(x^2 - y^2))  = √11
√(x/2 + 1/2 * √(x^2 - y^2))  = √8 = 2 * √2

Hence:

√(19 - 4 * √22))  = √11 - 2 * √2


Neat algebra.

Source:

Michael J. Wester, Editor.  Computer Algebra Systems: A Practical Guide John Wiley & Sons: Chichester 1999.  ISBN 978-0-471-983538


Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Basic vs. Python: Circle Inscribed in Circle [HP 71B, Casio fx-CG 100]

Basic vs. Python: Circle Inscribed in Circle Calculators Used: Basic: HP 71B Python: Casio fx-CG 100 Introduction ...