Sunday, April 7, 2019

HP Prime and TI-84 Plus CE: Drawing Angles

HP Prime and TI-84 Plus CE:  Drawing Angles

Introduction

The program DRAWANG draws an angle.  You give the starting line from coordinates (0,0) to (A,B).  The origin is given automatically.  The calculator will then a draw a line that results from the given angle θ from the origin to a calculated point. 

The calculator will work in the angle mode your calculator mode is currently set.

For clockwise angles, enter θ as negative.

For counterclockwise angles, enter θ as positive.

HP Prime Program DRAWANG

EXPORT DRAWANG()
BEGIN
// 2019-04-04 EWS
STARTAPP("Function");
Xmin:=−11; Xmax:=11;
Ymin:=−11; Ymax:=11;
LOCAL A,B,C,D,R,θ,Z;
INPUT({A,B,θ},"Begin Point (A,B)
; Angle θ",{"A:","B:","θ:"},
{"−10≤A≤10","−10≤B≤10","Angle"});
R:=√(A^2+B^2);
Z:=θ+ARG(A+B*i);
C:=R*COS(Z); D:=R*SIN(Z);
RECT();
// Axes
LINE(−11,0,11,0,#D0D0D0h);
LINE(0,−11,0,11,#D0D0D0h);

// Angle
LINE(0,0,A,B,#FF0000h);
LINE(0,0,C,D,#0000FFh);
TEXTOUT("Angle: "+STRING(θ),
−11,11,3,#006000h);
WAIT(0);
END;

(Alternatively, with HComplex set to 1  (allow complex numbers from real input, and display them as a+bi):

EXPORT DRAWANG()
BEGIN
// 2019-04-04 EWS
HComplex:=1;
STARTAPP("Function");
Xmin:=−11; Xmax:=11;
Ymin:=−11; Ymax:=11;
LOCAL A,B,C,D,R,θ,Z;
INPUT({A,B,θ},"Begin Point (A,B)
; Angle θ",{"A:","B:","θ:"},
{"−10≤A≤10","−10≤B≤10","Angle"});
R:=√(A^2+B^2);
Z:=θ+ARG(A+B*√(-1));
C:=R*COS(Z); D:=R*SIN(Z);
RECT();
// Axes
LINE(−11,0,11,0,#D0D0D0h);
LINE(0,−11,0,11,#D0D0D0h);

// Angle
LINE(0,0,A,B,#FF0000h);
LINE(0,0,C,D,#0000FFh);
TEXTOUT("Angle: "+STRING(θ),
−11,11,3,#006000h);
WAIT(0);
END;

The latter program can be copied straight from the blog as text.  The former will be needed to type in manually. 


TI-84 Plus CE Program DRAWANG

"2019-04-04 EWS"
Func
ZStandard
PlotsOff 
FnOff 
ClrDraw
AxesOn 
Disp "BGN POINT (A,B)","­10≤A≤10,­10≤B≤10","θ: ANGLE"
Prompt A,B,θ
√(A²+B²)→R
θ+R▶ Pθ(A,B)→Z
R*cos(Z)→C
R*sin(Z)→D
Line(0,0,A,B,RED)
Line(0,0,C,D,BLUE)
TextColor(GREEN)
Text(0,0,"ANGLE: "+toString(θ))
DispGraph



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.

Spotlight: Sharp EL-5200

  Spotlight: Sharp EL-5200 As we come on the 13 th (April 16) anniversary of this blog, I want to thank you. Blogging about mathematic...