Files
maths-cs-ai-compendium-zh/images/area_under_curve.svg
T

41 lines
2.4 KiB
XML

<svg width="380" height="200" xmlns="http://www.w3.org/2000/svg">
<defs>
<marker id="auc-arr" markerWidth="7" markerHeight="5" refX="7" refY="2.5" orient="auto">
<path d="M0,0 L7,2.5 L0,5" fill="#ccc"/>
</marker>
</defs>
<!-- Axes -->
<line x1="40" y1="165" x2="360" y2="165" stroke="#ccc" stroke-width="1" marker-end="url(#auc-arr)"/>
<line x1="40" y1="165" x2="40" y2="15" stroke="#ccc" stroke-width="1" marker-end="url(#auc-arr)"/>
<text x="365" y="168" fill="#999" font-size="10">x</text>
<text x="35" y="12" fill="#999" font-size="10">y</text>
<!-- Rectangles (Riemann sum) -->
<rect x="80" y="110" width="30" height="55" fill="#9b59b6" fill-opacity="0.15" stroke="#9b59b6" stroke-width="0.8"/>
<rect x="110" y="85" width="30" height="80" fill="#9b59b6" fill-opacity="0.15" stroke="#9b59b6" stroke-width="0.8"/>
<rect x="140" y="65" width="30" height="100" fill="#9b59b6" fill-opacity="0.15" stroke="#9b59b6" stroke-width="0.8"/>
<rect x="170" y="50" width="30" height="115" fill="#9b59b6" fill-opacity="0.15" stroke="#9b59b6" stroke-width="0.8"/>
<rect x="200" y="42" width="30" height="123" fill="#9b59b6" fill-opacity="0.15" stroke="#9b59b6" stroke-width="0.8"/>
<rect x="230" y="40" width="30" height="125" fill="#9b59b6" fill-opacity="0.15" stroke="#9b59b6" stroke-width="0.8"/>
<rect x="260" y="48" width="30" height="117" fill="#9b59b6" fill-opacity="0.15" stroke="#9b59b6" stroke-width="0.8"/>
<rect x="290" y="68" width="30" height="97" fill="#9b59b6" fill-opacity="0.15" stroke="#9b59b6" stroke-width="0.8"/>
<!-- Curve -->
<path d="M 60,145 Q 110,110 150,70 Q 190,40 230,38 Q 270,42 300,65 Q 330,95 345,120"
fill="none" stroke="#e74c3c" stroke-width="2.5"/>
<text x="348" y="118" fill="#e74c3c" font-size="11">f(x)</text>
<!-- Boundary markers -->
<line x1="80" y1="165" x2="80" y2="160" stroke="#333" stroke-width="1.5"/>
<text x="80" y="178" text-anchor="middle" fill="#333" font-size="10">a</text>
<line x1="320" y1="165" x2="320" y2="160" stroke="#333" stroke-width="1.5"/>
<text x="320" y="178" text-anchor="middle" fill="#333" font-size="10">b</text>
<!-- Delta x annotation -->
<line x1="140" y1="165" x2="170" y2="165" stroke="#3498db" stroke-width="2"/>
<text x="155" y="158" text-anchor="middle" fill="#3498db" font-size="9">Δx</text>
<text x="200" y="195" text-anchor="middle" fill="#666" font-size="10">more rectangles → better approximation → integral</text>
</svg>