The HTML page can feature a grid structure of cells, defined by the following syntax in case of a 1x3 grid:
# begin-grid-area
!bslidecell 00
...
!eslidecell
!bslidecell 01
...
!eslidecell
!bslidecell 02
...
!eslidecell
# end-grid-area
# begin/end-grid-area directives mark the beginning and end of a region where we can have horizontal elements stacked in a grid.For example, the mathematics in the following 2x2 grid structure will be lost because it appears outside the slidecell environments:
# begin-grid-area
!bslidecell 00
...
!eslidecell
!bslidecell 01
...
!eslidecell
We consider
!bt
\[ f(x, y) = \sin (x + y) \]
!et
!bslidecell 10
...
!eslidecell
!bslidecell 11
...
!eslidecell
# end-grid-area
A nice feature is that the coordinates of the cells, here 00, 01,
and 02 can be given in any desired order. For example, if we want
to reverse the sequence of the three elements in the three columns
of this grid, we simply change 00 by 02 and 02 by 00.
Mathematics. Given a function
$$ f(x) = e^{-ax}\sin wx\thinspace .$$Write a program for evaluating \( f(x) \), and test the program for the value of \( f(0) \).
Implementation. The Python implementation reads
from math import exp, sin
def f(x):
return exp(-a*x)*sin(w*x)
where a and w must be global variables, initialized in the
main program.
Computational experiment. With a main program
a = 1
from math import pi
w = pi
print f(0)
we can run the program:
Terminal> python prog.py
0
Given a function
$$ f(x) = e^{-ax}\sin wx\thinspace .$$Write a program for evaluating \( f(x) \), and test the program for the value of \( f(0) \).
The Python implementation reads
from math import exp, sin
def f(x):
return exp(-a*x)*sin(w*x)
where a and w must be global variables, initialized in the
main program.
With a main program
a = 1
from math import pi
w = pi
print f(0)
we can run the program:
Terminal> python prog.py
0