<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Yueswater Blog</title>
<link>https://your-domain.com/projects/</link>
<atom:link href="https://your-domain.com/projects/index.xml" rel="self" type="application/rss+xml"/>
<description></description>
<image>
<url>https://your-domain.com/images/logo.png</url>
<title>Yueswater Blog</title>
<link>https://your-domain.com/projects/</link>
<height>82</height>
<width>144</width>
</image>
<generator>quarto-1.8.24</generator>
<lastBuildDate>Sun, 12 Apr 2026 00:00:00 GMT</lastBuildDate>
<item>
  <title>econ-viz</title>
  <dc:creator>Anthony </dc:creator>
  <link>https://your-domain.com/projects/posts/econ-viz/econ-viz.html</link>
  <description><![CDATA[ 




<section id="專案簡介" class="level2">
<h2 class="anchored" data-anchor-id="專案簡介">專案簡介</h2>
<p><strong>econ-viz</strong> 是我自己開發的 Python 套件，專門用來繪製個體經濟學的教學圖形。只要告訴它效用函數、價格和所得，它就會自動求解均衡點，畫出完整的無異曲線地圖、預算線與均衡圖，並可匯出為 PNG、PDF 或 SVG。</p>
<p>這個套件的出發點很簡單——用 matplotlib 從頭畫這些圖太繁瑣了，每次都要手動算等高線、算切點、設格式。我希望有一個工具讓我只需要描述「模型長什麼樣」，剩下的事情交給套件處理。</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
註釋
</div>
</div>
<div class="callout-body-container callout-body">
<p>目前版本：<strong>v1.4.0</strong> ・ 測試覆蓋率：<strong>99%</strong> ・ 測試數量：<strong>235</strong></p>
</div>
</div>
</section>
<section id="主要功能" class="level2">
<h2 class="anchored" data-anchor-id="主要功能">主要功能</h2>
<p><strong>八種內建效用模型</strong></p>
<p>涵蓋個體經濟學常用的偏好類型：</p>
<table class="caption-top table">
<thead>
<tr class="header">
<th style="text-align: left;">模型</th>
<th style="text-align: left;">類別</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">Cobb-Douglas</td>
<td style="text-align: left;"><code>CobbDouglas(alpha, beta)</code></td>
</tr>
<tr class="even">
<td style="text-align: left;">Leontief（完全互補）</td>
<td style="text-align: left;"><code>Leontief(a, b)</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;">完全替代</td>
<td style="text-align: left;"><code>PerfectSubstitutes(a, b)</code></td>
</tr>
<tr class="even">
<td style="text-align: left;">CES</td>
<td style="text-align: left;"><code>CES(alpha, rho)</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;">Quasi-Linear</td>
<td style="text-align: left;"><code>QuasiLinear(alpha)</code></td>
</tr>
<tr class="even">
<td style="text-align: left;">Stone-Geary</td>
<td style="text-align: left;"><code>StoneGeary(alpha, beta, x0, y0)</code></td>
</tr>
<tr class="odd">
<td style="text-align: left;">Translog</td>
<td style="text-align: left;"><code>Translog(alpha, beta, gamma)</code></td>
</tr>
<tr class="even">
<td style="text-align: left;">Satiation</td>
<td style="text-align: left;"><code>Satiation(x_sat, y_sat)</code></td>
</tr>
</tbody>
</table>
<p><strong>自動均衡求解</strong></p>
<p><code>solve()</code> 使用 SLSQP 最佳化，能處理內部解、角點解、Leontief 扭折解，並回傳結構化的 <code>Equilibrium</code> 物件（含 <code>x</code>、<code>y</code>、<code>utility</code>、<code>bundle_type</code> 欄位）。</p>
<p><strong>分析工具</strong></p>
<ul>
<li><code>comparative_statics()</code> — 六個馬歇爾需求偏導數的數值估計</li>
<li><code>slutsky_matrix()</code> — 二財 Slutsky 替代矩陣</li>
<li><code>HomogeneityAnalyzer</code> — 齊次性分析、Euler 定理驗證、需求的零次齊次性檢定</li>
</ul>
<p><strong>多面板圖形</strong></p>
<p><code>Figure</code> 搭配 <code>Layout</code> 列舉（並列、堆疊、格狀），可組合多個 <code>Canvas</code> 到同一張圖，適合做「價格變動前後比較」的教學示意圖。</p>
<p><strong>需求曲線圖</strong></p>
<p><code>PricePath</code> / <code>IncomePath</code> + <code>DemandDiagram</code>：自動連結商品空間的均衡軌跡與馬歇爾需求曲線，一鍵生成價格消費曲線（PCC）/所得消費曲線（ICC）教學圖。</p>
<p><strong>LaTeX 解析器</strong></p>
<p>直接輸入 LaTeX 算式，例如 <code>x^{0.4} y^{0.6}</code>，套件會自動解析並回傳對應的模型物件。</p>
<p><strong>動畫輸出</strong></p>
<p><code>Animator</code> 支援參數掃描、價格掃描、所得掃描，輸出為 GIF，適合嵌入教材或簡報。</p>
<p><strong>互動式 Widget</strong></p>
<p>在 Jupyter Notebook 中使用 <code>WidgetViewer</code>，可即時拖動參數滑桿或直接輸入數值，觀察均衡點如何變化。</p>
</section>
<section id="安裝方式" class="level2">
<h2 class="anchored" data-anchor-id="安裝方式">安裝方式</h2>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">pip</span> install econ-viz</span></code></pre></div></div>
<p>需要 Python 3.10 以上。依賴套件：<code>numpy</code>、<code>matplotlib</code>、<code>scipy</code>、<code>sympy</code>。</p>
</section>
<section id="快速開始" class="level2">
<h2 class="anchored" data-anchor-id="快速開始">快速開始</h2>
<section id="最小範例" class="level3">
<h3 class="anchored" data-anchor-id="最小範例">最小範例</h3>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> econ_viz <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> Canvas, levels, solve</span>
<span id="cb2-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> econ_viz.models <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> CobbDouglas</span>
<span id="cb2-3"></span>
<span id="cb2-4">model <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> CobbDouglas(alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, beta<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb2-5">eq    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> solve(model, px<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>, py<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>, income<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.0</span>)</span>
<span id="cb2-6">lvls  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> levels.around(eq.utility, n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>)</span>
<span id="cb2-7"></span>
<span id="cb2-8">cvs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Canvas(x_max<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, y_max<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, x_label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"x"</span>, y_label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"y"</span>,</span>
<span id="cb2-9">             title<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">r"Cobb-Douglas </span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">$</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">x</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">^</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">{0</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">.</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">5} y</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">^</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">{0</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">.</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">5}</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">$</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb2-10">cvs.add_utility(model, levels<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>lvls)</span>
<span id="cb2-11">cvs.add_budget(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.0</span>, fill<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>)</span>
<span id="cb2-12">cvs.add_equilibrium(eq, show_ray<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>)</span>
<span id="cb2-13">cvs.save(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cobb_douglas.png"</span>)</span></code></pre></div></div>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://your-domain.com/projects/posts/econ-viz/images/cobb_douglas.png" class="img-fluid figure-img" style="width:50.0%"></p>
<figcaption>Cobb-Douglas 均衡圖</figcaption>
</figure>
</div>
</section>
<section id="latex-解析" class="level3">
<h3 class="anchored" data-anchor-id="latex-解析">LaTeX 解析</h3>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> econ_viz <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> parse_latex, Canvas, levels, solve</span>
<span id="cb3-2"></span>
<span id="cb3-3">model <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> parse_latex(<span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">r"x</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">^</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">{0</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">.</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">4} y</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">^</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">{0</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">.</span><span class="vs" style="color: #20794D;
background-color: null;
font-style: inherit;">6}"</span>)</span>
<span id="cb3-4">eq    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> solve(model, px<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>, py<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>, income<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.0</span>)</span>
<span id="cb3-5">lvls  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> levels.around(eq.utility, n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>)</span>
<span id="cb3-6"></span>
<span id="cb3-7">Canvas(x_max<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, y_max<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-8">    .add_utility(model, levels<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>lvls) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-9">    .add_budget(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.0</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-10">    .add_equilibrium(eq) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-11">    .save(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"figure.png"</span>)</span></code></pre></div></div>
</section>
<section id="需求曲線圖" class="level3">
<h3 class="anchored" data-anchor-id="需求曲線圖">需求曲線圖</h3>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> econ_viz <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> DemandDiagram, LinearBudget, PricePath</span>
<span id="cb4-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> econ_viz.models <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> CobbDouglas</span>
<span id="cb4-3"></span>
<span id="cb4-4">model  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> CobbDouglas(alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, beta<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb4-5">budget <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> LinearBudget(px<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>, py<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>, income<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">40.0</span>)</span>
<span id="cb4-6">path   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> PricePath(model, budget<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>budget, price<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"px"</span>,</span>
<span id="cb4-7">                   price_range<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6.0</span>), n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">40</span>)</span>
<span id="cb4-8"></span>
<span id="cb4-9">fig <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> DemandDiagram(path, title<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Demand: Cobb-Douglas"</span>)</span>
<span id="cb4-10">fig.add_marshallian_panel(price_markers<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4.0</span>])</span>
<span id="cb4-11">fig.save(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"demand.png"</span>)</span></code></pre></div></div>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://your-domain.com/projects/posts/econ-viz/images/demand_cobb_douglas.png" class="img-fluid figure-img" style="width:50.0%"></p>
<figcaption>需求曲線教學圖</figcaption>
</figure>
</div>
</section>
<section id="slutsky-矩陣" class="level3">
<h3 class="anchored" data-anchor-id="slutsky-矩陣">Slutsky 矩陣</h3>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> econ_viz <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> slutsky_matrix</span>
<span id="cb5-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> econ_viz.models <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> CobbDouglas</span>
<span id="cb5-3"></span>
<span id="cb5-4">S <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> slutsky_matrix(CobbDouglas(alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.4</span>, beta<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.6</span>),</span>
<span id="cb5-5">                   px<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>, py<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>, income<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">60.0</span>)</span>
<span id="cb5-6"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(S.s_xx, S.s_xy)</span>
<span id="cb5-7"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(S.s_yx, S.s_yy)</span></code></pre></div></div>
</section>
<section id="edgeworth-box" class="level3">
<h3 class="anchored" data-anchor-id="edgeworth-box">Edgeworth Box</h3>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> econ_viz <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> EdgeworthBox, EquilibriumFocusConfig</span>
<span id="cb6-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> econ_viz.models <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> CobbDouglas</span>
<span id="cb6-3"></span>
<span id="cb6-4">box <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> EdgeworthBox(</span>
<span id="cb6-5">    CobbDouglas(alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, beta<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>),</span>
<span id="cb6-6">    CobbDouglas(alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.4</span>, beta<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.6</span>),</span>
<span id="cb6-7">    total_x<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.0</span>,</span>
<span id="cb6-8">    total_y<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8.0</span>,</span>
<span id="cb6-9">    title<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edgeworth Box"</span>,</span>
<span id="cb6-10">)</span>
<span id="cb6-11">(</span>
<span id="cb6-12">    box.add_endowment(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>)</span>
<span id="cb6-13">       .add_contract_curve(n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>)</span>
<span id="cb6-14">       .add_core()</span>
<span id="cb6-15">       .add_price_line(px<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, py<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>)</span>
<span id="cb6-16">       .add_walrasian_equilibrium(px<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, py<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>)</span>
<span id="cb6-17">       .save(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"edgeworth.png"</span>)</span>
<span id="cb6-18">)</span></code></pre></div></div>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://your-domain.com/projects/posts/econ-viz/images/edgeworth_cobb_symmetric.png" class="img-fluid figure-img" style="width:50.0%"></p>
<figcaption>Edgeworth Box（Cobb-Douglas × Cobb-Douglas）</figcaption>
</figure>
</div>
</section>
</section>
<section id="cli" class="level2">
<h2 class="anchored" data-anchor-id="cli">CLI</h2>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb7-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 列出所有支援的模型</span></span>
<span id="cb7-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">econ-viz</span> models</span>
<span id="cb7-3"></span>
<span id="cb7-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 繪圖並儲存</span></span>
<span id="cb7-5"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">econ-viz</span> plot <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--model</span> cobb-douglas <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--alpha</span> 0.5 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--beta</span> 0.5 <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb7-6">              <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--px</span> 2 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--py</span> 3 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--income</span> 30 <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb7-7">              <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--fill</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--show-ray</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb7-8">              <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--output</span> cobb_douglas.png</span>
<span id="cb7-9"></span>
<span id="cb7-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 輸出馬歇爾需求封閉解 LaTeX</span></span>
<span id="cb7-11"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">econ-viz</span> solve-tex <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--model</span> cobb-douglas <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--symbolic-params</span></span></code></pre></div></div>
</section>
<section id="連結" class="level2">
<h2 class="anchored" data-anchor-id="連結">連結</h2>
<ul>
<li><a href="https://econ-viz.org">官方文件</a></li>
<li><a href="https://github.com/EconViz/econ-viz">GitHub</a></li>
<li><a href="https://pypi.org/project/econ-viz/">PyPI</a></li>
</ul>


</section>

<a onclick="window.scrollTo(0, 0); return false;" id="quarto-back-to-top"><i class="bi bi-arrow-up"></i> 回到頂端</a> ]]></description>
  <category>Python</category>
  <category>資料視覺化</category>
  <category>經濟學</category>
  <guid>https://your-domain.com/projects/posts/econ-viz/econ-viz.html</guid>
  <pubDate>Sun, 12 Apr 2026 00:00:00 GMT</pubDate>
  <media:content url="https://your-domain.com/projects/posts/econ-viz/images/cover.svg" medium="image" type="image/svg+xml"/>
</item>
</channel>
</rss>
