CalculusWithJuliaNotes.jl/quarto/308797b5/integrals/center_of_mass.html
2022-08-11 13:00:43 -04:00

1479 lines
94 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.0.32">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Calculus with Julia - 44&nbsp; Center of Mass</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<script src="../site_libs/quarto-nav/quarto-nav.js"></script>
<script src="../site_libs/quarto-nav/headroom.min.js"></script>
<script src="../site_libs/clipboard/clipboard.min.js"></script>
<script src="../site_libs/quarto-search/autocomplete.umd.js"></script>
<script src="../site_libs/quarto-search/fuse.min.js"></script>
<script src="../site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="../">
<link href="../integrals/volumes_slice.html" rel="next">
<link href="../integrals/area_between_curves.html" rel="prev">
<script src="../site_libs/quarto-html/quarto.js"></script>
<script src="../site_libs/quarto-html/popper.min.js"></script>
<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
<script src="../site_libs/quarto-html/anchor.min.js"></script>
<link href="../site_libs/quarto-html/tippy.css" rel="stylesheet">
<link href="../site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="../site_libs/bootstrap/bootstrap.min.js"></script>
<link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="../site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
<script id="quarto-search-options" type="application/json">{
"location": "navbar",
"copy-button": false,
"collapse-after": 3,
"panel-placement": "end",
"type": "overlay",
"limit": 20,
"language": {
"search-no-results-text": "No results",
"search-matching-documents-text": "matching documents",
"search-copy-link-title": "Copy link to search",
"search-hide-matches-text": "Hide additional matches",
"search-more-match-text": "more match in this document",
"search-more-matches-text": "more matches in this document",
"search-clear-button-title": "Clear",
"search-detached-cancel-button-title": "Cancel",
"search-submit-button-title": "Submit"
}
}</script>
<script async="" src="https://hypothes.is/embed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" integrity="sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
<script type="application/javascript">define('jquery', [],function() {return window.jQuery;})</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js" type="text/javascript"></script>
</head>
<body class="nav-sidebar floating nav-fixed">
<div id="quarto-search-results"></div>
<header id="quarto-header" class="headroom fixed-top">
<nav class="navbar navbar-expand-lg navbar-dark ">
<div class="navbar-container container-fluid">
<a class="navbar-brand" href="../index.html">
<img src="../logo.png" alt="">
<span class="navbar-title">Calculus with Julia</span>
</a>
<div id="quarto-search" class="" title="Search"></div>
</div> <!-- /container-fluid -->
</nav>
<nav class="quarto-secondary-nav" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar" aria-controls="quarto-sidebar" aria-expanded="false" aria-label="Toggle sidebar navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
<div class="container-fluid d-flex justify-content-between">
<h1 class="quarto-secondary-nav-title"><span class="chapter-number">44</span>&nbsp; <span class="chapter-title">Center of Mass</span></h1>
<button type="button" class="quarto-btn-toggle btn" aria-label="Show secondary navigation">
<i class="bi bi-chevron-right"></i>
</button>
</div>
</nav>
</header>
<!-- content -->
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
<!-- sidebar -->
<nav id="quarto-sidebar" class="sidebar collapse sidebar-navigation floating overflow-auto">
<div class="mt-2 flex-shrink-0 align-items-center">
<div class="sidebar-search">
<div id="quarto-search" class="" title="Search"></div>
</div>
</div>
<div class="sidebar-menu-container">
<ul class="list-unstyled mt-1">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../index.html" class="sidebar-item-text sidebar-link">Preface</a>
</div>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="false">Precalculus Concepts</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-1" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-1" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/calculator.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">From calculator to computer</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/variables.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">2</span>&nbsp; <span class="chapter-title">Variables</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/numbers_types.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">3</span>&nbsp; <span class="chapter-title">Number systems</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/logical_expressions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">4</span>&nbsp; <span class="chapter-title">Inequalities, Logical expressions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/vectors.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">5</span>&nbsp; <span class="chapter-title">Vectors</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/ranges.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">6</span>&nbsp; <span class="chapter-title">Ranges and Sets</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">7</span>&nbsp; <span class="chapter-title">Functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">8</span>&nbsp; <span class="chapter-title">The Graph of a Function</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/transformations.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Function manipulations</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/inversefunctions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">The Inverse of a Function</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomial.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">11</span>&nbsp; <span class="chapter-title">Polynomials</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomial_roots.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">12</span>&nbsp; <span class="chapter-title">Roots of a polynomial</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/polynomials_package.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">13</span>&nbsp; <span class="chapter-title">The Polynomials package</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/rational_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">14</span>&nbsp; <span class="chapter-title">Rational functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/exp_log_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">15</span>&nbsp; <span class="chapter-title">Exponential and logarithmic functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/trig_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">16</span>&nbsp; <span class="chapter-title">Trigonometric functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../precalc/julia_overview.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">17</span>&nbsp; <span class="chapter-title">Overview of Julia commands</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="false">Limits</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-2" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-2" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/limits.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">18</span>&nbsp; <span class="chapter-title">Limits</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/limits_extensions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">19</span>&nbsp; <span class="chapter-title">Limits, issues, extensions of the concept</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/continuity.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">20</span>&nbsp; <span class="chapter-title">Continuity</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../limits/intermediate_value_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">21</span>&nbsp; <span class="chapter-title">Implications of continuity</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" aria-expanded="false">Derivatives</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-3" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-3" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">22</span>&nbsp; <span class="chapter-title">Derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/numeric_derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">23</span>&nbsp; <span class="chapter-title">Numeric derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/symbolic_derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">24</span>&nbsp; <span class="chapter-title">Symbolic derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/mean_value_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">25</span>&nbsp; <span class="chapter-title">The mean value theorem for differentiable functions.</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/optimization.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">26</span>&nbsp; <span class="chapter-title">Optimization</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/first_second_derivatives.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">27</span>&nbsp; <span class="chapter-title">The first and second derivatives</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/curve_sketching.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">28</span>&nbsp; <span class="chapter-title">Curve Sketching</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/linearization.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">29</span>&nbsp; <span class="chapter-title">Linearization</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/newtons_method.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">30</span>&nbsp; <span class="chapter-title">Newtons method</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/more_zeros.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">31</span>&nbsp; <span class="chapter-title">Derivative-free alternatives to Newtons method</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/lhospitals_rule.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">32</span>&nbsp; <span class="chapter-title">LHospitals Rule</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/implicit_differentiation.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">33</span>&nbsp; <span class="chapter-title">Implicit Differentiation</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/related_rates.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">34</span>&nbsp; <span class="chapter-title">Related rates</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../derivatives/taylor_series_polynomials.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">35</span>&nbsp; <span class="chapter-title">Taylor Polynomials and other Approximating Polynomials</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" aria-expanded="true">Integrals</a>
<a class="sidebar-item-toggle text-start" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-4" aria-expanded="true">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-4" class="collapse list-unstyled sidebar-section depth1 show">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/area.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">36</span>&nbsp; <span class="chapter-title">Area under a curve</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/ftc.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">37</span>&nbsp; <span class="chapter-title">Fundamental Theorem or Calculus</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/substitution.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">38</span>&nbsp; <span class="chapter-title">Substitution</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/integration_by_parts.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">39</span>&nbsp; <span class="chapter-title">Integration By Parts</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/partial_fractions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">40</span>&nbsp; <span class="chapter-title">Partial Fractions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/improper_integrals.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">41</span>&nbsp; <span class="chapter-title">Improper Integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/mean_value_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">42</span>&nbsp; <span class="chapter-title">Mean value theorem for integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/area_between_curves.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">43</span>&nbsp; <span class="chapter-title">Area between two curves</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/center_of_mass.html" class="sidebar-item-text sidebar-link active"><span class="chapter-number">44</span>&nbsp; <span class="chapter-title">Center of Mass</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/volumes_slice.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">45</span>&nbsp; <span class="chapter-title">Volumes by slicing</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/arc_length.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">46</span>&nbsp; <span class="chapter-title">Arc length</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integrals/surface_area.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">47</span>&nbsp; <span class="chapter-title">Surface Area</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-5" aria-expanded="false">ODEs</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-5" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-5" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/odes.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">48</span>&nbsp; <span class="chapter-title">ODEs</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/euler.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">49</span>&nbsp; <span class="chapter-title">Eulers method</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/solve.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">50</span>&nbsp; <span class="chapter-title">The problem-algorithm-solve interface</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../ODEs/differential_equations.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">51</span>&nbsp; <span class="chapter-title">The <code>DifferentialEquations</code> suite</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-6" aria-expanded="false">Differential vector calculus</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-6" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-6" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/polar_coordinates.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">52</span>&nbsp; <span class="chapter-title">Polar Coordinates and Curves</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/vectors.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">53</span>&nbsp; <span class="chapter-title">Vectors and matrices</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/vector_valued_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">54</span>&nbsp; <span class="chapter-title">Vector-valued functions, <span class="math inline">\(f:R \rightarrow R^n\)</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/scalar_functions.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">55</span>&nbsp; <span class="chapter-title">Scalar functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/scalar_functions_applications.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">56</span>&nbsp; <span class="chapter-title">Applications with scalar functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/vector_fields.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">57</span>&nbsp; <span class="chapter-title">Functions <span class="math inline">\(R^n \rightarrow R^m\)</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../differentiable_vector_calculus/plots_plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">58</span>&nbsp; <span class="chapter-title">2D and 3D plots in Julia with Plots</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-7" aria-expanded="false">Integral vector calculus</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-7" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-7" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/double_triple_integrals.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">59</span>&nbsp; <span class="chapter-title">Multi-dimensional integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/line_integrals.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">60</span>&nbsp; <span class="chapter-title">Line and Surface Integrals</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/div_grad_curl.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">61</span>&nbsp; <span class="chapter-title">The Gradient, Divergence, and Curl</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/stokes_theorem.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">62</span>&nbsp; <span class="chapter-title">Greens Theorem, Stokes Theorem, and the Divergence Theorem</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../integral_vector_calculus/review.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">63</span>&nbsp; <span class="chapter-title">Quick Review of Vector Calculus</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-8" aria-expanded="false">Alternatives</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-8" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-8" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../alternatives/plotly_plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">64</span>&nbsp; <span class="chapter-title">JavaScript based plotting libraries</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../alternatives/makie_plotting.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">65</span>&nbsp; <span class="chapter-title">Calculus plots with Makie</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item sidebar-item-section">
<div class="sidebar-item-container">
<a class="sidebar-item-text sidebar-link text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-9" aria-expanded="false">Appendices</a>
<a class="sidebar-item-toggle text-start collapsed" data-bs-toggle="collapse" data-bs-target="#quarto-sidebar-section-9" aria-expanded="false">
<i class="bi bi-chevron-right ms-2"></i>
</a>
</div>
<ul id="quarto-sidebar-section-9" class="collapse list-unstyled sidebar-section depth1 ">
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/getting_started_with_julia.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">66</span>&nbsp; <span class="chapter-title">Getting started with Julia</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/julia_interfaces.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">67</span>&nbsp; <span class="chapter-title">Julia interfaces</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/calculus_with_julia.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">68</span>&nbsp; <span class="chapter-title">The <code>CalculusWithJulia</code> package</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/unicode.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">69</span>&nbsp; <span class="chapter-title">Usages of Unicode symbols</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../misc/quick_notes.html" class="sidebar-item-text sidebar-link"><span class="chapter-number">70</span>&nbsp; <span class="chapter-title">Quick introduction to Calculus with Julia</span></a>
</div>
</li>
</ul>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../references.html" class="sidebar-item-text sidebar-link">References</a>
</div>
</li>
</ul>
</div>
</nav>
<!-- margin-sidebar -->
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
<nav id="TOC" role="doc-toc">
<h2 id="toc-title">Table of contents</h2>
<ul>
<li><a href="#center-of-mass-of-figures" id="toc-center-of-mass-of-figures" class="nav-link active" data-scroll-target="#center-of-mass-of-figures"> <span class="header-section-number">44.1</span> Center of mass of figures</a>
<ul class="collapse">
<li><a href="#the-y-direction." id="toc-the-y-direction." class="nav-link" data-scroll-target="#the-y-direction."> <span class="header-section-number">44.1.1</span> The <span class="math inline">\(y\)</span> direction.</a></li>
</ul></li>
<li><a href="#questions" id="toc-questions" class="nav-link" data-scroll-target="#questions"> <span class="header-section-number">44.2</span> Questions</a></li>
</ul>
<div class="toc-actions"><div><i class="bi bi-github"></i></div><div class="action-links"><p><a href="https://github.com/jverzani/CalculusWithJuliaNotes.jl/edit/main/quarto/integrals/center_of_mass.qmd" class="toc-action">Edit this page</a></p><p><a href="https://github.com/jverzani/CalculusWithJuliaNotes.jl/issues/new" class="toc-action">Report an issue</a></p></div></div></nav>
</div>
<!-- main -->
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title d-none d-lg-block"><span class="chapter-number">44</span>&nbsp; <span class="chapter-title">Center of Mass</span></h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<p>This section uses these add-on packages:</p>
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">CalculusWithJulia</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">Plots</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">Roots</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">QuadGK</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">SymPy</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<hr>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="../integrals/figures/seesaw.png" class="img-fluid figure-img"></p>
<p></p><figcaption class="figure-caption">A silhouette of two children on a seesaw. The seesaw can be balanced only if the distance from the central point for each child reflects their relative weights, or masses, through the formula <span class="math inline">\(d_1m_1 = d_2 m_2\)</span>. This means if the two children weigh the same the balance will tip in favor of the child farther away, and if both are the same distance, the balance will tip in favor of the heavier.</figcaption><p></p>
</figure>
</div>
<p>The game of seesaw is one where children earn an early appreciation for the effects of distance and relative weight. For children with equal weights, the seesaw will balance if they sit an equal distance from the center (on opposite sides, of course). However, with unequal weights that isnt the case. If one child weighs twice as much, the other must sit twice as far.</p>
<p>The key relationship is that <span class="math inline">\(d_1 m_1 = d_2 m_2\)</span>. This come from physics, where the moment about a point is defined by the mass times the distance. This balance relationship says the overall moment balances out. When this is the case, then the <em>center of mass</em> is at the fulcrum point, so there is no impetus to move.</p>
<p>The <a href="http://en.wikipedia.org/wiki/Center_of_mass">center</a> of mass is an old concept that often allows a possibly complicated relationship involving weights to be reduced to a single point. The seesaw is an example: if the center of mass is at the fulcrum the seesaw can balance.</p>
<p>In general, we use position of the mass, rather than use distance from some fixed fulcrum. With this, the center of mass for a finite set of point masses distributed on the real line, is defined by:</p>
<p><span class="math display">\[
\bar{\text{cm}} = \frac{m_1 x_1 + m_2 x_2 + \cdots + m_n x_n}{m_1 + m_2 + \cdots + m_n}.
\]</span></p>
<p>Writing <span class="math inline">\(w_i = m_i / (m_1 + m_2 + \cdots + m_n)\)</span>, we get the center of mass is just a weighted sum: <span class="math inline">\(w_1 x_1 + \cdots + w_n x_n\)</span>, where the <span class="math inline">\(w_i\)</span> are the relative weights.</p>
<p>With some rearrangment, we can see that the center of mass satisfies the equation:</p>
<p><span class="math display">\[
w_1 \cdot (x_1 - \bar{\text{cm}}) + w_2 \cdot (x_2 - \bar{\text{cm}}) + \cdots + w_n \cdot (x_n - \bar{\text{cm}}) = 0.
\]</span></p>
<p>The center of mass is a balance of the weighted signed distances. This property of the center of mass being a balancing point makes it of intrinsic interest and can be - in the case of sufficient symmetry - easy to find.</p>
<section id="example" class="level5">
<h5 class="anchored" data-anchor-id="example">Example</h5>
<p>A set of weights sits on a dumbbell rack. They are spaced 1 foot apart starting with the 5, then the 10-, 15-, 25-, and 35-pound weights. Where is the center of mass?</p>
<p>We begin by letting <span class="math inline">\(m_1=5\)</span>, <span class="math inline">\(m_2=10\)</span>, <span class="math inline">\(m_3=15\)</span>, <span class="math inline">\(m_4=25\)</span> and <span class="math inline">\(m_5=35\)</span>. Our positions will be labeled <span class="math inline">\(x_i = i-1\)</span>, so the five-pound weight is at position <span class="math inline">\(0\)</span> and the <span class="math inline">\(35\)</span>-pound one at <span class="math inline">\(4\)</span>. The center of mass is then given by:</p>
<p><span class="math display">\[
\frac{5\cdot 0 + 10\cdot 1 + 15 \cdot 2 + 25 \cdot 3 + 35\cdot 4}{5 + 10 + 15 + 25 + 35} = \frac{255}{90} = 2.833
\]</span></p>
<p>If the <span class="math inline">\(25\)</span>-pound weight is removed, how does the center of mass shift?</p>
<p>We could add the terms again, or just reduce from our sum:</p>
<p><span class="math display">\[
\frac{255 - 25\cdot 3}{90 - 25} = \frac{180}{65} = 2.769...
\]</span></p>
<p>The center of mass shifts slightly, but since the removed weight was already close to the center of mass, the movement wasnt much.</p>
</section>
<section id="center-of-mass-of-figures" class="level2" data-number="44.1">
<h2 data-number="44.1" class="anchored" data-anchor-id="center-of-mass-of-figures"><span class="header-section-number">44.1</span> Center of mass of figures</h2>
<p>Consider now a more general problem, the center of mass of a solid figure. We will restrict our attention to figures that can be represented by functions in the <span class="math inline">\(x-y\)</span> plane which are two dimensional. For example, consider the region in the plane bounded by the <span class="math inline">\(x\)</span> axis and the function <span class="math inline">\(1 - \lvert x \rvert\)</span>. This is triangle with vertices <span class="math inline">\((-1,0)\)</span>, <span class="math inline">\((0,1)\)</span>, and <span class="math inline">\((1,0)\)</span>.</p>
<p>This graph shows that the figure is symmetric:</p>
<div class="cell" data-hold="true" data-execution_count="5">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> <span class="fl">1</span> <span class="op">-</span> <span class="fu">abs</span>(x)</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>a, b <span class="op">=</span> <span class="op">-</span><span class="fl">1.5</span>, <span class="fl">1.5</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(f, a, b)</span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(zero, a, b)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="6">
<p><img src="center_of_mass_files/figure-html/cell-6-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>As the center of mass should be a balancing value, we would guess intuitively that the center of mass in the <span class="math inline">\(x\)</span> direction will be <span class="math inline">\(x=0\)</span>.</p>
<p>But what should the center of mass formula be?</p>
<p>As with many formulas that will end up involving a derived integral, we start with a sum approximation. If the region is described as the area under the graph of <span class="math inline">\(f(x)\)</span> between <span class="math inline">\(a\)</span> and <span class="math inline">\(b\)</span>, then we can form a Riemann sum approximation, that is a choice of <span class="math inline">\(a = x_0 &lt; x_1 &lt; x_2 \cdots &lt; x_n = b\)</span> and points <span class="math inline">\(c_1\)</span>, <span class="math inline">\(\dots\)</span>, <span class="math inline">\(c_n\)</span>. If all the rectangles are made up of a material of uniform density, say <span class="math inline">\(\rho\)</span>, then the mass of each rectangle will be the area times <span class="math inline">\(\rho\)</span>, or <span class="math inline">\(\rho f(c_i) \cdot (x_i - x_{i-1})\)</span>, for <span class="math inline">\(i = 1, \dots , n\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="6">
<div class="cell-output cell-output-display" data-execution_count="7">
<p><img src="center_of_mass_files/figure-html/cell-7-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>The figure shows the approximating rectangles and circles representing their masses for <span class="math inline">\(n=20\)</span>.</p>
<p>Generalizing from this figure shows the center of mass for such an approximation will be:</p>
<p><span class="math display">\[
\begin{align*}
&amp;\frac{\rho f(c_1) (x_1 - x_0) \cdot x_1 + \rho f(c_2) (x_2 - x_1) \cdot x_1 + \cdots + \rho f(c_n) (x_n- x_{n-1}) \cdot x_{n-1}}{\rho f(c_1) (x_1 - x_0) + \rho f(c_2) (x_2 - x_1) + \cdots + \rho f(c_n) (x_n- x_{n-1})} \\
&amp;=\\
&amp;\quad\frac{f(c_1) (x_1 - x_0) \cdot x_1 + f(c_2) (x_2 - x_1) \cdot x_1 + \cdots + f(c_n) (x_n- x_{n-1}) \cdot x_{n-1}}{f(c_1) (x_1 - x_0) + f(c_2) (x_2 - x_1) + \cdots + f(c_n) (x_n- x_{n-1})}.
\end{align*}
\]</span></p>
<p>But the top part is an approximation to the integral <span class="math inline">\(\int_a^b x f(x) dx\)</span> and the bottom part the integral <span class="math inline">\(\int_a^b f(x) dx\)</span>. The ratio of these defines the center of mass.</p>
<blockquote class="blockquote">
<p><strong>Center of Mass</strong>: The center of mass (in the <span class="math inline">\(x\)</span> direction) of a region in the <span class="math inline">\(x-y\)</span> plane described by the area under a (positive) function <span class="math inline">\(f(x)\)</span> between <span class="math inline">\(a\)</span> and <span class="math inline">\(b\)</span> is given by</p>
<p><span class="math inline">\(\text{Center of mass} = \text{cm}_x = \frac{\int_a^b xf(x) dx}{\int_a^b f(x) dx}.\)</span></p>
<p>For regions described by a more complicated set of equations, the center of mass is found from the same formula where <span class="math inline">\(f(x)\)</span> is the total height in the <span class="math inline">\(x\)</span> direction for a given <span class="math inline">\(x\)</span>.</p>
</blockquote>
<p>For the triangular shape, we have by the fact that <span class="math inline">\(f(x) = 1 - \lvert x \rvert\)</span> is an even function that <span class="math inline">\(xf(x)\)</span> will be odd, so the integral around <span class="math inline">\(-1,1\)</span> will be <span class="math inline">\(0\)</span>. So the center of mass formula applied to this problem agrees with our expectation.</p>
<section id="example-1" class="level5">
<h5 class="anchored" data-anchor-id="example-1">Example</h5>
<p>What about the center of mass of the triangle formed by the line <span class="math inline">\(x=-1\)</span>, the <span class="math inline">\(x\)</span> axis and <span class="math inline">\((1-x)/2\)</span>? This too is defined between <span class="math inline">\(a=-1\)</span> and <span class="math inline">\(b=-1\)</span>, but the center of mass will be negative, as a graph shows more mass to the left of <span class="math inline">\(0\)</span> than the right:</p>
<div class="cell" data-hold="true" data-execution_count="7">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> (<span class="fl">1</span><span class="op">-</span>x)<span class="op">/</span><span class="fl">2</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(f, <span class="op">-</span><span class="fl">1</span>, <span class="fl">1</span>)</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(zero, <span class="op">-</span><span class="fl">1</span>, <span class="fl">1</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="8">
<p><img src="center_of_mass_files/figure-html/cell-8-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>The formulas give:</p>
<p><span class="math display">\[
\int_{-1}^1 xf(x) dx = \int_{-1}^1 x\cdot (1-x)/2 = (\frac{x^2}{4} - \frac{x^3}{6})\big|_{-1}^1 = -\frac{1}{3}.
\]</span></p>
<p>The bottom integral is just the area (or total mass if the <span class="math inline">\(\rho\)</span> were not canceled) and by geometry is <span class="math inline">\(1/2 (1)(2) = 1\)</span>. So <span class="math inline">\(\text{cm}_x = -1/3\)</span>.</p>
</section>
<section id="example-2" class="level5">
<h5 class="anchored" data-anchor-id="example-2">Example</h5>
<p>Find the center of mass formed by the intersection of the parabolas <span class="math inline">\(y=1 - x^2\)</span> and <span class="math inline">\(y=(x-1)^2 - 2\)</span>.</p>
<p>The center of mass (in the <span class="math inline">\(x\)</span> direction) can be seen to be close to <span class="math inline">\(x=1/2\)</span>:</p>
<div class="cell" data-execution_count="8">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f1</span>(x) <span class="op">=</span> <span class="fl">1</span> <span class="op">-</span> x<span class="op">^</span><span class="fl">2</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="fu">f2</span>(x) <span class="op">=</span> (x<span class="op">-</span><span class="fl">1</span>)<span class="op">^</span><span class="fl">2</span> <span class="op">-</span><span class="fl">2</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(f1, <span class="op">-</span><span class="fl">3</span>, <span class="fl">3</span>)</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(f2, <span class="op">-</span><span class="fl">3</span>, <span class="fl">3</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="9">
<p><img src="center_of_mass_files/figure-html/cell-9-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>To find it, we need to find the intersection points, then integrate. We do so numerically.</p>
<div class="cell" data-hold="true" data-execution_count="9">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">h</span>(x) <span class="op">=</span> <span class="fu">f1</span>(x) <span class="op">-</span> <span class="fu">f2</span>(x)</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a>a,b <span class="op">=</span> <span class="fu">find_zeros</span>(h, <span class="op">-</span><span class="fl">3</span>, <span class="fl">3</span>)</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a>top, err <span class="op">=</span> <span class="fu">quadgk</span>(x <span class="op">-&gt;</span> x <span class="op">*</span> <span class="fu">h</span>(x), a, b)</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a>bottom, err <span class="op">=</span> <span class="fu">quadgk</span>(h, a, b)</span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a>cm <span class="op">=</span> top <span class="op">/</span> bottom</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="10">
<pre><code>0.5000000000000001</code></pre>
</div>
</div>
<p>Our guess from the diagram proves correct.</p>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>It proves convenient to use the <code>-&gt;</code> notation for an anonymous function above, as our function <code>h</code> is not what is being integrated all the time, but some simple modification. If this isnt palatable, a new function could be defined and passed along to <code>quadgk</code>.</p>
</div>
</div>
</section>
<section id="example-3" class="level5">
<h5 class="anchored" data-anchor-id="example-3">Example</h5>
<p>Consider a region bounded by a probability density function. (These functions are non-negative, and integrate to <span class="math inline">\(1\)</span>.) The center of mass formula simplifies to <span class="math inline">\(\int xf(x) dx\)</span>, as the denominator will be <span class="math inline">\(1\)</span>, and the answer is called the <em>mean</em>, and often denoted by the Greek letter <span class="math inline">\(\mu\)</span>.</p>
<p>For the probability density <span class="math inline">\(f(x) = e^{-x}\)</span> for <span class="math inline">\(x\geq 0\)</span> and <span class="math inline">\(0\)</span> otherwise, find the mean.</p>
<p>We need to compute <span class="math inline">\(\int_{-\infty}^\infty xf(x) dx\)</span>, but in this case since <span class="math inline">\(f\)</span> is <span class="math inline">\(0\)</span> to the left of the origin, we just have:</p>
<p><span class="math display">\[
\mu = \int_0^\infty x e^{-x} dx = -(1+x) \cdot e^{-x} \big|_0^\infty = 1
\]</span></p>
<p>For fun, we compare this to the median, which is the value <span class="math inline">\(M\)</span> so that the total area is split in half. That is, the following formula is satisfied: <span class="math inline">\(\int_0^M f(x) dx = 1/2\)</span>. To compute, we have:</p>
<p><span class="math display">\[
\int_0^M e^{-x} dx = -e^{-x} \big|_0^M = 1 - e^{-M}.
\]</span></p>
<p>Solving <span class="math inline">\(1/2 = 1 - e^{-M}\)</span> gives <span class="math inline">\(M=\log(2) = 0.69...\)</span>, The median is to the left of the mean in this example.</p>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>In this example, we used an infinite region, so the idea of “balancing” may be a bit unrealistic, nonetheless, this intuitive interpretation is still a good one to keep this in mind. The point of comparing to the median is that the balancing point is to the right of where the area splits in half. Basically, the center of mass follows in the direction of the area far to the right of the median, as this area is skewed in that direction.</p>
</div>
</div>
</section>
<section id="example-4" class="level5">
<h5 class="anchored" data-anchor-id="example-4">Example</h5>
<p>A figure is formed by transformations of the function <span class="math inline">\(\phi(u) = e^{2(k-1)} - e^{2(k-u)}\)</span>, for some fixed <span class="math inline">\(k\)</span>, as follows:</p>
<div class="cell" data-execution_count="10">
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>k <span class="op">=</span> <span class="fl">3</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="fu">phi</span>(u) <span class="op">=</span> <span class="fu">exp</span>(<span class="fl">2</span>(k<span class="op">-</span><span class="fl">1</span>)) <span class="op">-</span> <span class="fu">exp</span>(<span class="fl">2</span>(k<span class="op">-</span>u))</span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(u) <span class="op">=</span> <span class="fu">max</span>(<span class="fl">0</span>, <span class="fu">phi</span>(u))</span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="fu">g</span>(u) <span class="op">=</span> <span class="fu">min</span>(<span class="fu">f</span>(u<span class="op">+</span><span class="fl">1</span>), <span class="fu">f</span>(k))</span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(f, <span class="fl">0</span>, k, legend<span class="op">=</span><span class="cn">false</span>)</span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(g, <span class="fl">0</span>, k)</span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a><span class="fu">plot!</span>(zero, <span class="fl">0</span>, k)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="11">
<p><img src="center_of_mass_files/figure-html/cell-11-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>(This is basically the graph of <span class="math inline">\(\phi(u)\)</span> and the graph of its shifted value <span class="math inline">\(\phi(u+1)\)</span>, only truncated on the top and bottom.)</p>
<p>The center of mass of this figure is found with:</p>
<div class="cell" data-execution_count="11">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">h</span>(x) <span class="op">=</span> <span class="fu">g</span>(x) <span class="op">-</span> <span class="fu">f</span>(x)</span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>top, _ <span class="op">=</span> <span class="fu">quadgk</span>(x <span class="op">-&gt;</span> <span class="fu">x*h</span>(x), <span class="fl">0</span>, k)</span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a>bottom, _ <span class="op">=</span> <span class="fu">quadgk</span>(h, <span class="fl">0</span>, k)</span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a>top<span class="op">/</span>bottom</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="12">
<pre><code>0.9626852772498595</code></pre>
</div>
</div>
<p>This figure has constant slices of length <span class="math inline">\(1\)</span> for fixed values of <span class="math inline">\(y\)</span>. If we were to approximate the values with blocks of height <span class="math inline">\(1\)</span>, then the center of mass would be to the left of <span class="math inline">\(1\)</span> - for any <span class="math inline">\(k\)</span>, but the top most block would have an overhang to the right of <span class="math inline">\(1\)</span> - out to a value of <span class="math inline">\(k\)</span>. That is, this figure should balance:</p>
<div class="cell" data-execution_count="12">
<div class="cell-output cell-output-display" data-execution_count="13">
<p><img src="center_of_mass_files/figure-html/cell-13-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>See this <a href="https://math.dartmouth.edu/~pw/papers/maxover.pdf">paper</a> and its references for some background on this example and its extensions.</p>
</section>
<section id="the-y-direction." class="level3" data-number="44.1.1">
<h3 data-number="44.1.1" class="anchored" data-anchor-id="the-y-direction."><span class="header-section-number">44.1.1</span> The <span class="math inline">\(y\)</span> direction.</h3>
<p>We can talk about the center of mass in the <span class="math inline">\(y\)</span> direction too. The approximating picture uses horizontal rectangles - not vertical ones - and if we describe them by <span class="math inline">\(f(y)\)</span>, then the corresponding formulas would be</p>
<blockquote class="blockquote">
<p><span class="math inline">\(\text{center of mass} = \text{cm}_y = \frac{\int_a^b y f(y) dy}{\int_a^b f(y) dy}.\)</span></p>
</blockquote>
<p>For example, consider, again, the triangle bounded by the line <span class="math inline">\(x=-1\)</span>, the <span class="math inline">\(x\)</span> axis, and the line <span class="math inline">\(y=(1-x)/2\)</span>. In terms of describing this in <span class="math inline">\(y\)</span>, the function <span class="math inline">\(f(y)=2 -2y\)</span> gives the total length of the horizontal slice (which comes from solving <span class="math inline">\(y=(x-1)/2\)</span>for <span class="math inline">\(x\)</span>, the general method to find an inverse function, and subtracting <span class="math inline">\(-1\)</span>) and the interval is <span class="math inline">\(y=0\)</span> to <span class="math inline">\(y=1\)</span>. Thus our center of mass in the <span class="math inline">\(y\)</span> direction will be</p>
<p><span class="math display">\[
\text{cm}_y = \frac{\int_0^1 y (2 - 2y) dy}{\int_0^1 (2 - 2y) dy} = \frac{(2y^2/2 - 2y^3/3)\big|_0^1}{1} = \frac{1}{3}.
\]</span></p>
<p>Here the center of mass is below <span class="math inline">\(1/2\)</span> as the bulk of the area is. (The bottom area is just <span class="math inline">\(1\)</span>, as known from the area of a triangle.)</p>
<p>As seen, the computation of the center of mass in the <span class="math inline">\(y\)</span> direction has an identical formula, though may be more involved if an inverse function must be computed.</p>
<section id="example-5" class="level5">
<h5 class="anchored" data-anchor-id="example-5">Example</h5>
<p>More generally, consider a right triangle with vertices <span class="math inline">\((0,0)\)</span>, <span class="math inline">\((0,a)\)</span>, and <span class="math inline">\((b,0)\)</span>. The center of mass of this can be computed with the help of the equation for the line that forms the hypotenuse: <span class="math inline">\(x/b + y/a = 1\)</span>. We find the center of mass symbolically in the <span class="math inline">\(y\)</span> variable by solving for <span class="math inline">\(x\)</span> in terms of <span class="math inline">\(y\)</span>, then integrating from <span class="math inline">\(0\)</span> to <span class="math inline">\(a\)</span>:</p>
<div class="cell" data-execution_count="13">
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="pp">@syms</span> a b x y</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a>eqn <span class="op">=</span> x<span class="op">/</span>b <span class="op">+</span> y<span class="op">/</span>a <span class="op">-</span> <span class="fl">1</span></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a>fy <span class="op">=</span> <span class="fu">solve</span>(eqn, x)[<span class="fl">1</span>]</span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a><span class="fu">integrate</span>(y<span class="op">*</span>fy, (y, <span class="fl">0</span>, a)) <span class="op">/</span> <span class="fu">integrate</span>(fy, (y, <span class="fl">0</span>, a))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="14">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\frac{a}{3}
\]
</span>
</div>
</div>
<p>The answer involves <span class="math inline">\(a\)</span> linearly, but not <span class="math inline">\(b\)</span>. If we find the center of mass in <span class="math inline">\(x\)</span>, we <em>could</em> do something similar:</p>
<div class="cell" data-execution_count="14">
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>fx <span class="op">=</span> <span class="fu">solve</span>(eqn, y)[<span class="fl">1</span>]</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="fu">integrate</span>(x<span class="op">*</span>fx, (x, <span class="fl">0</span>, b)) <span class="op">/</span> <span class="fu">integrate</span>(fx, (x, <span class="fl">0</span>, b))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="15">
<span class="math-left-align" style="padding-left: 4px; width:0; float:left;">
\[
\frac{b}{3}
\]
</span>
</div>
</div>
<p>But really, we should have just noted that simply by switching the labels <span class="math inline">\(a\)</span> and <span class="math inline">\(b\)</span> in the diagram we could have discovered this formula.</p>
<div class="callout-note callout callout-style-default callout-captioned">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-caption-container flex-fill">
Note
</div>
</div>
<div class="callout-body-container callout-body">
<p>The <a href="http://en.wikipedia.org/wiki/Centroid">centroid</a> of a region in the plane is just <span class="math inline">\((\text{cm}_x, \text{cm}_y)\)</span>. This last fact says the centroid of the right triangle is just <span class="math inline">\((b/3, a/3)\)</span>. The centroid can be found by other geometric means. The link shows the plumb line method. For triangles, the centroid is also the intersection point of the medians, the lines that connect a vertex with its opposite midpoint.</p>
</div>
</div>
</section>
<section id="example-6" class="level5">
<h5 class="anchored" data-anchor-id="example-6">Example</h5>
<p>Compute the <span class="math inline">\(x\)</span> and <span class="math inline">\(y\)</span> values of the center of mass of the half circle described by the area below the function <span class="math inline">\(f(x) = \sqrt{1 - x^2}\)</span> and above the <span class="math inline">\(x\)</span>-axis.</p>
<p>A plot shows the value of cm<span class="math inline">\(_x\)</span> will be <span class="math inline">\(0\)</span> by symmetry:</p>
<div class="cell" data-hold="true" data-execution_count="15">
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(x) <span class="op">=</span> <span class="fu">sqrt</span>(<span class="fl">1</span> <span class="op">-</span> x<span class="op">^</span><span class="fl">2</span>)</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="fu">plot</span>(f, <span class="op">-</span><span class="fl">1</span>, <span class="fl">1</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="16">
<p><img src="center_of_mass_files/figure-html/cell-16-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>(<span class="math inline">\(f(x)\)</span> is even, so <span class="math inline">\(xf(x)\)</span> will be odd.)</p>
<p>However, the value for cm<span class="math inline">\(_y\)</span> will - like the last problem - be around <span class="math inline">\(1/3\)</span>. The exact value is compute using slices in the <span class="math inline">\(y\)</span> direction. Solving for <span class="math inline">\(x\)</span> in <span class="math inline">\(y=\sqrt{1-x^2}\)</span>, or <span class="math inline">\(x = \pm \sqrt{1-y^2}\)</span>, if <span class="math inline">\(f(y) = 2\sqrt{1 - y^2}\)</span>. The value is then:</p>
<p><span class="math display">\[
\text{cm}_y = \frac{\int_{0}^1 y 2 \sqrt{1 - y^2}dy}{\int_{0}^1 2\sqrt{1-y^2}} =
\frac{-(1-x^2)^{3/2}/3\big|_0^1}{\pi/2} = \frac{1}{3}.
\]</span></p>
<p>In fact it is exactly <span class="math inline">\(1/3\)</span>. The top calculation is done by <span class="math inline">\(u\)</span>-substitution, the bottom by using the area formula for a half circle, <span class="math inline">\(\pi r^2/2\)</span>.</p>
</section>
<section id="example-7" class="level5">
<h5 class="anchored" data-anchor-id="example-7">Example</h5>
<p>A disc of radius <span class="math inline">\(2\)</span> is centered at the origin, as a disc of radius <span class="math inline">\(1\)</span> is bored out between <span class="math inline">\(y=0\)</span> and <span class="math inline">\(y=1\)</span>. Find the resulting center of mass.</p>
<p>A picture shows that this could be complicated, especially for <span class="math inline">\(y &gt; 0\)</span>, as we need to describe the length of the red lines below for <span class="math inline">\(-2 &lt; y &lt; 2\)</span>:</p>
<div class="cell" data-hold="true" data-execution_count="16">
<div class="cell-output cell-output-display" data-execution_count="17">
<p><img src="center_of_mass_files/figure-html/cell-17-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>We can see that cm<span class="math inline">\(_x = 0\)</span>, by symmetry, but to compute cm<span class="math inline">\(_y\)</span> we need to find <span class="math inline">\(f(y)\)</span>, which will depend on the value of <span class="math inline">\(y\)</span> between <span class="math inline">\(-2\)</span> and <span class="math inline">\(2\)</span>. The outer circle is <span class="math inline">\(x^2 + y^2 = 4\)</span>, the inner circle <span class="math inline">\(x^2 + (y-1)^2 = 1\)</span>. When <span class="math inline">\(y &lt; 0\)</span>, <span class="math inline">\(f(y)\)</span> is the distance across the outer circle or, <span class="math inline">\(2\sqrt{4 - y^2}\)</span>. When <span class="math inline">\(y \geq 0\)</span>, <span class="math inline">\(f(y)\)</span> is <em>twice</em> the distance from the bigger circle to the smaller, of <span class="math inline">\(2(\sqrt{4 - y^2} - \sqrt{1 - (y-1)^2})\)</span>.</p>
<p>We use this to compute:</p>
<div class="cell" data-hold="true" data-execution_count="17">
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode julia code-with-copy"><code class="sourceCode julia"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="fu">f</span>(y) <span class="op">=</span> y <span class="op">&lt;</span> <span class="fl">0</span> ? <span class="fl">2</span><span class="fu">*sqrt</span>(<span class="fl">4</span> <span class="op">-</span> y<span class="op">^</span><span class="fl">2</span>) <span class="op">:</span> <span class="fl">2</span><span class="op">*</span> (<span class="fu">sqrt</span>(<span class="fl">4</span> <span class="op">-</span> y<span class="op">^</span><span class="fl">2</span>)<span class="op">-</span> <span class="fu">sqrt</span>(<span class="fl">1</span> <span class="op">-</span> (y<span class="op">-</span><span class="fl">1</span>)<span class="op">^</span><span class="fl">2</span>))</span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a>top, _ <span class="op">=</span> <span class="fu">quadgk</span>( y <span class="op">-&gt;</span> y <span class="op">*</span> <span class="fu">f</span>(y), <span class="op">-</span><span class="fl">2</span>, <span class="fl">2</span>)</span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a>bottom, _ <span class="op">=</span> <span class="fu">quadgk</span>( f, <span class="op">-</span><span class="fl">2</span>, <span class="fl">2</span>)</span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true" tabindex="-1"></a>top<span class="op">/</span>bottom</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-display" data-execution_count="18">
<pre><code>-0.3333333333594305</code></pre>
</div>
</div>
<p>The nice answer of <span class="math inline">\(-1/3\)</span> makes us think there may be a different way to visualize this. Were we to rearrange the top integral, we could write it as <span class="math inline">\(\int_{-2}^2 y 2 \sqrt{4 -y^2}dy - \int_0^2 2y\sqrt{1 - (y-1)^2}dy\)</span>. Call this <span class="math inline">\(A - B\)</span>. The left term, <span class="math inline">\(A\)</span>, is part of the center of mass formula for the big circle (which is this value divided by <span class="math inline">\(M=4\pi\)</span>), and the right term, <span class="math inline">\(B\)</span>, is part of the center of mass formula for the (drilled out) smaller circle (which is this value divided by <span class="math inline">\(m=\pi\)</span>. These values are weighted according to <span class="math inline">\((AM - Bm)/(M-m)\)</span>. In this case <span class="math inline">\(A=0\)</span>, <span class="math inline">\(B=1\)</span> and <span class="math inline">\(M=4m\)</span>, so the answer is <span class="math inline">\(-1/3\)</span>.</p>
</section>
</section>
</section>
<section id="questions" class="level2" data-number="44.2">
<h2 data-number="44.2" class="anchored" data-anchor-id="questions"><span class="header-section-number">44.2</span> Questions</h2>
<section id="question" class="level6">
<h6 class="anchored" data-anchor-id="question">Question</h6>
<p>Find the center of mass in the <span class="math inline">\(x\)</span> variable for the region bounded by parabola <span class="math inline">\(x=4 - y^2\)</span> and the <span class="math inline">\(y\)</span> axis.</p>
<div class="cell" data-hold="true" data-execution_count="18">
<div class="cell-output cell-output-display" data-execution_count="19">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="5815611462000560448" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_5815611462000560448">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="5815611462000560448" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="5815611462000560448_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("5815611462000560448").addEventListener("change", function() {
var correct = (Math.abs(this.value - 1.5999999998855376) <= 0.001);
var msgBox = document.getElementById('5815611462000560448_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_5815611462000560448")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_5815611462000560448")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
<section id="question-1" class="level6">
<h6 class="anchored" data-anchor-id="question-1">Question</h6>
<p>Find the center of mass in the <span class="math inline">\(x\)</span> variable of the region in the first and fourth quadrants bounded by the ellipse <span class="math inline">\((x/2)^2 + (y/3)^2 = 1\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="19">
<div class="cell-output cell-output-display" data-execution_count="20">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="9480001985154269327" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_9480001985154269327">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="9480001985154269327" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="9480001985154269327_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("9480001985154269327").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.8488263630519628) <= 0.001);
var msgBox = document.getElementById('9480001985154269327_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_9480001985154269327")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_9480001985154269327")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
<section id="question-2" class="level6">
<h6 class="anchored" data-anchor-id="question-2">Question</h6>
<p>Find the center of mass of the region in the first quadrant bounded by the function <span class="math inline">\(f(x) = x^3(1-x)^4\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="20">
<div class="cell-output cell-output-display" data-execution_count="21">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="18369342891265549204" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_18369342891265549204">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="18369342891265549204" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="18369342891265549204_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("18369342891265549204").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.4444444444444445) <= 0.001);
var msgBox = document.getElementById('18369342891265549204_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_18369342891265549204")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_18369342891265549204")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
<section id="question-3" class="level6">
<h6 class="anchored" data-anchor-id="question-3">Question</h6>
<p>Let <span class="math inline">\(k\)</span> and <span class="math inline">\(\lambda\)</span> be parameters in <span class="math inline">\((0, \infty)\)</span>. The <a href="http://en.wikipedia.org/wiki/Weibull_distribution">Weibull</a> density is a probability density on <span class="math inline">\([0, \infty)\)</span> (meaning it is <span class="math inline">\(0\)</span> when <span class="math inline">\(x &lt; 0\)</span> satisfying:</p>
<p><span class="math display">\[
f(x) = \frac{k}{\lambda}\left(\frac{x}{\lambda}\right)^{k-1} \exp(-(\frac{x}{\lambda})^k)
\]</span></p>
<p>For <span class="math inline">\(k=2\)</span> and <span class="math inline">\(\lambda = 2\)</span>, compute the mean. (The center of mass, assuming the total area is <span class="math inline">\(1\)</span>.)</p>
<div class="cell" data-hold="true" data-execution_count="21">
<div class="cell-output cell-output-display" data-execution_count="22">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="9897578961591177962" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_9897578961591177962">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="9897578961591177962" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="9897578961591177962_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("9897578961591177962").addEventListener("change", function() {
var correct = (Math.abs(this.value - 1.7724538509055145) <= 0.001);
var msgBox = document.getElementById('9897578961591177962_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_9897578961591177962")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_9897578961591177962")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
<section id="question-4" class="level6">
<h6 class="anchored" data-anchor-id="question-4">Question</h6>
<p>The <a href="http://en.wikipedia.org/wiki/Logistic_distribution">logistic</a> density depends on two parameters <span class="math inline">\(m\)</span> and <span class="math inline">\(s\)</span> and is given by:</p>
<p><span class="math display">\[
f(x) = \frac{1}{4s} \text{sech}(\frac{x-\mu}{2s})^2, \quad -\infty &lt; x &lt; \infty.
\]</span></p>
<p>(Where <span class="math inline">\(\text{sech}\)</span> is the hyperbolic secant, implemented in <code>julia</code> through <code>sech</code>.)</p>
<p>For <span class="math inline">\(m=2\)</span> and <span class="math inline">\(s=4\)</span> compute the mean, or center of mass, of this density.</p>
<div class="cell" data-hold="true" data-execution_count="22">
<div class="cell-output cell-output-display" data-execution_count="23">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="13329802158622313437" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_13329802158622313437">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="13329802158622313437" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="13329802158622313437_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("13329802158622313437").addEventListener("change", function() {
var correct = (Math.abs(this.value - 2.0000000000002287) <= 0.001);
var msgBox = document.getElementById('13329802158622313437_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_13329802158622313437")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_13329802158622313437")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
<section id="question-5" class="level6">
<h6 class="anchored" data-anchor-id="question-5">Question</h6>
<p>A region is formed by intersecting the area bounded by the circle <span class="math inline">\(x^2 + y^2 = 1\)</span> that lies above the line <span class="math inline">\(y=3/4\)</span>. Find the center of mass in the <span class="math inline">\(y\)</span> direction (that of the <span class="math inline">\(x\)</span> direction is <span class="math inline">\(0\)</span> by symmetry).</p>
<div class="cell" data-hold="true" data-execution_count="23">
<div class="cell-output cell-output-display" data-execution_count="24">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="18213816844248112810" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_18213816844248112810">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="18213816844248112810" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="18213816844248112810_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("18213816844248112810").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.8511553682895965) <= 0.001);
var msgBox = document.getElementById('18213816844248112810_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_18213816844248112810")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_18213816844248112810")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
<section id="question-6" class="level6">
<h6 class="anchored" data-anchor-id="question-6">Question</h6>
<p>Find the center of mass in the <span class="math inline">\(y\)</span> direction of the area bounded by the cosine curve and the <span class="math inline">\(x\)</span> axis between <span class="math inline">\(-\pi/2\)</span> and <span class="math inline">\(\pi/2\)</span>.</p>
<div class="cell" data-hold="true" data-execution_count="24">
<div class="cell-output cell-output-display" data-execution_count="25">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="11166376630325501648" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_11166376630325501648">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="11166376630325501648" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="11166376630325501648_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("11166376630325501648").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.392699081675986) <= 0.001);
var msgBox = document.getElementById('11166376630325501648_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_11166376630325501648")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_11166376630325501648")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
<section id="question-7" class="level6">
<h6 class="anchored" data-anchor-id="question-7">Question</h6>
<p>A penny, nickel, dime and quarter are stacked so that their right most edges align and are centered so that the center of mass in the <span class="math inline">\(y\)</span> direction is <span class="math inline">\(0\)</span>. Find the center of mass in the <span class="math inline">\(x\)</span> direction.</p>
<div class="cell" data-hold="true" data-execution_count="25">
<div class="cell-output cell-output-display" data-execution_count="26">
<p><img src="center_of_mass_files/figure-html/cell-26-output-1.svg" class="img-fluid"></p>
</div>
</div>
<p>You will need some specifications, such as these from the <a href="http://www.usmint.gov/about_the_mint/?action=coin_specifications">US Mint</a></p>
<pre data-eval="false"><code> diameter(in) weight(gms)
penny 0.750 2.500
nickel 0.835 5.000
dime 0.705 2.268
quarter 0.955 5.670
</code></pre>
<p>(Hint: Though this could be done with integration, it is easier to treat each coin as a single point (its centroid) with the given mass and then apply the formula for sums.)</p>
<div class="cell" data-hold="true" data-execution_count="26">
<div class="cell-output cell-output-display" data-execution_count="27">
<form class="mx-2 my-3 mw-100" name="WeaveQuestion" data-id="17230280554756917811" data-controltype="">
<div class="form-group ">
<div class="controls">
<div class="form" id="controls_17230280554756917811">
<div style="padding-top: 5px">
<br>
<div class="input-group">
<input id="17230280554756917811" type="number" class="form-control" placeholder="Numeric answer">
</div>
</div>
</div>
<div id="17230280554756917811_message" style="padding-bottom: 15px"></div>
</div>
</div>
</form>
<script text="text/javascript">
document.getElementById("17230280554756917811").addEventListener("change", function() {
var correct = (Math.abs(this.value - 0.05439499935224769) <= 0.001);
var msgBox = document.getElementById('17230280554756917811_message');
if(correct) {
msgBox.innerHTML = "<div class='pluto-output admonition note alert alert-success'><span> 👍&nbsp; Correct </span></div>";
var explanation = document.getElementById("explanation_17230280554756917811")
if (explanation != null) {
explanation.style.display = "none";
}
} else {
msgBox.innerHTML = "<div class='pluto-output admonition alert alert-danger'><span>👎&nbsp; Incorrect </span></div>";
var explanation = document.getElementById("explanation_17230280554756917811")
if (explanation != null) {
explanation.style.display = "block";
}
}
});
</script>
</div>
</div>
</section>
</section>
</main> <!-- /main -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const clipboard = new window.ClipboardJS('.code-copy-button', {
target: function(trigger) {
return trigger.previousElementSibling;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
setTimeout(function() {
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start'
};
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
let href = ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
for (var i=0; i<bibliorefs.length; i++) {
const ref = bibliorefs[i];
const cites = ref.parentNode.getAttribute('data-cites').split(' ');
tippyHover(ref, function() {
var popup = window.document.createElement('div');
cites.forEach(function(cite) {
var citeDiv = window.document.createElement('div');
citeDiv.classList.add('hanging-indent');
citeDiv.classList.add('csl-entry');
var biblioDiv = window.document.getElementById('ref-' + cite);
if (biblioDiv) {
citeDiv.innerHTML = biblioDiv.innerHTML;
}
popup.appendChild(citeDiv);
});
return popup.innerHTML;
});
}
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
var filterRegex = new RegExp('/' + window.location.host + '/');
var isInternal = (href) => {
return filterRegex.test(href) || localhostRegex.test(href);
}
// Inspect non-navigation links and adorn them if external
var links = window.document.querySelectorAll('a:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external)');
for (var i=0; i<links.length; i++) {
const link = links[i];
if (!isInternal(link.href)) {
// target, if specified
link.setAttribute("target", "_blank");
}
}
});
</script>
<nav class="page-navigation">
<div class="nav-page nav-page-previous">
<a href="../integrals/area_between_curves.html" class="pagination-link">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">43</span>&nbsp; <span class="chapter-title">Area between two curves</span></span>
</a>
</div>
<div class="nav-page nav-page-next">
<a href="../integrals/volumes_slice.html" class="pagination-link">
<span class="nav-page-text"><span class="chapter-number">45</span>&nbsp; <span class="chapter-title">Volumes by slicing</span></span> <i class="bi bi-arrow-right-short"></i>
</a>
</div>
</nav>
</div> <!-- /content -->
<footer class="footer">
<div class="nav-footer">
<div class="nav-footer-center">Copyright 2022, John Verzani</div>
</div>
</footer>
</body></html>