Showing posts with label area of a polygon. Show all posts
Showing posts with label area of a polygon. Show all posts

Sunday, April 3, 2016

Casio Classpad fx-CP400: Defining Functions

Casio Classpad fx-CP400:  Defining Functions

Using the Define command with the Classpad

A lot of formulas can be created using the Define command on the Casio Classpad.  For this blog I am using the fx-CP400.  My preference is to use the Main application, and call the Define command from the Action>Command submenu.  The expressions are stored as Functions.  If you want to transfer functions (and programs) from the fx-CP400 to a computer drive, export them to the Save-F folder first and then connect the Classpad to the computer.


Fibonacci Numbers

fibon(n) = approx((1+√5)^n – (1-√5)^n)/(2^n * √5)

The approx command is used in order to force a simplified numerical answer. 



Error Function

erf(z) = 2/√π * ∫ (e^-x^2 dx from 0 to z)

I think numerical integrals return approximate answers no matter what, please correct me if I am wrong.



Digital Root:  Counting all digits of a number, repeating the process until you get a single digit (0-9)

dr(n) = 1 + mod(n-1, 9)

I could only find the mod function in the catalog.  Unlike most Casio calculators, the Classpad’s mod function accepts negative numbers and non-integers.



Area of a Regular Polygon

aregpoly(n,s) = (n*s^2) / (4 * tan(180°/n))

The degree symbol (°) is needed to allow proper calculation regardless of angular mode.  The degree symbol is found in the Trig soft menu.



Great Circle: Distance between two places in kilometers

Note:

*  In order for the function to work properly, the Degree mode must be selected.

*  You can enter degrees in terms of degrees, minutes, seconds by choosing the DMS template.  This template is in the Math1 soft keyboard and is represented by three boxes (□ □ □) next to toDMS.  You can also call the template by pressing Action/Interactive, Transformation, DMS, dms.   The dms command’s syntax is  dms(degrees, minutes, seconds) and transforms the input into degree decimals.

Example:
Los Angeles,  N: 34°13’, E: -118°15’;   Tokyo,  N: 35°41’22.22”, E: 139°42’30.12”
Distance ≈ 8,803.002688 km

Formula (for km):
Distance ≈ cosˉ¹ (sin N1 sin N2 + cos N1 cos N2 cos (E1 – E2)) * 6371 * π / 180

If you want US miles, replace 6371 with 3959.



This blog is property of Edward Shore, 2016.


Sunday, June 15, 2014

HP 15C: Area by Verticies With Curve Segments (with Jason Foose)

Introduction

On June 6, 2014, I posted a revised program for the HP 15C to find the area of a polygon by given the coordinates of each vertex. You can see this post here:

http://edspi31415.blogspot.com/2014/06/hp-15c-area-of-polygon-by-vertices.html

Jason Foose, County Surveyor at Mohave County Public Works in Kingman, AZ contributed an addendum to the program:  this allows you to enter curve segments and calculate the total area based on vertices and the curve segments.  Jason Foose can be found on Google+ and on Linkedin. 

General Instructions

The idea is to first enter all the coordinates of the vertices and calculate the area, then enter the curve segments and recalculate the area.  Start at one at one point and work in either the clockwise or the counterclockwise motion.  

Hence:

1.  Enter initial coordinates (x0, y0):  y0 ENTER x0 LBL A
2.  Enter additional coordinates:  y ENTER x LBL B
3.  Calculate area with coordinates:  LBL C
4.  Enter radius and central angle, in HMS format:   radius ENTER angle LBL D
5.  Calculate final area:  LBL E

When entering the radius and central angles, use positive values for radius for "outies", chord lines that add to the area.  Use negative values for "innies", or chords that cut across the area.   The 15C should be in Degrees mode. 

The Expanded Program

Here is the program in full.  Instructions in bold red are contributed by Jason Foose.  


Memory registers used:
R0 = area
R1 = x_i
R2 = y_i
R3 = x_i+1
R4 = y_i+1
R5 = Σ (x_i * y_i+1) // ( i=1...n and cycle back to 1)
R6 = Σ (x_i+1 * y_i)
R7 = x_1
R8 = y_1


Program:


001   42, 21, 11   LBL A  // enter initial vertex
002            0       0
003       44   5   STO 5

004       44   6   STO 6
005           33   R down // R↓
006       44   1   STO 1
007       44   7   STO 7
008           33   R down
009       44   2   STO 2
010       44   8   STO 8
011       43  32   RTN

012   42, 21, 12   LBL B // step 12 - add verticies
013       43   3   STO 3
014   45, 20,  2   RCL× 2
015   44, 40,  6   STO+ 6
016           33   R down
017       44   4   STO 4
018   45, 20,  1   RCL× 1
019   44, 40,  5   STO+ 5

020       45   4   RCL 4
021       44   2   STO 2
022       45   3   RCL 3
023       44   1   STO 1
024       43  32   RTN

025   42, 21, 13   LBL C // step 25 - calculate area with vertices
026       45   7   RCL 7
027   45, 20,  2   RCL× 2
028   44, 40,  6   STO+ 6
029       45   8   RCL 8
030   45, 20,  1   RCL× 1
031   44, 40,  5   STO+ 5
032       45,  5   RCL 5
033   45, 30,  6   RCL- 6
034       43  16   ABS
035            2   2
036           10   ÷
037       44   0  STO 0

038            4   4   // where Jason's steps start
039            3   3
040            5   5
041            6   6
042            0   0
043           10   divide ÷  // convert to acres
044        43 32   RTN
045   42, 21, 14   LBL D  // step 45 - segment routine
046       43   2   >HR  
047           36   ENTER
048       42   3   >RAD
049           34   X<>Y
050           23   SIN
051           30   -
052           48   DECIMAL POINT (.)
053            5   5
054           20   *
055           34   X<>Y
056       43  11   XSQ (x^2)
057           20   *
058   44, 40,  0   STO+0
059       43  32   RTN
060   42, 21, 15   LBL E  // step 60 - convert area to acres
061       45   0   RCL 0
062            4   4
063            3   3
064            5   5
065            6   6
066            0   0
067           10   DIVIDE ÷
068       43  32   RTN
Example (Updated 6/29/2014)
 
See the diagram below.  The steps are included with the diagram.  We are going to start at the point (100,100) and go counterclockwise.  The diagram and example has been provided by Jason Foose.


 
Calculate the area with the segments:

Keystrokes:

Starting at Point (100, 100)

Coordinates:
100 ENTER 100 LBL A
100 ENTER 400 LBL B
200 ENTER 500 LBL B
300 ENTER 500 LBL B
300 ENTER 225 LBL B
425 ENTER 100 LBL B
LBL C   \\ Area:  1.9011 acres

Add segments:
100 ENTER 90 LBL D \\ "outie"  angle = 90
125 ENTER 90 CHS LBL D  \\ "innie" angle = -90
LBL E   \\ Area:  1.8643 acres

Special thanks to Jason Foose for the great addendum to the area by vertices program.  

Eddie


Friday, June 6, 2014

HP 15C: Area of a Polygon by Vertices (revised)

HP 15C: Area of a Polygon by Vertices (revised)

In December 2011, I posted a program to calculate the area of a polygon given the vertices for the HP 15C. You can find the original program here:

http://edspi31415.blogspot.com/2011/12/hp-15c-programming-tutorial-part-15.html

The problem with this, that the area is not accurate when the initial point is not (0,0). This was brought up by Jason Foose. Jason, a million thanks.

Here is another attempt at it, this time it should work with any initial point. I tested the program with several different polygons and so far, so good.

Please test and let me know what you think. The instructions remain the same:
1. Enter the initial y coordinate, press ENTER, then enter the initial x coordinate, and press [ f ] [ √ ] (LBL A).
2. For each additional point, enter the y coordinate, press ENTER, then enter the x coordinate, and finally [ f ] [ e^x ] (LBL B).
3. To calculate the area, press [ f ] [10^x ] (LBL C).

Memory registers used:
R0 = area
R1 = x_i
R2 = y_i
R3 = x_i+1
R4 = y_i+1
R5 = Σ (x_i * y_i+1) // ( i=1...n and cycle back to 1)
R6 = Σ (x_i+1 * y_i)
R7 = x_1
R8 = y_1


Program - HP 15C:
LBL A
0
STO 5
STO 6
R down \\ R↓
STO 1
STO 7
R down
STO 2
STO 8
RTN

LBL B // step 12
STO 3
RCL× 2
STO+ 6
R down
STO 4
RCL× 1
STO+ 5
RCL 4
STO 2
RCL 3
STO 1
RTN

LBL C // step 25
RCL 7
RCL× 2
STO+ 6
RCL 8
RCL× 1
STO+ 5
RCL 5
RCL- 6
ABS
2
÷
STO 0
RTN


Total: 38 steps



Eddie


This blog is property of Edward Shore. 2014

Monday, July 30, 2012

Applications and Programming: Area of a Polygon Given the Coordinates of Vertices

Today's blog entry is how to find the area of an enclosed polygon, when you just know the vertices (corner points) of the polygon.

The area, with n vertices, is:

A ≈ 1/2 * | (x1 y0 - x0 y1) + (x2 y1 - x1 y2) + (x3 y2 - x2 y3) + ... + (x0 yn - xn y0) |

With | | representing the absolute value.

The sum ends with the last vertex of the set and the initial vertex. The calculation is a fairly simple one.

The following TI-84+ program handles this formula.

TI-84+ Program AREAVERT

: Input "X0:",X
: Input "Y0:",Y
: {X} → L1
: {Y} → L2
: 0 → T
: 1 → K
: Lbl Y
: 1+K→ K
: Input "NEXT X:", A
: Input "NEXT Y:", B
: augment(L1,{A})→ L1
: augment(L2,{B})→ L2
: T+A*L2(K-1)-B*L1(K-1)→ T
: Menu("MORE?","YES",Y,"NO",N)
: Lbl N
: T+X*L2(K)-Y*L1(K)→ T
: abs(T)/2→ T
: Disp "AREA=", T
: Pause


Notes:
* L1 is accessed by pressing [2nd], [ 1 ]
* L2 is accessed by pressing [2nd], [ 2 ]
* The program works best if you start with one vertex and cycle either clockwise or counterclockwise, and stay in one direction all the way through.
* The program will ask you if there are more vertices. You do not have to repeat the initial vertex in is program.

Example 1:

Find the area of a square with the vertices (0,0), (0,5), (5,5), and (5,0). This is a square with a side length of 5 units.

Area: 25.

Example 2:

Find the area of a polygon with vertices (-3,0), (3,0), (4,11), (2,15), and (-4,12).

Area: 95.5


Until next time,
Eddie

This blog is property of Edward Shore. © 2012

RPN HP 12C: Fibonacci and Lucas Sequences

  RPN HP 12C: Fibonacci and Lucas Sequences Golden Ratio, Formulas, and Sequences Let φ be the Golden Ratio: φ = (1 + √5) ÷ 2...