Showing posts with label center of mass. Show all posts
Showing posts with label center of mass. Show all posts

Thursday, April 9, 2015

HP 50g: Bolt Pattern, Solar Irradiance, Thermal Noise, Regular Polygons, Center of Mass (Matrix of Masses)

HP 50g:   Bolt Pattern, Solar Irradiance, Thermal Noise, Regular Polygons,

Center of Mass (Matrix of Masses)



Bolt Pattern: BOLTPAT



Input:
4:  xc:   x coordinate, center
3:  yc:   y coordinate, center
2:  n:  number of bolts
1:  d:  diameter of the circle

Program:
<< DEG OVER 1 – → xc yc n d k
<< { } 0 k FOR I 360 I * n / DUP COS d 2 / * xc +
SWAP SIN d 2 / * yc + (0,1) * + + NEXT
DUPDUP 2 GET SWAP 1 GET – ABS >> >>

Output: 
2:  list of bolts (x+yi)
1:  OC-Distance

Solar Irradiance:  IRRAD


Input:
5:  es:   elevation of the sun (as decimal degrees)
4:  as:   azimuth of the sun from south going east (as decimal degrees)
3:  ep:   elevation of the panel (as decimal degrees)
2:  ap:   azimuth of the panel from south going east (as decimal degrees)
1:  ib:  the sun’s power or irradiance (usually 1,000 or 1,367 W/m^2)

Program:
<< → es as ep ap ib
<< DEG ep COS es SIN * ep SIN es COS * as ap – COS *
+ ACOS DUP COS ib * >> >>

Output:
2:  incidence angle
1:  surface radiance

Thermal Noise:  THNOISE


Input:
3:  R:  resistance (Ω)
2:  T:   temperature (K)
1:  B:   noise bandwidth (Hz)

Program:
<< → R T B
<< T R * B * 4 * 1.3806488E-23 * √
T B * LOG 10 * 198.599167802 -  >> >>

Output:
2:  Voltage (Volts)
1:  Noise Power (dB)

Regular Polygon:  Internal Angle and Area:  RPOLYG


Input:
2:  s:  side length
1:  n:  number of sides


Program: 
<< DEG DUP INV 360 * NEG 180 + UNROT 4 / SWAP SQ * SWAP DUP UNROT 2 / TAN * >>

Output:
2:  Interior Angle
1:  Area

Center of Mass using Matrix:  CENTERMTX


Input:
1:  Matrix of Masses

Program:
<< DUP SIZE OBJ→ DROP → M R C
<< M 1  C START 1 NEXT C →ARRY * AXL ∑LIST

M 1 C FOR I I NEXT C 1 2 →LIST →ARRY * TRAN
1 R START 1 NEXT R 1 2 →LIST →ARRY * OBJ→ DROP

M TRAN 1 R FOR I I NEXT R 1 2 →LIST →ARRY * TRAN
1 C START 1 NEXT C 1 2  →LIST →ARRY * OBJ→ DROP

→ tm rw cw
<< rw tm / cw tm  / {1,2} →ARRY >> >> >>

Output:
[[ x center of mass point,  y center of mass point ]]



Special Note:  April 11 will mark the fourth anniversary of this blog.  I appreciate the readers and followers of this blog and thank you for that, and the comments.  Best always,  Eddie!


This blog is property of Edward Shore.  2015.

Saturday, April 4, 2015

HP Prime: Center of Mass - Matrix Representation

HP Prime:  Center of Mass - Matrix Representation

The HP Prime program CENTERMTX calculates the center of mass of the matrix M, where M represents the body.  The entries of M represents an array of molecules, each with assigned weights.  It is possible that the center of mass is located outside of the body. 


Note:  If gravity affects the particles equally, then the center of mass & center of gravity are identical.  

Formulas:

Xc = ∑(x * m)/∑m
Yc = ∑(y * m)/∑m


HP Prime:  CENTERMTX

EXPORT CENTERMTX(m)
BEGIN
// Center of Mass: matrix
// Matrix of mass
LOCAL s,tm,rt,ct,r,c;
// in MAKEMAT I=row,J=col
s:=SIZE(m);
r:=s(1);
c:=s(2);
// Total Mass
tm:=TRN(m*MAKEMAT(1,c,1))*
MAKEMAT(1,r,1);
tm:=tm(1,1);
// Row Total
rt:=TRN(m*MAKEMAT(I,c,1))*
MAKEMAT(1,r,1);
rt:=rt(1,1);
// Column Total
ct:=TRN(TRN(m)*MAKEMAT(I,r,1))*
MAKEMAT(1,c,1);
ct:=ct(1,1);
// center
RETURN [[rt/tm,ct/tm]];
END;

Example:  Locate the center of mass of the following body.




The center of mass:  [[ 2.08333333333, 2 ]]


Eddie


This blog is property of Edward Shore.  2015.



HP 71B Basic and Casio fx-CG 100: Weighted Random Sample

HP 71B Basic and Casio fx-CG 100: Weighted Random Sample Introduction In calculators, it is fairly easy to generate a rand...