Showing posts with label custom functions. Show all posts
Showing posts with label custom functions. Show all posts

Thursday, June 16, 2016

Casio Classpad Functions: Coordinate, Bearing, Slope, Triangle Area, Electric Oscillation, RLC Impedance

Casio Classpad Functions:  Coordinate, Bearing, Slope, Triangle Area,  Electric Oscillation, RLC Impedance 


Nothing like doing some programming while on vacation. :)

Civil Engineering/Geometry:  tcoordin, bearing, cslope, aritri

For the following, enter coordinates in complex number format:  (east coordinate) + (north coordinate)*I  (x + y*i).  For example, enter the coordinate (3, 6) as 3+6i.

Coordinate Calculation - tcoordin



Inputs:  pt, len, ang
pt = point 0, enter as a complex number
len = length of travel
ang = bearing angle (treated as degrees)

Output:
Point 1 (as a complex number)

Function:
approx(pt+compToRect(∠(len,ang°)))

Example:
tcoordin(4 + 5*i, 24.2, -10) returns 27.83234762+0.7977141005*i

Bearing Angle (from East) – bearing

Inputs: pt1, pt2
pt1 = point 1, enter as a complex number (start)
pt2 = point 2, enter as a complex number (end)

Output:
A list of two elements:  length, bearing from point 1 (depending on setting)

Function:
approx({abs(pt2-pt1),arg(pt2-pt1)})

Example:
bearing(-2.2+3i, 4+2i) returns {6.280127387, -9.162347046} (degree mode)

Slope Between two Points (extra) – cslope

Inputs: pt1, pt2
pt1 = point 1, enter as a complex number (start)
pt2 = point 2, enter as a complex number (end)

Output:  Slope from point 1 to point 2.

Function:
approx(im(pt2-pt1)/re(pt2-pt1))

Example:
cslope( 7+7i, 2+16i ) returns -1.8

Area of a Triangle knowing the Vertex Points – aritri



Inputs: pt1, pt2, pt3
pt1 = point 1, enter as a complex number
pt2 = point 2, enter as a complex number
pt3 = point 3, enter as a complex number

Output:  area of the triangle

Function:
approx(abs(.5*(re(p1-p2)*im(p3-p1)+re(p1-p3)*im(p1-p2))))

Example:
aritri(0, 4+7i, 2+5i) returns 3
0 = 0 + 0i


Electrical Functions:  rlcserim, rlcparim, freqosc

Functions for RLC posted are now corrected - EWS 6/26/2016

Impedance of an RLC Series Circuit:  rlcserim



Inputs:
r = resistance (in Ohms)
c = capacitance (in Farads)
l = inductance (in Henrys)
f = frequency (in Hertz)

Output:
z = impedance (in Ohms)

Function:
approx(√(r^2+(2*π*f*l-1/(2*π*f*c))^2))

Example:
rlcserim(10, 500E-6, 2E-3, 2000) returns 26.90130131 ohms

Impedance of an RLC Parallel Circuit:  rlcparim
  
Inputs:
r = resistance (in Ohms)
c = capacitance (in Farads)
l = inductance (in Henrys)
f = frequency (in Hertz)

Output:
z = impedance (in Ohms)

Function:
approx(1/√((1/r)^2+(2*π*f*c-1/(2*π*f*l))^2))

Example:

rlcparim(40, 550E-6, 2E-3, 1000) returns 0.2961851056

Frequency of Electric Oscillation – freqosc

Inputs:
l = coil self-inductance (in Henrys)
c = capacitance (in Farads)

Output:
f = frequency (in Hertz)

Function:
approx(1/(2*π*√(l*c)))

Example:
freqosc(550E-6, 2E-3) returns 151.7482841

Sources:

Casio.  “fx-FD10 Pro User’s Guide” and “fx-50F Plus User’s Guide”.  2014 and 2006, respectively

This blog is property of Edward Shore, 2016.



Friday, September 25, 2015

HP Prime Spreadsheet App Tutorial 9: Custom Functions in the Spreadsheet App and the AMORT Function

HP Prime Spreadsheet App Tutorial 9:  Custom Functions in the Spreadsheet App and the AMORT Function




Lesson 9 Objectives:

* Defining a Custom Function
* Using a Custom Function in the Spreadsheet
* Using the AMORT Function

Background:

The AMORT function is found by pressing [ Menu ], 6.   It’s syntax is:

AMORT(range where you want your output, number of periods, annual interest rate, present value, payment, [payments per year (default is 12), grouping (default is 12), Beg (FALSE for end of period, TRUE for beginning of period payments), fix (default is 2)], [“Configuration”])

Anything enclosed in brackets [ ] are optional arguments.  I recommend that you type a single cell for the range of output, letting the Spreadsheet app worry about calculating the appropriate size of the amortization table.

Steps:

Setup:

1.     Clear the Spreadsheet.
2.    Select the cell with the hp logo.   Set the spreadsheet to Fixed format with 2 decimal places by using the (Format) command.

Create the Function:

3.     Press the [ Home ] key, then press [ Shift ], [x t θ n] (Define).  This takes you to the Define screen.  You will see two fields: Name and Function.  The order of the arguments take is taken from when they first appear in the Function.
4.    Name the function PYMT for payment.
5.    Type the formula in the Function field:  (-.01*R/C*P) / (1 – (1+.01*R/C)^-N).  Once you check it for accuracy, press (OK).
6.    You can test the function PYMT on the Home Screen.  PYMT(R,C,P,N) has four arguments:
·         R = annual interest rate
·         C = number of payments per year
·         P = present value
·         N = number of periods


Back to the Spreadsheet:

7.     Type the following labels:
·         A1 = “N”
·         B1 = “INT”
·         C1 = “PV”
·         D1 = “PMT”
8.    Type the following amounts and formulas:
·         A2 = 360  (for 360 payments)
·         B2 = 5  (for an annual interest rate of 5%)
·         C2 = 140000  (for the present rate of $140,000)
·         D2 = PYMT(B2,12,C2,A2)  (to calculate the payment, which should be -751.55)
9.    Go to cell A4.  Type =AMORT(A4,A2,B2,C2,D2,12)*.  An amortization chart is produced.

* There was an error pointed to me by Michael Kokot.  It is corrected now.  I thank you Kokot for bringing it to my attention.

Eddie 10/8/2015



This concludes Lesson 9.  Hope you find this helpful,

Eddie


This blog is property of Edward Shore, 2015.



HP 15C: The I Squared Rule and HHC 2026

HP 15C: The I Squared Rule and HHC 2026 HHC 2026 Videos Before we start, the videos for HHC 2026 are up! Please take a look, ev...