Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Sunday, May 16, 2021

TI-NSpire CX II and TI-84 Plus CE: Enhanced Graphing Table

TI-NSpire CX II and TI-84 Plus CE:  Enhanced Graphing Table


Introduction


The program TABLEYX allows the user to enter a function, not only store it for graphing, but also display an analytic table.  Results are stored in lists so they can be used for further analysis.  


Both the TI-NSpire CX II (.tns) and TI-84 Plus CE (.8xp) version can be downloaded here.


TI-NSpire CX Version






Table of contents:

1.1  The Notes Page 

1.2  Calc Page:  run tableyx() here

1.3  Graph Page:  it should update automatically each time tableyx() is run

14.  Table Page:  updates when tableyx() is executed

1.5  Program Listing


Lists:

xlist:  x coordinates

ylist:  y(x)

dislist:  Euclidean distance from (0,0) to (x,y)

arclist:  Arclength of y(x) from 0 to x

derlist:  Derivative at (x,y)

intlist:  Integral of y(x) from 0 to x


Program:


Define tableyx()=

Prgm

:© set approximate mode

:setMode(5,2)

:© main program

:Request "y(x)? ",y(x)

:Request "Δx? ",dx

:Request "Number of steps? ",n

:seq(i,i,0,dx*n,dx)→xlist

:seq(y(i),i,0,dx*n,dx)→ylist

:seq(∫(y(x),x,0,i),i,0,dx*n,dx)→intlist

:seq(nDerivative(y(x),x=i),i,0,dx*n,dx)→derlist

:seq(approx(arcLen(y(x),x,0,i)),i,0,dx*n,dx)→arclist

:√(xlist^(2)+ylist^(2))→dislist

:Disp "Done.  See the next page for results."

:EndPrgm


TI-84 Plus CE Version


When the program ends:


Press [ graph ] to see the graph.


Press [ stats ], select Edit... to see the lists in a list editing format.


Lists:

L1:  x coordinates

L2:  y(x)

L3:  Euclidean distance from (0,0) to (x,y)

L4:  Derivative at (x,y)

L5:  Integral of y(x) from 0 to x


Program:


Float

Radian

Input "Y(X)=",Str1

String>Equ(Str1,Y₁)

Input "CHG X? ",D

Input "NO OF STEPS? ",N

seq(I,I,0,D*N,D)→L₁

seq(Y₁(I),I,0,D*N,D)→L₂

√(L₁²+L₂²)→L₃

seq(nDeriv(Y₁(X),X,I),I,0,D*N,D)→L₄

seq(fnInt(Y₁(X),X,0,I),I,0,D*N,D)→L₅

ClrHome

Disp "RESULTS","L₁: X","L₂: Y","L₃: DIST FROM (0,0)","L₄: D/DX Y(X)","L₅: INTEGRAL FROM X=0","PRESS STAT, EDIT"

Pause 

SetUpEditor L₁,L₂,L₃,L₄,L₅



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, March 14, 2020

TI-36X Pro: Using f(x) in Calculus

TI-36X Pro: Using f(x) in Calculus

The TI-36X Pro Calculator has a table function where you can store a function in the form f(x) and use it for build a short table.  But did you know the function can be used in outside calculations like calculating the derivative and the integral?

It's fairly easy to do. 

1.  Press the [ table ] key and select 2: Edit Function
2.  Enter f(x).  Use the variables key [ x ytzabcd ] to enter x. 
3.  Press [ enter ], [ 2nd ] [ mode ] (quit)

To recall f(x):

1.  Press the [ table ] key and select 1: 1(. 
2.  The function call f( is inserted.   You can use this to make calculations on the home screen.

Below are screen shots of an example, with f(x) set as 3x^2 + 3.






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.

Wednesday, October 25, 2017

Adventures in Python: User-Entry Function

Adventures in Python:  User-Entry Function

The following script allows the user to enter a function, including math functions (math.sqrt, math.sin, etc).  The function is entered as string and when calculation is needed, the eval function is called. 

Script:

# Program 010:  Asking for a function - Using Eval
# To generate a table

# allow for math functions
import math


# ask for the parameters
print('Generate f(x): You can use math. functions')
print('Such as math.sqrt, math.sin, math.exp, etc.')
print('Remember the default angle measure is radians.')
print('Use math.pi for \u03C0')
# f(x) and parameters will be entered as a string
fx = input('Please enter f(x): ')
# use float for end marks
beg = input('Beginning point:  ')
end = input('Ending point:  ')
step = input('Step: ')
# use eval to evaluate the parameters, turning them into floating numbers
beg = eval(beg)
end = eval(end)
step = eval(step)


print('BEGIN')

# since a floating number with begin, end, and step may be used,
# we must use a while loop instead of a for loop
k = beg
while k<=end:
    # function evaluation
    x = k
    y = eval(fx)
    #  print the data to six decimal places
    x = round(x,6)
    y = round(y,6)
    print(x,',',y)
    print('-----')
    # use += for storage arithmetic
    k += step

# end of table
print('END')

Example:

f(x) = √(x^2 + 1) from x = 0 to x = 4, step 0.5

Result:

Generate f(x): You can use math. functions
Such as math.sqrt, math.sin, math.exp, etc.
Remember the default angle measure is radians.
Use math.pi for π
Please enter f(x): math.sqrt(x**2+1)
Beginning point:  0
Ending point:  4
Step: 0.5
BEGIN
0 , 1.0
-----
0.5 , 1.118034
-----
1.0 , 1.414214
-----
1.5 , 1.802776
-----
2.0 , 2.236068
-----
2.5 , 2.692582
-----
3.0 , 3.162278
-----
3.5 , 3.640055
-----
4.0 , 4.123106
-----
END

Pretty straight forward.  I hope you are enjoying this series on Python.  Until next time,

Eddie


This blog is property of Edward Shore, 2017

Thursday, October 19, 2017

Adventures in Python: String Manipulation and Function/Derivative Table (Subroutines)

Adventures in Python:  String Manipulation and Function/Derivative Table (Subroutines)

String Manipulation

This script demonstrates several string functions:

length:  the number of characters in a string

stringname.replace(‘target string’,‘new string’):  replace a part of a string

stringname.capitalize(): capitalize the first letter of a string

stringname.split():  splits a string at its spaces

Other string functions:

stringname.lower(): makes all letters of a string to lower case

stringname.upper():  makes all letters of a string to upper case

You can join strings with the plus symbol ( + ).

The nice thing is that you won’t need to import any modules for the above string functions.

Script:

# program 008
print('Program 008: String Demo')
str1 = input('Please type some text.  ')
# input defaults to strings
# length
print('Length')
l = len(str1)
print('Length',l)
# capitalizes the first letter
print('Capitalize')
str2 = str1.capitalize()
print(str2)
# string splits at spaces
print('Split')
str3 = str1.split()
print(str3)
# replacement
str4 = str1
str4 = str4.replace('a','e')
str4 = str4.replace('u','a')
str4 = str4.replace('o','u')
str4 = str4.replace('i','o')
str4 = str4.replace('e','i')
print('Can you read this?')
print(str4)

Output:  with the “This is my demonstration.”

Program 008: String Demo
Please type some text.  This is my demonstration.
Length
Length 25
Capitalize
This is my demonstration.
Split
['This', 'is', 'my', 'demonstration.']
Can you read this?
Thos os my dimunstritoun.


Function/Derivative Table (Subroutines)

You can create user functions (subroutines) in python by the def structure.  You return results by the return command.

Script (you can enter whatever your function you like, I have imported the math module):

# Program 009 Using def and creating a table
# import math
import math

def fx(x):
     f = math.exp(-x**2/2)
     return f;
    
print('Function Table')
beg = float(input('start: '))
end = float(input('stop: '))
stp = float(input('step: '))

# loop begins
h = .00001
k = beg
print('k',':','f(x)',';','slope')
while k <= end:
     # function
     a = fx(k)
     # derivative
     b = fx(k+h)
     c = fx(k-h)
     d = (b - c)/(2 * h)
     print(k,',',a,',',d)
     print('- - - - - - - -')
     k = k + stp
           

Output (with start = 0, stop = 5, step = 1)

Function Table
start: 0
stop: 5
step: 1
k : f(x) ; slope
0.0 , 1.0 , 0.0
- - - - - - - -
1.0 , 0.6065306597126334 , -0.6065306596914066
- - - - - - - -
2.0 , 0.1353352832366127 , -0.27067056647955834
- - - - - - - -
3.0 , 0.011108996538242306 , -0.033326989618259056
- - - - - - - -
4.0 , 0.00033546262790251185 , -0.0013418505118650097
- - - - - - - -
5.0 , 3.726653172078671e-06 , -1.8633265866508763e-05
- - - - - - - -

Eddie


This blog is property of Edward Shore, 2017.

Friday, September 30, 2011

Common Keyboard Commands for Hewlett Packard RPL Calculators (HP 48S/48G/50g)


(updated 10/1/2011)

This is a quick reference to common mathematical functions for the Hewlett Packard RPL calculators. In general, HP RPL calculators are classified into three families:

This table will focus on the HP 48S, 48G, and 50g - three of four models I actually own (I have a 49g+ which should be the same key mapping as the 50g. The 49G has a different mapping - and I do not own a 49G.)

Note: [LS] = left shift key (3rd key up from the ON button on the left side)
[RS] = right shift key (2nd key up from the ON button on the right side)

About Soft Keys

On the top row, there are six soft keys. The functions of these six keys change depending on what menu is currently active. The top row of the HP 49G, 49g+, and 50g are labeled as:

[F1] [F2] [F3] [F4] [F5] [F6]

On the HP 48S and 48G, these keys are not labeled - but I will still use the F# convention. So [F1] means first soft key from the left, [F2] means second soft key from the left, and so on.

Note: For the 50g, it is assumed that Soft Menus are turned on. (Flag -117 is set)

List of Functions

x^2
HP 48S/48G: [LS] [ √x ]
HP 50g: [LS] [ √X ]

x√y
HP 48S/48G: [RS] [√x]
HP 50g [RS] [√X]

10^x
HP 48S/48G: [LS] [y^x]
HP 50g: [LS] [EEX]

LOG
HP 48S/48G: [RS] [y^x]
HP 50g: [RS] [EEX]

e^x
HP 48S/48G: [LS] [1/x]
HP 50g: [LS] [Y^X]

LN
HP 48S/48G: [RS] [1/x]
HP 50g: [RS] [Y^X]

ABS
HP 48S: [MTH] [ F1 ] (PARTS) [ F1 ] (ABS)
HP 48G: [MTH] [F5] (REAL) [NXT] [F1] (ABS)
HP 50g: [LS] [ ÷ ]

ARG
HP 48S: [MTH] [ F1 ] (PARTS) [ F4 ] (ARG)
HP 48G: [MTH] [NXT] [F3] (CMPL) [F6] (ARG)
HP 50g: [RS] [ ÷ ]

ASIN
HP 48S/48G: [LS] [SIN]
HP 50g: [LS] [SIN]

ACOS
HP 48S/48G: [LS] [COS]
HP 50g: [LS] [COS]

ATAN
HP 48S/48G: [LS] [TAN]
HP 50g: [LS] [TAN]

->NUM
HP 48S: [RS] [EVAL]
HP 48G: [LS] [EVAL]
HP 50g: [RS] [ENTER]

->Q (Exact Answer)
HP 48S: [LS] [EVAL]
HP 48G: [LS] [ 9 ] (SYMBOLIC) [NXT] [F3]
HP 50g: [LS] [ 6 ] (CONVERT) [F4] (REWRI) [NXT] [F5] (->Q)

x!
HP 48S: [MTH] [F2] (PROB) [F3] (!)
HP 48G: [MTH] [NXT] [F1] (PROB) [F3] (!)
HP 50g: [LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F3] (!)

COMB (Combination)
HP 48S: [MTH] [F2] (PROB) [F1] (COMB)
HP 48G: [MTH] [NXT] [F1] (PROB) [F1] (COMB)
HP 50g: [LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F1] (COMB)

PERM (Permutation)
HP 48S: [MTH] [F2] (PROB) [F2] (PERM)
HP 48G: [MTH] [NXT] [F1] (PROB) [F2] (PERM)
HP 50g: [LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F2] (PERM)

RAND (Random #)
HP 48S: [MTH] [F2] (PROB) [F4] (RAND)
HP 48G: [MTH] [NXT] [F1] (PROB) [F4] (RAND)
HP 50g: [LS] [SYMB] (MTH) [NXT] [F1] (PROB) [F4] (RAND)

% (Returns level 2 * level 1% on level 1)
HP 48S: [MTH] [F1] (PARTS) [NXT] [F4] (%)
HP 48G: [MTH] [F5] (REAL) [F1] (%)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL) [F1] (%)

%CHG (Percent Change from level 2 to level 1)
HP 48S: [MTH] [F1] (PARTS) [NXT] [F5] (%CH)
HP 48G: [MTH] [F5] (REAL) [F2] (%CH)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL) [F2] (%CH)

IP (Integer Part)
HP 48S: [MTH] [F1] (PARTS) [NXT] [NXT] [F3] (IP)
HP 48G: [MTH] [F5] (REAL) [NXT] [F5] (IP)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL) [NXT] [F5] (IP)

FP (Fraction Part)
HP 48S: [MTH] [F1] (PARTS) [NXT] [NXT] [F4] (FP)
HP 48G: [MTH] [F5] (REAL) [NXT] [F6] (FP)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL) [NXT] [F6] (FP)

To access the hyperbolic functions (SINH, COSH, etc..)
HP 48S: [MTH] [F3] (HYP)
HP 48G: [MTH] [F4] (HYP)
HP 50g: [LS] [SYMB] (MTH) [F4] (HYP)

Matrix Functions:

INV (Inverse)
HP 48S/48G: [1/x]
HP 50g: [1/X]

DET (Determinant)
HP 48S: [MTH] [F4] (MATR) [F5] (DET)
HP 48G: [MTH] [F2] (MATR) [F2] (NORM) [NXT] [F2] (DET)
HP 50g: [LS] [ 5 ] (MATRICES) [F2] (OPER) [F6] (DET)

M^T (Transpose)
HP 48S: [MTH] [F4] (MATR) [F3] (TRN)
HP 48G: [MTH] [F2] (MATR) [F1] (MAKE) [F3] (TRN)
HP 50g: [LS] [ 5 ] (MATRICES) [F2] (OPER) [NXT] [NXT] [F5] (TRN)

EGVL (Eigenvalues)
(not on the HP 48S)
HP 48G: [MTH] [F2] (MATR) [NXT] [F3] (EGVL)
HP 50g: [LS] [ 5 ] (MATRICES) [NXT] [F1] (EIGEN) [F3] (EGVL)

RREF
(not on the HP 48S)
HP 48G: [MTH] [F2] (MATR) [F3] (FACTR) [F1] (RREF)
HP 50g: [LS] [ 5 ] (MATRICES) [F5] (LIN S) [F4] (RREF)

Stack Functions:

Clear the Entire Stack
HP 48S: [RS] [backspace]
HP 48G: [LS] [DEL]
HP 50g: [RS] [Backspace]

Swap contents of levels 1 and 2
HP 48S: [LS] [right arrow] (SWAP)
HP 48G: [LS] [right arrow] (SWAP)
HP 50g: [LS] [right arrow] (unmarked)

Roll the entire stack down 1 level
(Move everything down one level and level 1 goes to stack n)
HP 48S: [PRG] [F1] (STK) [F6] (DEPTH) [F4] (ROLLD)
HP 48G: [LS] [up arrow] (STACK) [F6] (DEPTH) [F4] (ROLLD)
HP 50g: [LS] [EVAL] (PRG) [F1] [NXT] [F6] (DEPTH) [F2] (ROLLD)

Angle Conversions:

Degrees to Radians
HP 48S: [LS] [SPC] (π) [ x ] 180 [ ÷ ]
HP 48G: [MTH] [F5] (REAL) [NXT] [NXT] [F5] (D->R)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL] [NXT] [NXT] [F5] (D->R)

Radians to Degrees
HP 48S: 180 [ x ] [LS] [SPC] (π) [ ÷ ]
HP 48G: [MTH] [F5] (REAL) [NXT] [NXT] [F6] (R->D)
HP 50g: [LS] [SYMB] (MTH) [F5] (REAL] [NXT] [NXT] [F5] (R->D)

Earth's Radius by Latitude

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