commit a4c0e92c4e453159b0a249172a37d96b72ae30df
parent 455238172196e9c34a2a425818a7107f3f07cace
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date: Wed, 7 Feb 2024 00:04:58 -0500
Example: Texify.
Diffstat:
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/doc/r7rs-small/scheme-example.texinfo b/doc/r7rs-small/scheme-example.texinfo
@@ -1,19 +1,24 @@
@node Example
@chapter Example
-The procedure integrate-system integrates the system
+The procedure @code{integrate-system} integrates the system
- yk⁄ = fk(y1, y2, @dots{}, yn), k = 1,
- @dots{}, n
+@displaymath
+y_k^\prime = f_k(y_1, y_2, \ldots, y_n), \; k = 1, \ldots, n
+@end displaymath
of differential equations with the method of Runge-Kutta.
-The parameter system-derivative is a function that takes a system state (a vector of values
-for the state variables y1, @dots{}, yn) and produces a system derivative (the values y1⁄, @dots{}, yn⁄). The
-parameter initial-state provides an initial system state, and h is an initial guess for the
-length of the integration step.
+The parameter @code{system-derivative} is a function that takes a system
+state (a vector of values for the state variables
+@math{y_1, \ldots, y_n})
+and produces a system derivative (the values
+@math{y_1^\prime, \ldots, y_n^\prime}). The parameter @code{initial-state} provides an initial
+system state, and @code{h} is an initial guess for the length of the
+integration step.
-The value returned by integrate-system is an infinite stream of system states.
+The value returned by @code{integrate-system} is an infinite stream of
+system states.
@lisp
(define (integrate-system system-derivative
@@ -27,7 +32,7 @@ The value returned by integrate-system is an infinite stream of system states.
states)))
@end lisp
-The procedure runge-kutta-4 takes a function, f, that produces a system
+The procedure @code{runge-kutta-4} takes a function, @code{f}, that produces a system
derivative from a system state. It produces a function that takes a system state and
produces a new system state.
@@ -74,7 +79,7 @@ produces a new system state.
(elementwise (lambda (x) (* x s))))
@end lisp
-The map-streams procedure is analogous to map: it
+The @code{map-streams} procedure is analogous to @code{map}: it
applies its first argument (a procedure) to all the elements of its second argument (a
stream).
@@ -94,15 +99,16 @@ the stream.
(force (cdr stream)))
@end lisp
-The following illustrates the use of integrate-system in integrating the system
+The following illustrates the use of @code{integrate-system} in
+integrating the system
- C dvC = −iL vC
- −
- dt R
+@displaymath
+C {dv_C \over dt} = -i_L - {v_C \over R}
+@end displaymath
- L diL = vC
-
- dt
+@displaymath
+L {di_L \over dt} = v_C
+@end displaymath
which models a damped oscillator.