Sunday, February 25, 2018

Happy Sunday - HP Prime Update (Firmware 13441), Next Week

Happy Sunday - HP Prime Update (Firmware 13441), SAT

Happy Sunday! 



HP Prime Update – Firmware 13441

The current firmware is now version 13441.  According to the release notes, Firmware 13441 addresses and corrects any problems that were present in version 13333, including empty lists in geometry, EXPR and nested arguments, and DIMGROB issues.

Links to get the new firmware and Connectivity Kit:




Next Week – I Tackle the SAT

I am going to tackle some practice SAT math questions, particular from the Mathematics Level 2.  It’s been about 23 since I took the SAT (for real), so a lot has changed over the years.  The SAT now allows graphing calculators on the test, and if you check out the SAT page, the College Board is really open to what type of calculator students can use now.  Only calculators with QWERTY keyboards, using styluses (on the Casio Classpad or Sharp EL-9600c), and calculator apps are no-nos.  (No iOS, Android, TI-92 Plus)

 .

Graphing calculators are now allowed on the SAT (on the tests that allow calculators) (L-R: TI-84 Plus CE, HP Prime, Casio fx-CG50)
Also the SAT is now offered seven times year.  I don’t remember if the SAT was offered that frequently back in the early 1990s when I was in high school. 

This is a challenge for me to see if I still can answer some SAT level questions. 

To all those who are taking the SAT (and/or other college entrance exams) this year: best of luck and much success! 


Spam:  It Sucks

Lately the comments section of this blog has been hit by a lot of spam.  I am policing the comments sections posted on the blog.  If you are going to comment, please keep your comments about the topic.  If people were interested in casinos or printer repairs, they would look for that instead of coming here. 

Much thanks to those who post legitimate comments, it is much appreciated.

Thank you,

Eddie


This blog is property of Edward Shore, 2018

Friday, February 23, 2018

Review: SwissMicros DM41L

Review: SwissMicros DM41L





General Information

Company:  SwissMicros, https://www.swissmicros.com/
Type:  Programmable Scientific
Memory:  319 registers (2,233 steps),
(Firmware V 25 gives additional archive storage)
Battery:  CR 2032
Years:  Current (2015-)
Cost: $138 U.S. dollars (February 2018), 129 CHF

There are two models: the DM 41L and the DM41.  The DM41 is a credit card sized version of the DM 41L (99 CHF).  For me, I prefer the larger sized DM 41L as I do have large hands.  Both offer the same functionality. 

The size of the DM 41L is about the size of the Hewlett Packard HP 12C and HP 15C.

Note:  When I mention the DM 41L, this applies to both the DM 41L and the credit-card sized DM 41. 

The delivery for me (from Switzerland to the United States) was really fast, much faster than I expected.  I was motivated to purchase a DM 41L because I will turn 41 years old in March.  This is my first calculator from SwissMicros. 

The HP 41C Comes to the 21st Century

The DM 41L is a clone of the very popular HP 41CX calculator, but in a landscape form.  The HP 41CX was the final version of Hewlett Packard’s HP 41C series produced for most of the 1980s.  The HP 41CX included a time module, which gives the calculator a timer, stopwatch, and calendar operations.  Also the HP41CX included an extended functions and memory module.  The base HP 41C had 63 registers, while the HP41CX, and the DM 41L start you off with 319 registers.

Each register could either hold a number or seven program steps.  At any time you can designate how many registers to dedicate to holding numeric constants by executing the SIZE command.

The DM41L and DM 41 come with the following modules installed:

* Extended Memory and Functions (EX FCN 2D)
* Time Module (CX TIME)

I am so happy that the Time Module is included, because the DM41L has the days between dates function, so I don’t need to program the convert date to the Julian Date algorithm.  (I love the days between dates function, and I do feel that, and the date add functions should be standard on all calculators – OK, rant over).

Keyboard

The keyboard is a pleasure to use.  The colors of the fonts are beautiful, with the labels having great contrast between text and keyboard background.  The keys are very responsive and provide great feel for each press.  I have seen some reviewers comment that the keys are at first hard and need some breaking in, however, this is not the case for me. 

The only thing is that, I wish the ON button was the same height as the other keys, as the ON key is sunken a bit.  This could be personal preference as the ON key works just as well the rest of the keys.

Connectivity

The DM 41L can the connected to the computer where you can back up your memory, restore memory, load programs, and update the software.  The current version at the time of this review is Firmware 25.  Firmware 25 adds the X-Memory module, which allows for additional achieve memory. 

The cord used is a mini USB-RS232 cord, which is the same one used to connect the TI-84 Plus CE.

The Swiss Micros will have links to the required connectivity software and detailed instructions. It took me a little time to get the hang of it, it gets easier after I get the procedure. 

Get the DM 41L ready for connectivity use by having the calculator off, then holding the [ x ] (C) button and the [ ON ] button.

What Time Is It?

You can have the DM 41L tell you time and date by first having the calculator off, then holding the [ Σ+ ] (A) key, then the [ ON ]. 

In a similar fashion, you check the revision software by holding [ LN ] (E) then [ ON ].

SwissMicros’ other [ ON ] + key combos are listed here:  https://www.swissmicros.com/instructions.php

Programming

The DM 41L’s programming module is RPN keystroke, like the HP 41C.  If you know how to program the HP 41C, you can program the DM 41L.  Due to the popularity of the HP 41C, there is of ton of programming information online.  The Museum of HP Calculators has an entire software library thread dedicated to the HP 41C (http://www.hpmuseum.org/forum/forum-11.html ), which should work on the DM 41L with no problems.

A great online source to the programming and operating the HP 41C and the DM 41L can be found here:  http://www.greendyk.nl/hp41c-manual/index.php?s=J&p=7  Special thanks to Greendyk!   ( www.greendyk.nl )

Verdict

Do I recommend the DM 41L to purchase? 

That would be a 100% YES!

SwissMicros deserves all the praise from their customers, high quality calculator and high quality work.  I have very happy with my purchase. 

SwissMicros has several other calculators, including the DM 42 which was just released.  Please feel to check it out.

Eddie


This blog is property of Edward Shore, 2018.

Thursday, February 22, 2018

HP Prime and Casio fx-5800P: The Two Train Problem (updated 2/26/2018)

HP Prime and Casio fx-5800P:  The Two Train Problem
(updated 2/28/2018)

Introduction

Have you ever heard the infamous problem “two trains are heading towards each other…”? 

Today’s blog will cover the following question:

Two trains are heading towards each other, on their own separate train track.  Each train has going at their own speed (velocity).  The trains start out a distance apart.

1. When will the trains cross over the same spot, and


2. Where will the trains cross over the same spot?




According to the diagram above, we have two trains, labeled Train I and Train II, each going at velocity v and acceleration a.  The trains start at distance D apart.  We will call the point where the trains cross over the same spot, x. 

Notes:

1. To make our lives easier, let’s assume that Train I starts at position 0, while Train II starts at position D. 

2. Train I is going at velocity v and acceleration a. 

3. Train II is going at velocity –v and acceleration –a. Why negative?  Train II is traveling in the opposite direction of Train I.

Setting up the Equations

The general distance equation is:  x = x0 + v*t + a*t^2, where x0 is the initial position.

We are going to cover two scenarios:  one where there is no acceleration, that is the velocity of both trains is constant.  The other is where acceleration is present for at least one of the trains.  Acceleration is assumed to be constant. 

In general the distance equations for both trains are:

Train I:  x =        v1*t + 1/2*a1*t^2
Train II: x = D  - v2*t -  1/2*a2*t^2

What this boils down to are a system of two equations, solving for both t and x.

Case 1:  Constant Velocity

The trains are moving at constant velocity in this scenario.  Which means there is no acceleration, and hence a1 = 0 and a2 = 0.  Then:

Train I:  x =        v1*t
Train II: x = D -  v2*t

Subtracting equations gives us:

0 = -D + v1*t – -v2*t
0 = -D + (v1 + v2)*t
D = (v1 + v2)*t
t = D/(v1 + v2)

Once t is known, we can use substitution to find x.  Train I’s equation is simpler, so:

x = v1*t

Case 2:  Non-Zero Acceleration

Start with:

Train I:  x =        v1*t + 1/2*a1*t^2
Train II: x = D  - v2*t -  1/2*a2*t^2

Subtracting the equations and solving for t yields:

0 = -D + v1*t – -v2*t + 1/2*a1*t^2 - -1/2*a2*t^2
0 = -D + (v1 + v2)*t + 1/2*(a1 + a2)*t^2

Using the quadratic equation:

t = ( -(v1+v2) ± √( (v1+v2)^2 + 4*D*1/2*(a1+a2)) ) / (2*1/2*(a1 + a2))
t = ( -(v1+v2) ± √( (v1+v2)^2 + 2*D*(a1+a2)) ) / (a1 + a2)


Note that there are two roots for t.  However, given the problem, negative time does not make sense.  We can eliminate the root for t that is obviously negative.

Hence, our solution for time in this problem is:

t = ( -(v1+v2) + √( (v1+v2)^2 + 2*D*(a1+a2)) ) / (a1 + a2)

Again, we are going to use the simpler equation for Train I to figure x:

x = v1*t + a1*t^2

The Program TRAINS

The program TRAINS will solve this problem.  Below are the codes for both the HP Prime and Casio fx-5800p.  Enter each as a positive value as the directions are accounted for in the program.

In the program, Train I is considered the left train, while Train II is considered the right train.

HP Prime Program: TRAINS

EXPORT TRAINS()
BEGIN
// 2018-02-22 EWS
// 2 trains problem

LOCAL d,t,x;
LOCAL v1,a1,v2,a2;

INPUT({d,v1,a1,v2,a2},
"Two Opposing Trains",
{"Dist:","L Vel:","L Acc:",
"R Vel:","R Acc:"},
{"Distance between trains",
"Left Train: Velocity",
"Left Train: Acceleration",
"Right Train: Velocity",
"Right Train: Acceleration"});

// calculation
IF a1≠0 OR a2≠0 THEN
t:=(−(v1+v2)+√((v1+v2)^2+
2*d*(a1+a2)))/(a1+a2);
x:=v1*t+1/2*a1*t^2;
ELSE
t:=d/(v1+v2);
x:=v1*t;
END;

// results
RETURN {"Time",t,
"Position",x};


END;

Casio fx-5800P Program: TRAINS

“EWS 2018-02-22”
“DISTANCE”?→D
“LEFT-VEL.”?→A
“LEFT-ACC.”?→E
“RIGHT-VEL.”?→B
“RIGHT-ACC.”?→F
If E≠0 Or F≠0
Then
(-(A+B)+√((A+B)^2
+2*D*(E+F)))÷
(E+F)→T
A*T+1/2*E*T^2→X
Else
D÷(A+B)→T
A*T→X
IfEnd
“TIME:”
T
“POSITION:”
X

Examples

Assume compatible units for each example.

Example 1:  Constant Velocity
Train I:  v1 = 40 (a1 = 0)
Train II: v2 = 35 (a2 = 0)
Distance:  300

Results:
Time:  4
Position:  160

Example 2:  Acceleration
Train I:  v1 = 40, a1 = 0.5
Train II: v2 = 35, a2 = 0.8
Distance:  300

Results:
Time:  3.87018761454
Position:  158.552092625

Thank you to Gianfranco Cazzaro, Dieter, and all who wrote to me pointing out the errors.  

Eddie

This is blog is property of Edward Shore, 2018.


Monday, February 19, 2018

Retro Review: Texas Instruments BA-55




General Information

Company:  Texas Instruments
Type:  Programmable Finance
Memory:  40 steps, 10 cash flows
Battery:  2 * A376, LR44, or SR44
Years:  1982 - 1986
Editions:  2:  1982 (BA-55), 1986 (BA-54)
Original Cost: Unknown




Features

There are four main categories of functions that are provided with the BA-55:  programming, time value of money (finance), cash flows, and statistics including linear regression, separated into three modes.  The programming and finance categories are combined in a single category.  Switch modes by pressing [ 2nd ] [ R/S ]. 

Program/Finance Mode

Time Value of Money:  The BA-55 has the standard time value of money solver, with the interest key, [ %i ], working with periodic interest.  In annuities, you can calculate principal and interest for a single payment, accumulated interest, and balance.  The keystrokes are:

Principal/Interest for a single payment:  [ 2nd ] [ N ]

Accumulated interest from payment 1 to n: [ 2nd ] [ i% ]

Balance after n payments:  [ 2nd ] [ PMT ]

There are also two keys for interest conversions between nominal ( [APR>] ) and effective ( [<EFF] ) interest rates are available.

Programming:  The programming module of the BA-55 is basic, with a maximum of 40 steps.  The number of memory registers, which top out at six (R0 – R6) decrease with every eight steps, and the memory will be allocated automatically.  One of the best features is that during programming, the screen will show how many memory registers are available.   Memory register 0 will always be available. 

The reset instruction ( [ RST ] ) points the instruction point to Step 00 and will continue.  This allows for simple loops. 

The BA-55 operates on a chain operating system, not the algebraic system.  For example, pressing 2 [ + ] 3 [ * ] 4 [ = ] returns 20.  So be careful. 

Cash Flow Mode

The BA-55 can handle up to 11 cash flows, which I implied from storing the initial cash flow in PV, the other cash flows stored in registers 1-9, with the last one using the sequence [ STO ] [ . ].

Net Present Value:  [ 2nd ] [ PV ]

Initial Rate of Return:  [ 2nd ] [ FV ]

The interest rate is stored with the [ %i ] key.

There is only one memory register available in this mode, register 0.

Statistics Mode (Linear Regression)

The BA-55 handles one and two variable statistics.  Since this is an older calculator, entering data will cause the BA-55 to process of a half a second before showing you the data count.  You can calculate the slope, intercept, and correlation using the linear regression model, and it is nice that the keys are labeled descriptively with Slope, Intcp, and Corr, respectively.

However, the statistics features on the BA-55 are stripped.  Missing are the forecasting function for x (there is a forecasting function for y), the data count (n), and the sums (Σx, Σy, Σx^2, Σy^2, Σxy).  Given that there are only a maximum of four registers (R0 – R3), I was mistaken to think the sums would be allocated to R4 – R9. They are not.

Like in the Financial/Programming mode, memory register 0 will always be available.

What Was Up with the Colors on the Keys?

One of the most peculiar things about the BA-55 are the colors used.  On the 2nd row from top, I could see the primary markings OK (black on tan), but the secondary markings are light, faint gold against a taupe background.  The secondary text is so light you wouldn’t even notice that they were there.  If you purchase a BA-55, make sure you get the manual (or the manual of a BA-54).  For the record the second row of keys are:

[ N ]  (2nd:  P/I)
[ i% ] (2nd: Acc)
[ PMT ]  (2nd:  Bal)
[ PV ] (2nd: NPV)
[ FV ] (2nd: IRR)

On the first row:

[ CPT ] (2nd: Due)

On the fourth row from top, the secondary markings are in pink, and the text can clearly be seen.  I wish TI applied this color scheme everywhere where the keys that were on a taupe background.

Thankfully the color scheme for the BA-54, the successor to the BA-55 (no, that’s not a typo), improves on the color scheme.  You can check the two pages from http://www.datamath.org/  for more details. 

Printer Features

A unique feature to the BA-55 are the four printing functions Adv (advance), List (list the program), Print, and Trace.  This allowed the BA-55 to be connected to a PC-200 printer.  The PC-200 printer was also made for the TI-66.

Verdict

I like the design of the BA-55 with its tilted display.  The keys are easy to press and are responsive.  Again, there is a slight processing time due it being an older machine.  The colors of the BA-55 though, could use improvement.

As I mentioned before, I think the programming module is more a secondary feature than a primary one.  Unfortunately, the only mode the program steps are allowed is the Financial mode. It is nice for it be available for quick calculations but it wouldn’t beat the HP 12C’s programming module.  I would have liked to see the programming available in all the modes.

And there is no days between dates function either.  (That particular function doesn’t show up on TI’s basic financial calculators, so that is to be expected.)

As far as a basic financial calculator, the BA-55 will do the job.  The programming, while limited, provides for some storage of a quick calculation.  I also like the pouch and the well-written quick reference guide.

Eddie


This blog is property of Edward Shore, 2018.

Thursday, February 15, 2018

Retro Review: Texas Instruments TI-60

Retro Review:  Texas Instruments TI-60





General Information

Company:  Texas Instruments
Type:  Programmable Scientific
Memory:  84 steps or 12 memory registers
Battery:  2 * Duracell MS76, Panasonic WL-14, Eveready 376 or 303, AG-13, SR44
Years:  1986 – 1991
Editions:  2:  1986 (Advanced Scientific), 1990 (Programmable Scientific)
Original Cost: $50

Features

The TI-60 is a scientific keystroke programmable calculator, largely based off of the original TI-55 (1977).  The features of the TI-60:

Operating System:  AOS (Algebraic Operating System)  (like the TI-30Xa)
Programming:  Up to 56 program steps
Statistics:  Linear Regression
Conversions:  °F/°C, DMS/DD, in/cm, lb/kg, gal/L
Base Conversions:  Octal and Hexadecimal, has 2’s complement
Memory Registers: Up to 8, competed with both statistics and programming
Other Functions:  Percent Change, Absolute Value, Signum, Integer Part, Fractional Part
Integration
Shift Keys: 2nd, hyp, INV
Storage Arithmetic:  +, -, *, ÷, ^, roots, percent change

Percent Key (Δ%) 

I think the percent works backwards than modern calculators.   Press the new value first, then [2nd] [ . ] ( Δ% ), then old value, [ = ].

Example:  Percent change from 32 to 56:  56 [2nd] [ . ] (Δ%) 32 [ = ] 75  (75% increase)

Combinations and Permutations

Like the TI-55 III, the arguments for combination and permutation functions take one argument in the form of nnn.rrr.  

Example:

Combination where n = 25, r = 5 is entered as 25.005 [2nd] [ + ] (nCr)  
(Result: 53,130)

Permutation where n = 25, r = 5 is entered as 25.005 [2nd] [ = ] (nPr)  
(Result:  6,375,600)

Rectangular/Polar Conversion

[2nd] [x<>y] (P-R):  to Rectangular.  Input:  r [x<>y] θ [2nd] [x<>y] (P-R).  Result: y [x<>y] x.

[INV] [2nd] [x<>y] (P-R):  to Polar.   Input x [x<>y] y [INV] [2nd] [x<>y] (P-R).  Result:  θ [x<>y] r.

Linear Regression

The TI-60 has the parts labeled Intcp (y-intercept) and Slope. Running the statistics mode reduced the maximum number of steps to 20 until the statistics registers were cleared.

TI-60 vs TI-55 III



TI-60
TI-55 III
84 maximum steps or 12 memory registers
56 maximum steps or 8 memory registers
Clear programs outside of Learn mode
Clear programs inside of Learn mode
Each step you keyed is displayed in a PC(step #)  OP(key code #) format
After each step, display is advanced to next available step, have to press BST to view what you just did, like the TI-58 series
Base Mode:  Octal and Hexadecimal
No base mode
The RST (reset) instruction loops to Step 00
The RST (reset) instruction stops execution, directs program to Step 00

Verdict

I wish TI had implemented this keystroke system earlier.  I like the fact that the RST instruction allowed for loops.  I like that the user can see what was pressed after each step. 

The TI-60 came at the tail end of the keystroke programmable calculators for Texas Instruments.  The keys are a pleasure a press, the contrast of the fonts is for the most part, excellent, except for the gray 1/x and 2nd functions on a gray background.

For the keystroke calculators from Texas Instruments, the TI-60 one of my favorite, second to the TI-58C. 

Eddie


This blog is property of Edward Shore, 2018.

Wednesday, February 14, 2018

HP Prime and TI-84 Plus CE: Graduated Mortgage Payments

HP Prime and TI-84 Plus CE:  Graduated Mortgage Payments

Introduction

The program GRADMORT calculates the payment schedule of a graduated mortgage.  A graduated payment mortgage (GPM) is a mortgage option that allows home buyers, particularly young, first-time home buyers, to purchase a home.  The payments increase by a set percentage of at annual rate for several years until it reaches a plateau. 

According to Daniel T. Winkler’s and G. Donald Jud’s article, “The Graduated-Payment Mortgage: Solving the Initial Payment Enigma” (see Source at the end of the blog entry), the HUD (United States Department of Housing and Urban Development), offers five graduated payment schedule plans, known as Section 245 loans. 

In the article Winkler and Jud derive a formula for solving for the first tier payment.  The article states the solution for a two-tier case and a general case.  The program GRADMORT covers the general case.

Variables:

A = amount of the mortgage (PV).

I = periodic monthly interest of the mortgage, I%YR/1200.

T = Number of years the payment increases.  For example, if T = 5, then the payment would increase 5 times, once a year, until it reaches the final constant payment on year 6

C = The payment’s annual percent increase, C%/100.

N = The term of the mortgage, in years.

P = The initial payment (PMT).  To calculate the payments for subsequent years, multiply the last result by (1 + C).  (hence, add C% every year for each tier)

The general formula:

P = A / ( (1 + Σ((1 + C)^(k)/(1 + I)^(12*k), k, 1, N-1) * ( 1/I * (1 + I)^(-12) )
+  (1 + C)^N/(1 + I)^(12*N) * (1/I * (1 – (1 + I)^-(12*T – 12*N) )

The program breaks the formula into smaller parts for calculation purposes.

GRADMORT returns a two column matrix, the first column is the year and the second column is the payment.  The last row shows the payment when it stabilizes (stops increasing).

Monthly payments and end of period payments (end of month) are assumed.  Property taxes and interest are not calculated in this program.

HP Prime Program GRADMORT

EXPORT GRADMORT()
BEGIN
// Graduated Mortgage
// Winkler, Jud
// 2018-02-11 EWS

LOCAL A,I,N,C,T,mat;
LOCAL P,X,Y;

INPUT({A,I,N,C,T},"Graduated
Mortgage",{"Loan Amount:",
"Loan Rate: ","# Tiers: ",
"% Increase: ","Term (yrs): "});

I:=I/1200;
C:=C/100;

X:=Σ((1+C)^K/(1+I)^(12*K),K,0,N-1);
X:=X/I*(1-(1+I)^(−12));
Y:=(1+C)^N/(1+I)^(12*N);
Y:=Y/I*(1-(1+I)^−(12*T-12*N));
P:=A/(X+Y);

mat:=[[1,P]];
LOCAL k;
FOR k FROM 1 TO N DO
mat:=ADDROW(mat,
[k+1,mat[k,2]*(1+C)],k+1);
END;

RETURN mat;

END;

TI-84 Plus CE Program GRADMORT

"GRADUATED MORTGAGE"
"WINKLER/JUD"
"EWS 2018-02-11"
Input "LOAN AMT: ",A
Input "LOAN RATE: ",I
I/1200→I
Input "NO. TIERS: ",N
Input "INCREASE: ",C
C/100→C
Input "LOAN TERM (YRS): ",T

Σ((1+C)^K/(1+I)^(12*K),K,0,N-1)→X
X/I*(1-(1+I)^(­12))→X

(1+C)^N/(1+I)^(12*N)→Y
Y/I*(1-(1+I)^­(12T-12N))→Y

A/(X+Y)→P
{1}→L1
{P}→L2
For(K,1,N)
augment(L1,{K+1})→L1
augment(L2,{L2(K)*(1+C)})→L2
End
List→matr(L1,L2,[A])
Disp [A]

Example

A young couple, who just graduated from college and starting on their careers, have qualified to participate in a GPM.  They will finance a $200,000 mortgage at a fixed annual interest of 4.4%.  Payments increase 2.1% for the first five years of the 35 year mortgage. 

Variables (the program will prompt you for the amounts):

Loan Amount:  200000
Loan Rate:  4.4
# Tiers:  5
% Increase: 2.1
Term (yrs): 35

Results:

Matrix:
[ [1, 855.231019434]
[2, 873.190870842]
[3, 891.52787913]
[4, 910.249964592]
[5, 929.365213848]
[6, 948.881883339] ]

Year 1:  $855.23
Year 2:  $873.19
Year 3:  $891.53
Year 4:  $910.25
Year 5:  $929.37
Year 6 (years 6 – 35):  $948.88

Source 

Winkler, D.T. an G.D. Jud.  “The Graduated Payment Mortgage:  Sovling the Initial Payment Enigma”  Journal of Real Estate Practice and Education, vol. 1, 1998, pp 67-79.  Retrieved February 10, 2018.  Link:  https://libres.uncg.edu/ir/uncg/f/D_Winkler_Graduated_1998(MULTI%20UNCG%20AUTHORS).pdf

Eddie


This blog is property of Edward Shore, 2018.

Tuesday, February 13, 2018

HP Prime: TrigPlot App (HP Prime Custom app Tutorial)

HP Prime: TrigPlot App  (HP Prime Custom app Tutorial)

Introduction

Here is another example custom app, the TrigPlot, which plots the following equation:

y = A * sin(Bx + C) + D * cos(Ex + F) + G * sin(Hx + I)^2 + J * cos(Kx + L)^2

where all angles are in radians.  The app uses the global variables A through L. 

Keys

[ Num ]:  The user enters values for A – L.  They must be real (not complex or have a (-1) component)

[ Plot ]:  Enter plot parameters and choose the color of the plot (purple, blue, green, gold, red).  The plot is against a black background.

[ View ], Erase A-L:  Sets the variables A through L to 0 (zero).

[ Info ]:  Displays information about the app

Notes



The Info section introduces the user to the app’s concept:

Info()
BEGIN
// This is when the user presses
// Shift+Apps (Info), use Print
// commands

PRINT();

PRINT("TrigPlot App");
PRINT("------------");
PRINT("By Edward Shore");
PRINT("------------");
PRINT("This app plots the equation");
PRINT("Y = A*SIN(B*X+C) + D*COS(E*X+F) +");
PRINT("G*SIN(H*X+I)^2 + J*COS(K*X+L)^2");
PRINT("------------");
PRINT("February 2018");

END;


To ensure the app always runs in Radians mode, I store the value 1 to AAngle during startup (START).  In addition, I added the Info(); to show the Info screen.

START()
BEGIN
// This happens when the app is started.

// Set the app to radians angle mode.
AAngle:=1;
// This is a specific app mode setting
// unlike HAngle

// Also run the Info screen
Info();

END;

The Plot portion of app is based on the Pixel Plot program (see http://edspi31415.blogspot.com/2018/02/hp-prime-pixel-plot-how-to-change.html ) where pixels are plotted.

HP Prime Program:  TrigPlot (in app TrigPlot)

#pragma mode( separator(.,;) integer(h32) )

//Symb()
//BEGIN
// MSGBOX("Symb");
//END;

Plot()
BEGIN
// runs the Plot routine
// set color scheme
LOCAL col1;
col1:={#BF00FFh,#7DF9FFh,
#00FF00h,#D4AF37h,#FF0000h};

// Radians
HAngle:=0;

// localize variables
LOCAL xm,xn,ym,yn;
LOCAL xs,ys,xp,yp;
LOCAL x,y,ch;

// input screen
INPUT({
xm,xn,ym,yn,
{ch,
{"Purple","Blue","Green",
"Gold","Red"}}},
"TrigPlot Setup: Plot",
{"x-min: ","x-max: ",
"y-min: ","y-max: ",
"Color: "});

// set black background
RECT_P(0);

// calulate the scale
xs:=(xn-xm)/320;
ys:=(yn-ym)/−220;

// drawing

// color choice
LOCAL c1:=col1[ch];

// axis information
LOCAL st1,st2;
st1:="x:["+xm+","+xn+"]";
st2:="y:["+ym+","+yn+"]";
TEXTOUT_P(st1,0,0,2,#C0C0C0h);
TEXTOUT_P(st2,0,20,2,#C0C0C0h);

// function
FOR x FROM xm TO xn STEP xs DO

// function
y:=A*SIN(B*x+C)+D*COS(E*x+F)+
G*SIN(H*x+I)^2+J*COS(K*x+L)^2;

// point→pixel, plot
xp:=(x-xm)/xs;
yp:=(y-yn)/ys;
PIXON_P(xp,yp,c1);

END;
// freeze screen
FREEZE;

END;

Num()
BEGIN
// This is where all the variables are
// entered, in one easy spot. A-L are
// global in this application.
INPUT({A,B,C,D,E,F,G,H,I,J,K,L},
"TrigPlot Variables");
END;

//SymbSetup()
//BEGIN
// MSGBOX("SymbSetup");
//END;

//PlotSetup()
//BEGIN
// MSGBOX("PlotSetup");
//END;

//NumSetup()
//BEGIN
// MSGBOX("NumSetup");
//END;

Info()
BEGIN
// This is when the user presses
// Shift+Apps (Info), use Print
// commands

PRINT();

PRINT("TrigPlot App");
PRINT("------------");
PRINT("By Edward Shore");
PRINT("------------");
PRINT("This app plots the equation");
PRINT("Y = A*SIN(B*X+C) + D*COS(E*X+F) +");
PRINT("G*SIN(H*X+I)^2 + J*COS(K*X+L)^2");
PRINT("------------");
PRINT("February 2018");

END;

START()
BEGIN
// This happens when the app is started.

// Set the app to radians angle mode.
AAngle:=1;
// This is a specific app mode setting
// unlike HAngle

// Also run the Info screen
Info();

END;

//RESET()
//BEGIN
//MSGBOX("RESET");
//END;

//VIEW "Views", Views()
//BEGIN
// MSGBOX("Views");
//END;

VIEW "Erase A-L", ERASEAL()
BEGIN
A:=0; B:=0; C:=0; D:=0; E:=0; F:=0;
G:=0; H:=0; I:=0; J:=0; K:=0; L:=0;
END;

Examples

Example 1:  y = 2 sin(x + 2) – 3 cos x
A = 2, B = 1, C = 2, D = -3, E = 1 (the rest are zero)



Example 2:  y = 2 cos(2x) + 1.5 * cos^2 x
D = 2, E = 2, J = 1.5, K = 1 (the rest are zero)



Eddie


This blog is property of Edward Shore, 2018.