besssugoa tool to build videos out of scientific calculations  
besssugobesssugo is a free computational tool specifically designed to aid a cognizant expert—i.e. you, whether an engineer, scientist, technician, geek, etc—to build videos showing the result of a certain scientific calculation or whatever data can be computed or storied in a digital computer. Technically speaking, it is a plugin for the computational tool wasora, which provides means to parse and understand a highlevel plaintext input file containing algebraic expressions, data for function interpolation, differential equations and output instructions amongst other facilities. Therefore, any mathematical computation which can be done by wasora—i.e. solving systems of differentialalgebraic equations, multidimensional interpolation of scattered data, numerical integration and differentiation, etc.—can be combined with the facilities that besssugo provides to create visual representations in the form of animations.Last modification: Sat, 12 Apr 2014 16:27:03 0400. downloadThe recommended way to get besssugo is to download the latest (0.2.20) source tarball and compile besssugo from scratch:
$ aptget install libsdl2dev $ aptget install libpng12dev libjpeg8dev bazaar repositoryIf you plan to contribute to besssugo, modify its sources or just want to get updated versions easily, you will need to branch the development tree of besssugo, which is hosted at Launchpad using bazaar as a control revision tool. The besssugo tree can be browsed online or branched into a local copy with$ bzr branch lp:besssugo quickstartFirst, download the source code, uncompress, configure, make, check, install and go to examples directory: $ wget http://www.talador.com.ar/jeremy/wasora/downloads/besssugo0.2.20.tar.gz $ tar xvzf besssugo0.2.20.tar.gz $ cd besssugo0.2.20 $ ./configure $ make $ make check $ sudo make install $ the yellow bouncing ballThe first problem solved in the make check step is a yellow ball that travels from left to right bouncing at the floor over a purple background that slighly changes over time. The time of the video, the canvas size, the ball radius and the eneryloss coefficient are chosen at random:CONST end_time w h b r c
end_time = random_gauss(4,1)
realtime_scale = 1
dt = 1/32
w = random_gauss(480,60)
h = random_gauss(360,40)
b = random(2,4)
r = random_gauss(0.05,0.02)
c = random(0.5,1.5)
WINDOW WIDTH w HEIGHT h CAPTION "the yellow bouncing ball"\
COORDINATES 0 h w h w HARDWARE \
COLOR 0.5+0.1*sin(2.123*t+1) 0.25+0.15*sin(1.321*t+2) 0.8+0.1*sin(1.707*t+3)
x = t/end_time
y = abs(cos(x*b*pi)) * exp(c*x)
CIRCLE R r X x Y y COLOR yellow
BESSSUGO_DRAW
Actually, this input shows the bouncing ball on the screen. Nevertheless, the following input (which is also included in the test suite) generates a video output by first dumping the frames to individual PNG images and then using avconv to create a WebM video. The FPS are chosen at the commandline: INCLUDE ball.was
dt = 1/$1
realtime_scale = 0
OUTPUT_FILE frame ball%04g.png step_transient
BESSSUGO_DUMP FILE frame
IF done
PRINT "encoding video..." NONEWLINE
SHELL "avconv y f image2 framerate $1 i ball%%04d.png vcodec libvpx ball.webm v quiet"
PRINT "ok!"
PRINT "removing temporary frames..." NONEWLINE
SHELL "rm f ball*.png"
PRINT "ok!"
ENDIF
find the green spotThe next tiny input generates an optical illusion. Can you find where the green spot is defined?NUMBER n = 12
R = 0.45
r = 0.05
T = 1.25
dt = 0.5*T/n
end_time = 10*T
realtime_scale = 1
WINDOW WIDTH 1440 HEIGHT 920 COLOR grey50 \
CAPTION "find the green spot"
CIRCLE ARRAY n X R*cos(2*pi*i/n) \
Y R*sin(2*pi*i/n) \
R r*(mod(t+(i1)*T/n,T)>T/n) \
COLOR magenta
BESSSUGO_DRAW
Again, besssugo uses the actual screen to output the trick. However, here is an scaled video of the output: the lorenz systemBuild your own version of the Lorenz attractor by first stating which variables belong to the phase space, setting the integration time, defining the constant parameters and the initial conditions. Instead of writing the output to a text file (as in wasora's quickstart), now send the results online to the screen:# the contents of these file between the dashed lines is
# exactly equal to wasora's example file lorenz.was
# 8< cut here 8<
# lorenz' seminal dynamical system
PHASE_SPACE x y z
end_time = 40
CONST sigma r b
sigma = 10 # parameters
r = 28
b = 8/3
x_0 = 11 # initial conditions
y_0 = 16
z_0 = 22.5
# the dynamical system
x_dot .= sigma*(y  x)
y_dot .= x*(r  z)  y
z_dot .= x*y  b*z
PRINT t x y z
# 8< cut here 8<
# these four lines are the ones that besssugo reads and
# uses to draw a colorful representation of the
# xz phasespace plane of lorenz' butterfly
# realtime_scale = 1
WINDOW WIDTH 640 HEIGHT 480 COLOR black PERSISTENT \
COORDINATES 320 480 15 10 15 HARDWARE
SEGMENT X1 last(x) X2 x Y1 last(z) Y2 z \
COLOR 0.5*(1+cos(5.071*t+1.5)) \
0.5*(1+cos(2.241*t+1)) \
0.5*(1+cos(9.457*t))
BESSSUGO_DRAW
See also the section about The Lorenz chaotic system and The chaotic Lorenzian waterwheel amongst other further examples in The wasora Real Book. chaosStudy the chaotic nature of the Lorenz equations by slighly perturbing the initial conditions for one hundred of systems:# this example illustrates the sensitivity to initial conditions
# of the lorenz system by solving one hundred systems with
# slightly different initial conditions
NUMBER N 100
VECTOR vx SIZE N
VECTOR vy SIZE N
VECTOR vz SIZE N
PHASE_SPACE vx vy vz
end_time = 40
# same parameters for all cases
CONST sigma r b
sigma = 10
r = 28
b = 8/3
# slightly different initial conditions
eps = 1e3
vx_0(i) = 11 + eps*i
vy_0(i) = 16 + eps*i
vz_0(i) = 22.5 + eps*i
# the dynamical systems (v stands for vector)
vx_dot(i) .= sigma*(vy(i)  vx(i))
vy_dot(i) .= vx(i)*(r  vz(i))  vy(i)
vz_dot(i) .= vx(i)*vy(i)  b*vz(i)
# realtime_scale = 1
WINDOW WIDTH 640 HEIGHT 480 COLOR black COORDINATES 320 480 15 10 15 HARDWARE
CIRCLE ARRAY N X vx(i) Y vz(i) RAD 0.1 COLOR 1exp(3*i/N) sin(pi*i/N) cos(0.5*pi*i/N)
BESSSUGO_DRAW
documentationthe wasora real bookThe following sections of the wasora Real Book include examples of videos generated by besssugo:the examples subdirectoryFollowing the idea of the wasora Real Book which consists of examples of application, the besssugo source tarball includes a subdirectory called examples which contain some readytouse examples. They can be browsed online at the bazaar repository.further examplesthe simple pendulumFrom the Newton, Lagrange & Hamilton section of the Wasora Real Book:the double pendulumFrom the The double pendulum section of the Wasora Real Book:the lorenzian chaotic waterwheelFrom tge The chaotic Lorenzian waterwheel section of the Wasora Real Book:mailing listThere exist a mailing list < wasora @ talador.com.ar > where questions can be posted about any aspect of the code, including intallation, usage and development. Besides suscribing and directly asking a question, you can also browse the archives. Bugs reports are also welcome. platformsbesssugo is free software, and as such it is developed under a free operating system, namely Debian GNU/Linux. The distribution tarball is based on GNU Autoconf & friends, so besssugo should build in any POSIXcompliant environment. However, besssugo is a fairly complex piece of software, so portability is not guaranteed (but improvements are welcome). Running besssugo in nonfree operating systems is discouraged, and such topic is not of the interest of the author of besssugo. However, contributions and experiences may be well received if discussed in the mailing list. licensebesssugo is released under the terms of the GNU General Public License version 3, or at your option, any later version. Bottomline is, you get the four software freedoms
projects besssugo relies onrequired libraries
optional librariesTo be done.
© jeremy theler 2004—2014 
