  ## Examples — Computing with RPN-45

1 - Pearson correlation coefficient and regression line
Clear the statistics registers using CLEAR. Enter the following value pairs (for each pair: y ENTER x, then Σ+):

 y x 92 85 78 81 54 51 40 26 30 44 50 62 68 74

Tap L.R. and roll down the stack to see all results.

The regression line is defined by y = -1.035x + 121.038

The correlation coefficient is -0.957 (strong negative correlation), the covariance is -354.143.

What's the value of y for x = 10?   10  x^,y^,r  = 110.691 (in Y)

What's the value of x for y = 20?   20  x^,y^,r  = 97.655 (in X) 2 - Sample and true standard deviation The x-values in the example above have a mean value of 50.571 and a standard deviation of 18.501. This is correct under the assumption that the seven values are just samples out of a large number of values. If however the seven values represent the total set of values, you get the true standard deviation by adding the mean as another sample: After computing the mean, tap Σ+ and compute the mean again. The mean remains unchanged, of course, but the standard deviation is smaller: 17.129

 3 - Lottery How can I create numbers for the California Fantasy 5 lottery? You're going to pick five numbers from a field of 39: 1  ENTER  39  ENTER Tap RAN# repeatedly to get your random numbers, skipping any duplicates. How many different sets of 5 numbers are there? 39  ENTER  5  Cx,y  = 575,757

 4 - Odd root of a negative integer What is the 7th root of -2187 ? Input: 2187  CHS  ENTER  7  1/x  yx yields -3 Interestingly, most calculators can't handle this, producing an error message instead. Or a complex number. (If you're interested in the complex solution, perform the calculation in mode CMPLX.)

 5 - Cubic equation Find the solutions of x3 - 4x2 + 8x - 8 = 0 Input: 1  ENTER  4  CHS  ENTER  8  ENTER  CHS  Cube shows the real root x1 = 2.000. Roll down the stack to see the complex conjugate roots: x2,3 = 1.000 ± 1.732i Verifying x2 (assuming the real part 1.000 is still in X, the imaginary part 1.732i in Y): CMPLX  ENTER  ENTER x2  x  LastX  4  x  – x↔y  8  x  +  8  –

6 - Linear equation in two unknowns
Added together, a father and his son are 62 years old. Six years ago, the father was four times the age of the son. How old are they now?

With x = age of the father, y = age of the son:

x + y = 62
x - 6 = 4 * (y-6)

Putting all unknowns to the left side of the equal signs, we get:

1*x + 1*y  = 62
1*x - 4*y = -18

The coefficients map to the storage registers as follows:  = 1 1 62  = 1 -4 -18

Store the coefficients and execute the calculation:

1  STO 4     1  STO 5     62  STO 6
1  STO 1    -4  STO 2    -18  STO 3
LinEq

We get x = 46 (father) and y = 16 (son).

 7 - Euler's identity Put RPN-45 in complex mode and verify the famous Euler identity eiπ + 1 = 0: Tapping  π  Re↔Im  ex  1  +  results in 0.00 + 0.00i This is just another form of the same formula: π = -i ln(-1) 1  CHS  ENTER  ln  x↔y  Re↔Im  x  = 3.142 + 0.000i  = π

 8 - Cube root of a complex number What is the cube root of 5 + 3i ? Input:  CMPLX  5  ENTER  3  I  3  1/x  yx  yields 1.771 + 0.322i For natural numbers n, the nth root of a complex number has n solutions. The method shown above only produces the principal solution.

 9 - Complex numbers in polar form How to calculate 2(cos 65° + i sin 65°) + 3(cos 40° + i sin 40°) [polar form] or 2∠65° + 3∠40° [phasor form]? RPN-45 assumes that complex numbers are given in rectangular form. Use →R and →∠ to do the required conversions. Input:  CMPLX  DEG  2  ENTER  65  I  →R  3  ENTER  40  I  →R  +  →∠   results in 4.8863(cos 49.9612° + i sin 49.9612°) or 4.8863∠49.9612°

10 - Calculating with complex numbers
Here's an example to demonstrate how evaluating an expression involving complex numbers is as easy to do as with real numbers.
Assuming that RPN-45 has been set to complex mode, the angular mode is degrees (DEG), and the display has been set to four decimal digits (FIX 4):

 Evaluate: 2  Re↔Im 0 Real part = 0.0000, imaginary part = 2.0000 8  CHS  ENTER  6  I -8 -8 + 6i 3  yx 352 (-8 + 6i)3 x -1872 2i (-8 + 6i)3 4 ENTER 5 √x 2 CHS x -4.4721 -2√5 I 4 4 - 2√5 i ÷ -295.455 2i (-8 + 6i)3 / (4 - 2√5 i) 2 ENTER 5 √x 4 CHS x -8.9443 -4√5 I 2 2 - 4√5 i ÷ 9.3982 Real part of the result Re↔Im -35.1344 Imaginary part of the result

11 - The "DATE" Function
DATE returns the date and the day of the week of a date, as well as the date and day of the week of any date a number of days apart from the date in Y (both in the future and in the past).
ΔDYS returns the number of days between date y and date x.
The accepted range is Jan 1,0001 through Dec 12,9999.
The following examples reflect the date format used in the U.S.A. and in English-speaking Canada, i.e. month first, followed by day. For all other regions, day and month must be swapped.

 DATE:Input Result Notes 12.252000 12.25.2000 Monday Christmas in year 2000 12.252 12.25.0002 Monday Christmas in year 2 12.25002 12.25.0020 Wednesday Christmas in year 20 1.7 1.07.2012 Wednesday January 7 of the current year 25.1 1.25.2012 Wednesday Months too large are treated as days (if possible and unambiguous) 25.25 0.00 (blinking) Illegal date 10.25 10.25.2012 Thursday October 25 of the current year 3.201727 3.20.1727 Thursday Isaac Newton's day of death (Gregorian calendar) -3.201727 3.20.1727 Monday Isaac Newton's day of death (Julian calendar) 3.174 3.17.0004 Monday Short for 3.170004 3.17400 3.17.0400 Saturday Short for 3.17400 -8.011291 8.01.1291 Wednesday 8.011291 8.01.1291 Wednesday Dates before Oct 15,1582 always use the Julian calendar 0 (Today's date) Y may not contain a valid date (except today's date) 25 (Date in 25 days) Y may not contain a valid date (except today's date) -500000 (Date half a million days ago) Y may not contain a valid date (except today's date) 100 6.09.1815 Friday y = 3.011815 (Napoleon's landing near Antibes)

 ΔDYS: Input Result Notes 3.011815 ENTER 6.221815 113 Napoleon's "Hundred Days" 9.011939 ENTER 9.021945 2193 Duration of World War II 1.012005  ENTER  9.012005   ΔDYS  x↔y 240 Number of days on the basis of 30 days per month

 12 - Calendar Reform The Gregorian calendar hasn't been universally accepted from the beginning (1582). Britain and the British Empire, for example, adopted the Gregorian calendar in 1752. Which Gregorian date followed the last Julian date, Wednesday, 2 September 1752? Input: -2.091752  DATE  1  DATE  results in Thursday, 14 September 1752 In Russia the October Revolution was in fact a November Revolution: Input: -25.101917  DATE  0  DATE  = Wednesday, 7 November 1917

 13 - Extended Σ+ Functions The key Σ+ may be used in conjunction with STO and RCL. STO  Σ+ stores x in R7, y in R8, RCL  Σ+ retrieves the register values to x and y, respectively. Register arithmetic may be applied as STO/RCL  [op]  Σ+, where [op] is one of the basic functions addition, subtraction, multiplication, or division. This makes it easy to process 2-dimensional values like vectors. All operations may be used in complex mode. Example: Find half of the sum of the vectors (6,7) and (8,11). Input: 7  ENTER  6  STO  Σ+  11  ENTER  8  STO  +  Σ+  0.5  ENTER  RCL  x  Σ+  returns the result vector (7,9)

14 - Weighted Mean
You fill your gas tank 30 times at the following prices:

 Price per gallon (y) Number of times (x) 3.66 3.71 3.64 3.79 3.72 3.69 3.8 9 7 2 1 4 4 3

What's the average gas price?

Clear the statistics registers with CLEAR. Enter the values shown above (for each pair: y ENTER x, then Σ+).

Result: xw,s = 3.70 (with a standard deviation of y = 0.05)

 15 - Remarkable Formulas Use RPN-45 to easily verify the following strange formulas: 1 - Norwegian mathematician Caspar Wessel (1745 – 1818) found this expression: Make sure the calculator is set to angular mode DEG and activate mode CMPLX. 4  ENTER  3  √x  x  4  I  3   1/x  yx   →∠ (read the imaginary part of the result as 10°) 2 - Benjamin Peirce, an American mathematician (1809 bis 1880), called the following relation "a mysterious formula": Activate CMPLX mode, then compute Pi minus the right side of the equation: π  2  ENTER  1  Re↔Im  ÷  LastX  ln  x   –  (the result is 0, as expected)