August 27    : empty
   Home | Products | FAQ | Biorhythms | DSP | Links | Books | Employment | Contact | Order products 

Modules
PDAcalc_units

Category
Calculus
  * Centroid
  * Derivaties
  * Quadratic
  * Root_function
Constants
Data
Electronics
Engineering
Example
Financial
General
Keyboard
Mechanical
Physics
Statistics
User1
User2

Additions
Round_Coil_Design2
Sierpinski
FinancialPack
UserFunc

User notes
evert
admin
walt
Jose

PDAcalc classic

Category:  Calculus   Script:  Centroid   Version:  1.00    Downloads:  37

Author:  adacs  
Short description: This program find the centroid of the region bounded by two graphs.
Date submitted: 2004-05-27
Module version: 1.43
Website: http://www.mcraeclan.com/MathHelp/GeometrySolidCentroid.htm 

This script find the centroid of the region bounded by two graphs. The script first draws the two functions f(x) and f(x). At line 22 a new function is defined:
function s(x){f(x)-g(x)}
At the points of intersection f(x) and g(x) are equal and s(x) is zero. The x-values are easily found by using the root() function. The bounded area is calculated using the int() function to integrate between the two x-values as shown in line 42.  

 001 x1=-4;x2=4;y1=-4;y2=4
 002 
 003 

 004
 function f(x){-(x^2)+3}
 005 function g(x){x^2-2*x-1}
 006 
 007 x=x1;N=40
 008 step=(x2-x1)/N
 009 gstdc(0,10,159,100)
 010 gaxis(x1,y1,x2,y2,1,1)
 011 gtitl('Calculate roots and centroid')
 012 gmove(x,f(x))
 013 gmove2(x,g(x))
 014 while(x<=x2)
 015 {
 016   glin(x,f(x))
 017   glin2(x,g(x))
 018   x=x+step
 019 }
 020 
 021 // Find the roots.
 022 function s(x){f(x)-g(x)}
 023 x1=root('s',x1)
 024 x2=root('s',x2)
 025 
 026 
 027 fmt(0,2,1,0)// Set display format
 028 gprt(2,122,'P1=('+x1+','+f(x1)+')')
 029 gcprt(90,122,'P2=('+x2+','+f(x2)+')')
 030 
 031 // Draw area.
 032 x=x1
 033 step=(x2-x1)/N
 034 gline3(x,g(x),x,f(x))
 035 while(x<=x2)
 036 {
 037   gline3(x,g(x),x,f(x))
 038   x=x+step
 039 }
 040 
 041 // Calculate area
 042 A=int('s',x1,x2)
 043 gcprt(140,122,'A='+A)
 044 
 045 function my(x){x*s(x)}
 046 py=int('my',x1,x2)
 047 
 048 function mx(x){f(x)^2-g(x)^2}
 049 px=int('mx',x1,x2)
 050 
 051 xCen=(0.5*px)/A
 052 yCen=py/A
 053 gpnt(1,xCen,yCen,2)
 054 
 055 gcprt(80,135,'Centroid= ('+xCen+','+yCen+')')
 
User Contributed Notes
Centroid
Feel free to add your notes about this program About adding notes
Name: Evert
Email: evert (at) adacs (dot) com
Date: 2003-10-06

We used the book Calculus third edition by Dennis G. Zill page 373
ISBN 0-534-92793-9
You can probably just do a search on the web for more info.
Name: Denis Warden
Email: denis3452 (at) hotmail (dot) com
Date: 2003-10-03

Our company is very interested in calculation centroids using the palm. Do you have some more information about the algorithm?

P.s. I can't even begin to tell you how impressed I am with this program and your new approach!
Feel free to add your notes about this program About adding notes
   Home | Products | FAQ | Biorhythms | DSP | Links | Books | Employment | Contact | Order products 
© 2002 -2008 ADACS LLC. All rights reserved.