mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-10 19:07:11 +01:00
The 250-line cap applies to prose too, and the reports were the worst
offenders -- ENUME's projectA.tex alone was 1,876 lines. Each is now a
preamble plus one \input{} per section, which is how a long LaTeX document is
normally organised; not one byte of prose was rewritten.
"The PDF is unchanged" is checked by a script rather than by eye, because
hashing the PDF cannot work: pdflatex stamps a /CreationDate and an /ID into
every build, so two runs of the SAME source already differ. tex_fingerprint.sh
compares what a reader sees instead -- page count plus a hash of the extracted
text -- and it is stable across rebuilds of untouched sources, which is the
property that makes it usable as a gate.
It earned its keep immediately. Both ECOTE reports quote an example LaTeX
document inside an lstlisting block, so \end{document} appears in the middle
of the file; splitting on the FIRST one stranded everything after it. Same
page count, different text, caught automatically. EOPSY lab3 exposed a second
bug: a \section{} title that runs onto the next line.
Result: 19 .tex over the cap -> 1. The survivor,
ELAC/.../03-building-nfa-...tex, is 418 lines of consecutive tikz figures
with no subsection to split on and needs a hand-placed boundary.
Verified: 29 splits across two passes (section, then subsection for the
pieces still over), every one reporting `unchanged` from
scripts/tex_fingerprint.sh --check.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172dj34FDpao6wsix8ZuCzE
39 lines
1.9 KiB
TeX
39 lines
1.9 KiB
TeX
\section{a) Runge-Kutta method of $4^{th}$ order and Adams PC}
|
|
\subsection{Problem}
|
|
We are given following equations:
|
|
\[ \frac{dx_1}{dt} = x_2 + x_1(0.5 - x_1^2 - x_2^2) \]
|
|
\[ \frac{dx_2}{dt} = -x_1 + x_2(0.5 - x_1^2 - x_2^2) \]
|
|
|
|
And we have to determine the trajectory of the motion on interval $[0, 15]$ with following initial conditions:
|
|
$ x_1(0) = 8; x_2(0) = 9 $
|
|
In this section we will use Runge-Kutta method of $4^{th}$ order and Adams PC with different step-sizes until we find an optimal constant step size - when the decrease of the step size does not influence the solution significantly.
|
|
|
|
\subsection{Theoretical Introdution}
|
|
Determining the trajectory of the motion in this example can be mathematically described as solving a system of first order ordinary differential equations with given initical conditions. That is why we use Runge-Kutta method of order 4 which deals with exactly this kind of problem.
|
|
\subsubsection{Runge-Kutta method of order 4}
|
|
Any single step method are defined by the following formula, where h is a fixed step-size:
|
|
\[ y_{n+1} = y_n + \Phi_f(x_n, y_n, h) \]
|
|
where:
|
|
\[ x_n = x_0 + nh \]
|
|
\[ y(x_0) = y_0 = y_a \]
|
|
where $y_a$ is given.
|
|
Runge-Kutta method of order 4 - RK4 method looks like this:
|
|
\[ y_{n+1} = y_n + \frac{1}{6}(k_1 + 2k_2+2k_3+k_4) \]
|
|
\[ k_1 = f(x_n, y_n) \]
|
|
\[ k_3 = f(x_n + \frac{1}{2}h, y_n + \frac{1}{2}hk_1) \]
|
|
\[ k_2 = f(x_n + \frac{1}{2}h, y_n + \frac{1}{2}hk_2) \]
|
|
\[ k_4 = f(x_n + h, y_n + hk_3) \]
|
|
|
|
|
|
\subsection{Adams PC method}
|
|
Adams method with $P_kEC_kE$ algorithm has the following form: \\
|
|
P: \[ y_n^{[0]} = y_{n-1} + h\sum_{j=1}^k \beta_jf_{n-j} \]
|
|
E: \[ f_n^{[0]} = f(x_n, y_n^{[0]}) \]
|
|
C: \[ y_n = y_{n-1} + h \sum_{j=1}^k \beta_j^* f_{n-j} + h \beta_0^* f_n^{[0]}\]
|
|
E: \[ f_n = f(x_n, y_n) \]
|
|
|
|
When compared to explicit and implicit adams method PC metho has smaller absolute stability intervals than implicit method, while having significant advantage in calculations cost.
|
|
|
|
|
|
|