Saturday, October 12, 2024

Casio fx-CG 50: Centroid of a 2D spaces

Casio fx-CG 50: Centroid of a 2D spaces





The program CENTROID calculates the center point for an area covered by:


y(x) ≥ 0, x ≥ lower limit, x ≤ upper limit


The center point is calculated by:


x-center = ∫( x * y(x) dx, x = lower limit, x = upper limit) / A

y-center = ∫(1 / 2 * y(x)^2 dx, x = lower limit, x = upper limit) / A

where A = ∫( y(x) dx, x = lower limit, x = upper limit)



Casio fx-CG 50 Program Code: CENTROID


Here is the code, which includes a graphic representation of y(x) and the location of the centroid. In this code, the Y is bold and it comes from the VARS menu. Do not merely use ALPHA+Y. For calculators with monochrome screens, such as the fx-9750G/fx-9860G series, leave out the color commands (Black, Blue, Red). The program assumes that there no preset plots or more than one function to be plotted.


This program works best for functions y(x) ≥ 0 for x ∈ [lower limit, upper limit].




Here is a text-only version:






Examples


Example 1: y = x^2 , lower limit = 0, upper limit = 1

X-Center = 3 / 4 = 0.75

Y-Center = 3 / 10 = 0.3




Example 2: y = 2 * cos( x / 2 ), lower limit = 0, upper limit = π

X-Center ≈ 1.141592654

Y-Center ≈ 0.7853981634




Example 3: y = 3, lower limit = 1, upper limit = 5

X-Center = 3

Y-Center = 1.5




Example 4: y = -4 * x^2 + 2 * x + 6, lower limit = -0.5, upper limit = 1

X-Center = 1 / 4

Y-Center = 307 / 110




Eddie


All original content copyright, © 2011-2024. 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.

TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...