Tuesday, December 6, 2016

TI-84 Plus and Casio Prizm: Area between Polynomials p(x) and q(x)

TI-84 Plus and Casio Prizm:  Area between Polynomials p(x) and q(x)




The program POLYSURF calculates the area of a surfaces with:

* Side borders are straight vertical lines.  The left border line begins at x = 0
* The top and the bottom are defined polynomials: p(x) for the top and q(x) for the bottom.
* There are n partitions in the shape, for all partition points, p(x) > q(x).

The program also draws the shape.  If the number of partitions are 4 or less, an exact area is calculated.  Otherwise, p(x) and q(x) are approximated by a quartic polynomial and an approximated area is calculated.

TI-84 Plus Program POLYSURF

"EWS 2016-12-06"
Disp "P(X) > Q(X)"
FnOff
PlotsOff
{0}→L
Input "P(0)=",P
{P}→L
Input "Q(0)=",Q
{Q}→L
Input "NO. OF PARTITIONS:",N
For(I,1,N)
ClrHome
Output(7,1,"POINT")
Output(7,8,I)
Output(8,1,"P(X)>Q(X)")
Input "X:",X
Input "P(X):",P
Input "Q(X):",Q
augment(L,{X})→L
augment(L,{P})→L
augment(L,{Q})→L
End
L(dim(L))→L
If N=1
Then
LinReg(ax+b) L,L,Y
LinReg(ax+b) L,L,Y
End
If N=2
Then
QuadReg L,L,Y
QuadReg L,L,Y
End
If N=3
Then
CubicReg L,L,Y
CubicReg L,L,Y
End
If N≥4
Then
QuartReg L,L,Y
QuartReg L,L,Y
End
FnOn 1,2
fnInt(Y-Y,X,0,L)→S
Disp "AREA=",S
Pause
ClrDraw
­.5→Xmin
L+.5→Xmax
min(L)-.5→Ymin
max(L)+.5→Ymax
Shade(Y,Y,0,L)

Casio Prizm Program:  POLYSURF

The character # can be found by exiting to the “main” program menu (TOP, BOTTOM, etc).  Press F6 for CHAR, select #, and press [EXE].

Get the regressions by pressing [F4] (MENU), [F1] (STAT), [F6] twice (CALC, >) and selecting the regression.  The statistic variables a, b, c, d, and e are calculated after regression calculation.

“EWS 2016-12-06”
“P(x)>Q(x)”
{0} → List 1
“P(0)=”? → P
{P} → List 2
“Q(0)=”? → Q
{Q} → List 3
“# PARTITIONS:”? → N
For 1 → I To N
“POINT”
I
“X:”? → X
“P(X):”? → P
“Q(X):”? → Q
Augment(List 1, {X}) → List 1
Augment(List 2, {P}) → List 2
Augment(List 3, {Q}) → List 3
Next
If N = 1
Then
LinearReg (ax+b) List 1, List 2
a → A
b → B
“Ax+B” → Y1
LinearReg (ax+b) List 1, List 3
a → F
b → G
“Fx+G” → Y2
IfEnd
If N = 2
Then
QuadReg List 1, List 2
a → A
b → B
c → C
“Ax^2+Bx+C” → Y1
QuadReg List 1, List 3
a → F
b → G
c → H
“Fx^2+Gx+H” → Y2
IfEnd
If N = 3
Then
CubicReg List 1, List 2
a → A
b → B
c → C
d → D
“Ax^3+Bx^2+Cx+D” → Y1
CubicReg List 1, List 3
a → F
b → G
c → H
d → I
“Fx^3+Gx^2+Hx+I” → Y2
IfEnd
If N ≥ 4
Then
QuartReg List 1, List 2
a → A
b → B
c → C
d → D
e → E
“Ax^4+Bx^3+Cx^2+Dx+E” → Y1
CubicReg List 1, List 3
a → F
b → G
c → H
d → I
e → J
“Fx^4+Gx^3+Hx^2+Ix+J” → Y2
IfEnd
List 1[Dim List 1] → L
∫(Y1-Y2, 0, L) → S
“AREA=”
S
ClrGraph
ViewWindow -.5, L+.5, 1, Min(List 3)-.5, Max(List 2)+.5, 1
F-Line 0, List 2[1], 0, List 1[3]
Dim List 1 → Z
F-line List 1[Z], List 2[Z], List 1[Z], List 3[Z]
DrawGraph

Examples

Example 1



Data:
n
x
p(x)
q(x)
0
0
2
-2
1
1
5
-2
2
2
2
-2

Number of partitions, n = 2
Area = 12

Example 2



Data:
n
x
p(x)
q(x)
0
0.0
0.00
0.00
1
1.5
5.62
-0.64
2
2.5
3.83
1.38
3
3.5
1.25
0.76

Number of Partitions, n = 3
Area ≈ 13.16619792

Example 3



Data:
n
x
p(x)
q(x)
0
0.00
3.00
-3.00
1
0.50
2.54
-2.84
2
1.25
2.01
-3.00
3
1.60
2.36
-3.55
4
2.00
2.76
-1.98

Number of Partitions, n = 4
 Area ≈ 10.77281698

This blog is property of Edward Shore, 2016


1 comment:

HP Prime and TI-84 Plus: Basic Wheatstone Full Bridge Circuit

HP Prime and TI-84 Plus:  Basic Wheatstone Full Bridge Circuit The program WHEATSTONE (HP Prime) and WHTSTONE (TI-84 Plus CE) deals wi...