EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Tip List

Texas Instruments TI-89
507 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #236 background imageLoading...
Page #236 background image
[6.44] Nest min() in max() to limit an argument
You can limit an argument to two bounds upper and lower, with this expression:
max(lower,min(x,upper))
For example, suppose we have a calculation in which we calculate the real inverse sine (arcsine) of the
result of a previous calculation. Round-off errors in that calculation may result in an argument x whose
absolute value is slightly greater than 1, so finding the inverse sine of the argument will result in an
error, or a complex result. We can avoid this by finding the inverse sine of
max(-1,min(x,1))
If x is between -1 and 1, inclusive, then the expression returns x. If x is less than -1, the expression
returns -1, and if x is greater than 1, the expression returns 1. This same result can be obtained with an
If ... EndIf structure, or as a when() function, but this form is more concise.
[6.45] Determine if a point is inside a triangle
This tip is more application-specific than most, but the idea is so clever that I had to include it. Suppose
that we have a triangle defined by the three points A, B and C, with rectangular coordinates (x
a
,y
a
),
(x
b
,y
b
) and (x
c
,y
c
). We have another point P at (x,y), and we want to know if P is inside the triangle ABC.
In general, if P is in ABC, then the area of ABC will equal the sum of the areas of the three triangles
PBC, APC and ABP. If P is outside ABC, then the area of ABC is less than the sum of the areas of the
three triangles formed by A, B, C and P. To find the area of a triangle with points P
1
, P
2
and P
3
, we can
use
area(P
1
P
2
P
3
) = =
x
1
y
1
1
x
2
y
2
1
x
3
y
3
1
2
abs
x
1
y
2
+x
3
y
1
+x
2
y
3
x
1
y
3
x
2
y
1
x
3
y
2
2
where the double bars indicate the absolute value of the determinant of the matrix. By using the
absolute value, we ensure that the area is positive, regardless of the ordering of the three points. This
function implements the idea:
PntTrian(px,py,ax,ay,bx,by,cx,cy,tol)
Func
©(px,py,ax,ay,bx,by,cx,cy,tol) return True if point P is in triangle ABC
©25may01/dburkett@infinet.com
local tArea,at
©Define local function to find triangle area
Define tArea(xx1,yy1,xx2,yy2,xx3,yy3)=Func
abs(xx1*yy2-xx1*yy3-xx2*yy1+xx2*yy3+xx3*yy1-xx3*yy2)/2
EndFunc
©Find area difference & return result
tArea(ax,ay,bx,by,cx,cy)at
6 - 78

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals