Showing posts with label programming tricks. Show all posts
Showing posts with label programming tricks. Show all posts

Sunday, January 13, 2019

TI-84 Plus CE: Lower Case Letters without Assembly

TI-84 Plus CE:  Lower Case Letters without Assembly

Letter Case Letters without Assembly Programs

It is possible to put letter case letters in TI-84 Plus CE programs without running an assembly program.  This is going to require the use of the TI Connect CE computer program.  I am using the Windows version and hopefully my assumption will be correct that this technique will work on the Mac version as well.

Note: You will need the TI-84 Plus CE (the newest, thinnest TI-84) for this.  The TI-84 Plus CE has a back-lit, color screen. 

Steps:

1.  Connect your TI-84 Plus CE to your computer.

2.  Start up the TI Connect CE computer program.

3.  Select PROGRAM EDITOR on the left hand menu.  Next, click on New Program (the folder with the plus key) on the right.  (You can also edit programs but we'll create a new program for this demo.)

4.  Name your program.  For this example, I am going to name it DEMO.  The name can be in lower case, but the letters in the name will become upper case when the program is transferred to the TI-84 Plus CE. 

5.  Type your program.  You can use the catalog on the left to insert commands.  The Keypad section is where you insert pi (π), the store arrow (→), the square root function (√), the exponential function (e^), and the imaginary indicator to build complex numbers (i = √-1). 

We will need to type the program in the Program Editor software, not directly on the TI-84 Plus CE calculator. 

This is my demo program.

TI-84 PLUS CE Program DEMO

Disp "This is a test program."
Input "a: ",A
Input "b: ",B
A^2+B^2→C
A^3+B^3→D
ClrHome
Disp "Results:","a^2+b^2=",C
Disp "a^3+b^3=",D

Notes:

*  Variables must still be in uppercase. 

*  You can use lower case letters with programming through the software, but Unicode characters do not transfer over. 

6.  Save your program (if you want). 

7.  If you have not already, turn on the TI-84 Plus CE.  Then send the program to your TI-84 Plus CE.  There are three ways to accomplish this task (Windows):

* Click on the Send Program to Connect Calculator icon.
* Key Ctrl+E.
* Under the Actions menu, click on the Send to Calculators menu.

If the program is accepted, you program is transferred.

8.  Run the program on your calculator.



Limitations

*  Using lower case in this method requires editing on the program software, not the calculator itself.

*  You must still use single upper case letters for variables.

*  I have not been able to do Unicode characters with this method, as the calculator program will not transfer.

*  This lower case is useful for displaying messages and prompts. 

Eddie

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

Thursday, October 6, 2016

HP 12C Programming Tricks



HP 12C Programming Tricks


These tricks can help you cut steps in your programming.  Remember that it is still important to test results.  Happy programming!

Using Last X

This can be a god-send in making programs more efficient.  Unless you are using the Platinum Edition, we only have 99 steps to work with.  The LST X function returns the x argument that is last used in a calculation.

Function
LST x Returns
One-Argument Functions:
√, LN, e^x, FRAC, INTG, n!
The x pre-calculation
Two-Argument Functions (Arithmetic):
+, -, *, ÷, y^x
The x value in the arithmetic operation

Number of Inputs

I follow a general rule when it comes to the number of inputs required on an HP 12C program.  If the number of inputs is 1 or 2, I would have the user enter inputs on the stack and run the program.  If the number of inputs is 3 or more, I have the user pre-store the inputs into registers before pressing [R/S] to run the program.  Example:  If my program calls for a, b, and c, I have the user store a in register 0, b in register 1, and c in register 2, and then have the user press [R/S].

Branching

You can branch a program to different parts of the program.  You designate a register as a choice variable.  (Rc = 0 for option 0, 1 for option 1, etc).  Examples include setting the variable for computing combinations vs permutations, set for month payments vs yearly payments.


Program format:

RCL Rc
Test value
-
X=0?
GTO (applicable line number)
(applicable section)
(commands and calculations)
GTO 00 (end the program)

Multiply x by 100

Keystroke:  [ENTER], 1, [x<>y], [%T]
Result:  The X stack has 100*x, the Y stack has x.

Dividing x by 100

Keystrokes: [ENTER], 1, [ % ]
Results:  The x stack has x/100, the Y stack has x.   

Quickly entering numbers in the form of 10^n (n is an integer)

Keystrokes:  1, [EEX], n
This is useful when n>2.  For example, entering 10000 takes five steps normally.  With this sequence, 1 [EEX] 5, you only use 3. 

Another Way to Double

Keystrokes:  [ENTER], [ + ]
Results: X Stack:  2*x.   1 program step saved.

Absolute Value of x.

Keystrokes:  2, [y^x], [ g ] [ √ ]
Result: X Stack: |x|.  It is important to square the number first since the HP 12C’s square root function returns an error on negative numbers. 

Signum Function of x.
This is the extension of the absolute value sequence shown previously.

Keystrokes:  [ENTER], 2, [y^x], [ g ] ( √ ), [ ÷ ]
Result:  X Stack: sgn(x)

Modulus (for two positive values)

Keystrokes:  a, [ENTER], b, [ ÷ ], [ g ] (LSTx), [x<>y], [ g ] (FRAC), [ * ]
Result:  X stack:  a MOD b

Comparing Values

We have a value stored in a register, call it Rc, where c obviously can stand for 0, 1, and so on. 
Keystrokes: [RCL], c, [ - ], [ g ] (x=0)

If the test is true (x = Rc), the next step is executed.  Otherwise, it is skipped.

Six Digit Approximation of π

Since the HP 12C does not have a π button, we’ll have to enter a 10 digit approximation of π, which will take 11 steps.  However, if you want an approximation (given most of the time the HP 12C is used on Fix 2 mode), we can use the approximation π ≈ 355/113, which is accurate to six decimal places.

π ≈ 3.14159265359
355/113 ≈ 3.14159292035

Keystrokes:  355, [ENTER], 113, [ ÷ ]

Calculate (1 + n/100)^x without using the TVM Registers

Keystrokes:  1, [ENTER], n, [ % ], [ + ], x, [y^x]

I hope you find these tricks useful.  If you have any, please feel free to share them. 

Eddie

This blog is property of Edward Shore, 2016.

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues The programs are listed for the Swiss Micros DM42 an...