# Difference between revisions of "Barycenter Command"

From GeoGebra Manual

Line 7: | Line 7: | ||

<code>Barycenter[{(2, 0), (0, 2), (-2, 0), (0, -2)}, {1, 1, 1, 1}]</code> yields point ''A(0,0)''}} | <code>Barycenter[{(2, 0), (0, 2), (-2, 0), (0, -2)}, {1, 1, 1, 1}]</code> yields point ''A(0,0)''}} | ||

:{{example|1= | :{{example|1= | ||

− | <code>Barycenter[{(2, 0), (0, 2), (-2, 0), (0, -2)}, {2, 1, 1, 1}</code> yields point ''B(0.4,0)''. The ''x''-coordinate of this point was determined by '' <math> \frac{1}{ 2+1+1+1 }*(2*2+1*0+1*(-2)+1*0)</math> = <math>\frac{1}{ 5 }*2</math> = 0.4''}} | + | <code>Barycenter[{(2, 0), (0, 2), (-2, 0), (0, -2)}, {2, 1, 1, 1}]</code> yields point ''B(0.4,0)''. The ''x''-coordinate of this point was determined by '' <math> \frac{1}{ 2+1+1+1 }*(2*2+1*0+1*(-2)+1*0)</math> = <math>\frac{1}{ 5 }*2</math> = 0.4''}} |

## Revision as of 09:03, 10 July 2012

This page is about a feature that is supported only in GeoGebra 4.2. |

- Barycenter[ <List of Points>, <List of Weights> ]
- Set the center of a system of points in the list, defined as the average of their positions, weighted by their value, using the proper formula.

**Example:**`Barycenter[{(2, 0), (0, 2), (-2, 0), (0, -2)}, {1, 1, 1, 1}]`

yields point*A(0,0)*

**Example:**`Barycenter[{(2, 0), (0, 2), (-2, 0), (0, -2)}, {2, 1, 1, 1}]`

yields point*B(0.4,0)*. The*x*-coordinate of this point was determined by*\frac{1}{ 2+1+1+1 }*(2*2+1*0+1*(-2)+1*0) = \frac{1}{ 5 }*2 = 0.4*