Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AgungSudanta committed Nov 25, 2024
2 parents 72901bd + d254193 commit a484a73
Show file tree
Hide file tree
Showing 32 changed files with 4,335 additions and 2,142 deletions.
Binary file modified .RData
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/listings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
{
"listing": "/semuahalaman/modulprak/2024/ganjil/molin/molin2024.html",
"items": [
"/semuahalaman/modulprak/2024/ganjil/molin/modul6.html",
"/semuahalaman/modulprak/2024/ganjil/molin/modul5.html",
"/semuahalaman/modulprak/2024/ganjil/molin/modul4.html",
"/semuahalaman/modulprak/2024/ganjil/molin/modul3.html",
Expand Down
4,144 changes: 2,079 additions & 2,065 deletions docs/search.json

Large diffs are not rendered by default.

96 changes: 48 additions & 48 deletions docs/semuahalaman/modulprak/2023/genap/pdnum/module/week-02.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ <h2 class="anchored" data-anchor-id="metode-euler">Metode Euler</h2>
<p>dengan <span class="math inline">\(n+1\in \mathbb{N}\)</span> menyatakan banyaknya titik nantinya.</p>
<p>Solusi kita akan berupa titik yang nantinya dapat menggunakan interpolasi untuk nilai yang tidak dimuat di <span class="math inline">\(w_i\)</span></p>
<p>Algoritma untuk metode Euler adalah sebagai berikut:</p>
<div id="a24bb18b" class="cell">
<div id="5a3aa30b" class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>function [t, w] <span class="op">=</span> euler(f, a, b, n, alpha)</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> h <span class="op">=</span> (b <span class="op">-</span> a) <span class="op">/</span> n<span class="op">;</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> t <span class="op">=</span> zeros(n <span class="op">+</span> <span class="dv">1</span>, <span class="dv">1</span>)<span class="op">;</span></span>
Expand All @@ -241,7 +241,7 @@ <h2 class="anchored" data-anchor-id="metode-euler">Metode Euler</h2>
\end{aligned}
\]</span></p>
<p>maka kita dapat mendefinisikan <code>f=@(t, y)\left(y-t^{\wedge} 2+1\right)</code>, a=0, b=2, dan alpha <span class="math inline">\(=0.5\)</span> (@ disini menyatakan fungsi anonim yang cara kerjanya mirip dengan fungsi lambda pada Python), sehingga untuk <span class="math inline">\(n=10\)</span>, diperoleh kode sebagai berikut:</p>
<div id="1184db83" class="cell">
<div id="a2c9ea06" class="cell">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>f <span class="op">=</span> <span class="op">@</span>(t, y) (y<span class="op">-</span>t<span class="op">^</span><span class="dv">2</span> <span class="op">+</span> <span class="dv">1</span>)<span class="op">;</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>a <span class="op">=</span> <span class="dv">0</span><span class="op">;</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>b <span class="op">=</span> <span class="dv">2</span><span class="op">;</span></span>
Expand All @@ -251,7 +251,7 @@ <h2 class="anchored" data-anchor-id="metode-euler">Metode Euler</h2>
</div>
<p>Untuk visualisasinya, kita akan membuat plot dari hasil yang kita peroleh. Sebagai referensi, solusi eksak dari PD tersebut adalah <span class="math inline">\(y(t)=(t+1)^2- 0.5 e^t\)</span></p>
<p>Kita tambahkan kode berikut pada file:$</p>
<div id="c3aa5404" class="cell">
<div id="0107df5a" class="cell">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>sln <span class="op">=</span> <span class="op">@</span>(t) (t <span class="op">+</span> <span class="dv">1</span>)<span class="op">^</span><span class="dv">2</span> <span class="op">-</span> <span class="fl">0.5</span> <span class="op">*</span> exp(t)<span class="op">;</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>fplot(sln, [<span class="dv">0</span>, <span class="dv">2</span>], <span class="st">'b'</span>)<span class="op">;</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>hold on<span class="op">;</span></span>
Expand Down Expand Up @@ -301,7 +301,7 @@ <h2 class="anchored" data-anchor-id="metode-runge-kutta-dan-variasinya">Metode R
\]</span></li>
</ol>
<p>Berikut adalah list algoritmanya.</p>
<div id="5504f318" class="cell">
<div id="a2e93949" class="cell">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>function [t, w] <span class="op">=</span> midpoint(f, a, b, n, alpha)</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> h <span class="op">=</span> (b <span class="op">-</span> a) <span class="op">/</span> n<span class="op">;</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> t <span class="op">=</span> zeros(n <span class="op">+</span> <span class="dv">1</span>, <span class="dv">1</span>)<span class="op">;</span></span>
Expand All @@ -316,7 +316,7 @@ <h2 class="anchored" data-anchor-id="metode-runge-kutta-dan-variasinya">Metode R
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a> endfor</span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a>endfunction</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div id="31fea46e" class="cell">
<div id="0af779c4" class="cell">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>function [t, w] <span class="op">=</span> modeuler(f, a, b, n, alpha)</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> h <span class="op">=</span> (b <span class="op">-</span> a) <span class="op">/</span> n<span class="op">;</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> t <span class="op">=</span> zeros(n <span class="op">+</span> <span class="dv">1</span>, <span class="dv">1</span>)<span class="op">;</span></span>
Expand All @@ -331,7 +331,7 @@ <h2 class="anchored" data-anchor-id="metode-runge-kutta-dan-variasinya">Metode R
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a> endfor</span>
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a>endfunction</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div id="3e648713" class="cell">
<div id="39e552ac" class="cell">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>function [t, w] <span class="op">=</span> heun(f, a, b, n, alpha)</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> h <span class="op">=</span> (b <span class="op">-</span> a) <span class="op">/</span> n<span class="op">;</span></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a> t <span class="op">=</span> zeros(n <span class="op">+</span> <span class="dv">1</span>, <span class="dv">1</span>)<span class="op">;</span></span>
Expand All @@ -348,7 +348,7 @@ <h2 class="anchored" data-anchor-id="metode-runge-kutta-dan-variasinya">Metode R
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a> endfor</span>
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a>endfunction</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div id="c0204170" class="cell">
<div id="8d5d8029" class="cell">
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>function [t, w] <span class="op">=</span> rko4(f, a, b, n, alpha)</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a> h <span class="op">=</span> (b <span class="op">-</span> a) <span class="op">/</span> n<span class="op">;</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a> t <span class="op">=</span> zeros(n <span class="op">+</span> <span class="dv">1</span>, <span class="dv">1</span>)<span class="op">;</span></span>
Expand All @@ -365,7 +365,7 @@ <h2 class="anchored" data-anchor-id="metode-runge-kutta-dan-variasinya">Metode R
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true" tabindex="-1"></a> endfor</span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true" tabindex="-1"></a>endfunction</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div id="37914d67" class="cell">
<div id="db4c5587" class="cell">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>f <span class="op">=</span> <span class="op">@</span>(t, y) (y <span class="op">-</span> t <span class="op">^</span> <span class="dv">2</span> <span class="op">+</span> <span class="dv">1</span>)<span class="op">;</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>a <span class="op">=</span> <span class="dv">0</span><span class="op">;</span></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a>b <span class="op">=</span> <span class="dv">2</span><span class="op">;</span></span>
Expand Down
12 changes: 6 additions & 6 deletions docs/semuahalaman/modulprak/2023/genap/pdnum/module/week-03.html
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ <h3 class="anchored" data-anchor-id="multistep-eksplisit-metode-n-step-adams-bas
\end{gathered}
\]</span></p>
<p>program untuk two-step Adams-Bashforth:</p>
<div id="5aff5b7c" class="cell">
<div id="caaec26d" class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="op">%</span>function_file</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a>function [t, w] <span class="op">=</span> adams2(f, a, b, n, alpha)</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span> Inisiasi variabel awal</span>
Expand Down Expand Up @@ -285,7 +285,7 @@ <h3 class="anchored" data-anchor-id="multistep-eksplisit-metode-n-step-adams-bas
<span id="cb1-26"><a href="#cb1-26" aria-hidden="true" tabindex="-1"></a>endfunction</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>Berikut ini adalah contoh pengerjaaannya dengan menggunakan metode two-step Adams-Bashforth.</p>
<div id="96638cff" class="cell">
<div id="87c27c37" class="cell">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="op">%</span>script <span class="bu">file</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>f <span class="op">=</span> <span class="op">@</span>(t, y) (y <span class="op">-</span> t <span class="op">^</span> <span class="dv">2</span> <span class="op">+</span> <span class="dv">1</span>)<span class="op">;</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>a <span class="op">=</span> <span class="dv">0</span><span class="op">;</span></span>
Expand Down Expand Up @@ -332,7 +332,7 @@ <h3 class="anchored" data-anchor-id="multistep-implisit-metode-n-step-adams-moul
\end{aligned}
\]</span></p>
<p>Bentuk umum program yang akan dihasilkan</p>
<div id="c2a50060" class="cell">
<div id="7fcaec6b" class="cell">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="op">%</span>function_file</span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>function [t, w] <span class="op">=</span> adam<span class="op">-</span>moulton<span class="op">-</span>general(f, a, b, n, alpha)</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> [</span>
Expand Down Expand Up @@ -368,7 +368,7 @@ <h3 class="anchored" data-anchor-id="multistep-metode-n-step-adams-moulton-bashf
<h2 class="anchored" data-anchor-id="solusi-numerik-sistem-persamaan-differential">solusi numerik sistem Persamaan Differential</h2>
<section id="rungge-kutta-untuk-sistem-persamaan-differential-vectorize" class="level3">
<h3 class="anchored" data-anchor-id="rungge-kutta-untuk-sistem-persamaan-differential-vectorize">Rungge kutta untuk sistem persamaan differential (vectorize)</h3>
<div id="9074ac87" class="cell">
<div id="ff23fe59" class="cell">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="op">%</span>function_file</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a>function [t,w] <span class="op">=</span> rk4_sys(f, a, b, n, y0)</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="op">%</span>f :differential equation y_p <span class="op">=</span> f(t,y)</span>
Expand Down Expand Up @@ -398,7 +398,7 @@ <h3 class="anchored" data-anchor-id="rungge-kutta-untuk-sistem-persamaan-differe
&amp; I_2^{\prime}=f_2\left(t, I_1, I_2\right)=0.6 I_1^{\prime}-0.2 I_2=-2.4 I_1+1.6 I_2+3.6, \quad I_2(0)=0 .
\end{aligned}
\]</span> Persamasalahan berikut akan dikerjakan dengan <code>rk4_sys</code> dengan mengunakan titik awal <span class="math inline">\(t_0=0\)</span> dan <span class="math inline">\(t_{n+1}=1\)</span> dengan <span class="math inline">\(n=10\)</span> partisi.</p>
<div id="b81ffa2d" class="cell">
<div id="ecc232f7" class="cell">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="op">%</span>script <span class="bu">file</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a>f<span class="op">=@</span>(t, I) [<span class="op">-</span><span class="dv">4</span> <span class="op">*</span> I(<span class="dv">1</span>)<span class="op">+</span> <span class="dv">3</span> <span class="op">*</span> I(<span class="dv">2</span>)<span class="op">+</span><span class="dv">6</span> <span class="op">;</span> <span class="op">-</span><span class="fl">2.4</span><span class="op">*</span>I(<span class="dv">1</span>) <span class="op">+</span> <span class="fl">1.6</span> <span class="op">*</span> I(<span class="dv">2</span>)<span class="op">+</span><span class="fl">3.6</span>] <span class="op">%</span> fungsi</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="op">%</span> perhatikan bahwa I addalah vektor (hence ada I(<span class="dv">1</span>) dan I(<span class="dv">2</span>))</span>
Expand All @@ -416,7 +416,7 @@ <h3 class="anchored" data-anchor-id="rungge-kutta-untuk-sistem-persamaan-differe
</section>
<section id="predictor-corrector-metode-adams-bashforth-moulton-2-step-untuk-sistem-persamaan-differential-vectorize" class="level3">
<h3 class="anchored" data-anchor-id="predictor-corrector-metode-adams-bashforth-moulton-2-step-untuk-sistem-persamaan-differential-vectorize">Predictor-Corrector: Metode Adams-Bashforth-Moulton 2-step untuk sistem persamaan differential (vectorize)</h3>
<div id="73571592" class="cell">
<div id="d438819e" class="cell">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="op">%</span> the multi<span class="op">-</span>step second order method Adams<span class="op">-</span>Bashforth<span class="op">-</span>Moulton </span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="op">%</span>function_file</span>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit a484a73

Please sign in to comment.