Horizontal alignment of document elements

Principles of grid structures

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

Example on a 1x3 grid structure

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

Variation of the previous grid structure using panels

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