…does nerdy things.

Center of Gravity Calculation / Calculator

Filed under: Help — Tags: , , , — Bryan on Mar 31st, 2009 @ 7:11 pm

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.

Enter weights here:

Enter X coordinates here:

Enter Y coordinates here:

21 Comments »
  1. great little tool. saved me re-learning the calcs for a quick rough idea of something. thx m8

    Comment by eric — August 4, 2009 @ 2:10 pm
  2. Thanks a lot

    Comment by Per Christensen — August 12, 2009 @ 4:00 am
  3. 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!

    Comment by Kris Brown — October 5, 2009 @ 2:16 pm
  4. 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.

    Comment by Bryan — October 7, 2009 @ 9:36 am
  5. 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

    Comment by Mladen — October 14, 2009 @ 9:15 pm
  6. Great tool!

    Comment by Madison — December 3, 2009 @ 10:14 am
  7. Sir, Will you please tell me the main logic behind this cool software.
    It will be very useful to me.

    Thanking u……….

    Comment by Sudip — December 20, 2009 @ 3:34 am
  8. I use a program called Express CG – located @ expresseng.com\software

    Comment by William — January 19, 2010 @ 4:24 pm
  9. Brian,
    Good job, now, how can this be used to calculate COG of an athlete?
    Jose

    Comment by Jose — February 1, 2010 @ 8:13 am
  10. Can I have the formula you have sued to calculate Center of Gravity
    seena

    Comment by seena — March 10, 2010 @ 5:09 am
  11. Used this formula for a customer. Saved me a bunch of time. Hope it is correct! Thank You!

    Comment by Al Perry — March 10, 2010 @ 2:28 pm
  12. 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?

    Comment by Keith — May 10, 2010 @ 7:16 am
  13. Great tool. Thanks for sharing.

    Comment by Tamara — May 30, 2010 @ 8:17 pm
  14. “Bryan is a jazz and blues guitarist”
    Got Roy Rogers?

    Comment by Pete Peterson — June 13, 2010 @ 1:08 am
  15. 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?

    Comment by Uma — October 5, 2010 @ 1:49 pm
  16. 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

    Comment by Frank J — January 23, 2011 @ 9:12 pm
  17. 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 ?

    Comment by John — March 23, 2011 @ 3:18 am
  18. 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.

    Comment by Fernando — April 11, 2011 @ 2:08 am
  19. 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.

    Comment by Randy — May 18, 2011 @ 4:07 pm
  20. Thanks Bryan, this was a timesaver.

    Comment by Brian — September 27, 2011 @ 3:37 pm
  21. 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?

    Comment by Harry Melick — November 14, 2011 @ 10:43 am
Leave a comment

All articles are licensed under a Attribution-Noncommercial-Share Alike 3.0 Unported License. All files/themes are released under the GPL License where applicable. © 2012 Bryan Helmig Hosted on Webfaction.