Center of Gravity Calculation / Calculator
So I’m doing homework, and this center of gravity thing is pretty cool. In Location Strategy they use it to find the best location for stores and such on an X-Y plane with points that have certain weights or populations. “Well that’s neat,” I thought to myself. “I’ll make a little calculator using AJAX and PHP.” Because I really have nothing better to do.
It’s a pretty simple center of gravity calculator, just put in the weights first, seperated by comma’s, then the X coordinates and finally the Y coordinates. You should have the same number of each, if not, well, it’s just wrong. You should get two numbers back, these are the (X,Y) coordinates of the perfect center of gravity.
Enjoy my fancy “Center of Gravity Calculator” that I wasted 25 minutes minutes creating.
Bryan is a jazz and blues guitarist, small-time designer, Python hacker, entrepreneur, and lover of fine whiskeys. He's the man behind such sites as
great little tool. saved me re-learning the calcs for a quick rough idea of something. thx m8
Thanks a lot
Ok Brian. You are most definitely several magnitudes smarter than I am. I have to ask you a follow up question to this concept of c.g.
I have a homework problem where there is a square and there are four weights hanging from all 4 corners of the square. The weights are (if you are looking at the square in a x,y plane- 1 (at origin), 4 (upper left quadrant), 3 (upper right), and 2 (lower right). The scale on the y axis is from 0 to 2 and the scale on the x axis is from 0 to 2. Where is the center of gravity. Could you help with this and kinda say how you did it. I need your super mathematical powers. If you help you will be elevated to rock star status (and I don’t give this designation out lightly). Oh, and I need it ASAP!
Kris, try entering these in:
w:1,4,3,2
x:0,0,2,2
y:0,2,2,0
Just think in terms of x,y point and weights. At the origin (0,0) with a weight 1. Top left (0,2) is a weight 4. Etc.
Where is this calculator? I dont see where i can use it.
i am trying to find the center of gravity of 4 weights placed along the y-axis
1. 3 kg @ 9.5 meters
2. 2 kg @ 6.4 meters
3. 2.5 kg @ the origin
4. 4 kg @ -.5 meters
Thank you very much ahead of time
Great tool!
Sir, Will you please tell me the main logic behind this cool software.
It will be very useful to me.
Thanking u……….
I use a program called Express CG – located @ expresseng.com\software
Brian,
Good job, now, how can this be used to calculate COG of an athlete?
Jose
Can I have the formula you have sued to calculate Center of Gravity
seena
Used this formula for a customer. Saved me a bunch of time. Hope it is correct! Thank You!
Great PHP – have I found a bug?
Have a problem with a cog of equilateral triangle, so, tried with weights of 1 on each corner, using the base as the x axis & side length of 1 ie weight=1,1,1 x=0,0.5,1 y=0,0.866,0 & the result is 2,289. Where am I going wrong shouldn’t it be 0.5,0.289. When I scale the figures x=0,500,1000 y=0,866,0 the result is correct 500,289?
Great tool. Thanks for sharing.
“Bryan is a jazz and blues guitarist”
Got Roy Rogers?
Hi, I have a homewwork to find center of gravity, given weights, distance and Dollar per mile. Do I have to consider Dollar per mile while calculating center of gravity. I think including dollar per mile would make more sense. Am I right?
Is something wrong?
One mass cg @48,0″ 300lbs. second mass cg @.5,0″ 100lbs. I entered this data:
w:300,100
x:48,.5
y:0,0
result = 37.25,0
I then want to add more of the second mass, 2x mass and 2x cg. entered data and get this:
w:300,200
x:48,1
y:0,0
result = 29.2,0
But when I add a third of the second mass 3x mass and 3x cg, total cg moves away from O.
w:300,300
x:48,1.5
y:0,0
=31.5,0
Add 4x mass and 4x cg, total cg moves back towards O.
w:300,400
x:48,2
y:0,0
=21.714285714286,0
Hello
Thanks for the program it is great!
But where do you have the Z coordinates
I think you can calculate 2 times where second time is x or y is z, but is not exact
Do you have possibility to put inn z coordinates in you program ?
Awesome program! Thanks a lot!
For those of you trying to use Z-coordinates, just do two calculations of center of gravity: one on the XY plane and the other (and as I find it easier to do), on the YZ plane following the right hand rule. Then, combining those (not averaging any of the values), you have your center of gravity in the 3-coordinate system.
Great little program! Thanks a lot!
If you’re ever bored, a reverse calculator would be also be useful. (Specify COG and (position or weight)and it fills in the blanks.
Thanks Bryan, this was a timesaver.
Hi Bryan
Looks like a cool tool that I may be able to use. Do you do any hand holding?
I have an industrial application, but no real understanding how to apply your calculator to my situation. I could use a diagram in a form I would understand and apply.
Up for working with a pure novice?